It’s different yes. I’m going to point out some of the errors, with solutions. Your logic still looks flawed regardless of my below help. You must ensure that you add the images to the table when needed and remove them all at the end.
There is no need in your case (if i understand it correctly, to loop through a table initially to create them)
First problem:
local RectTable = {}
This should be moved outside of the function, probably. If your calling this function on a timer then move it outside of the function.
Second problem:
Your for loop does nothing. The second argument to the for iterator must be a number. At the time of creating the for loop, “BlackRect” is nil. Currently your for loop evaluates to:
for i = 1, nil do
Which will cause an error.
Third problem, not removing the image.
table.remove( RectTable )
Removes the last element from the rect table. It has nothing to do with the screen.
You could also do the table remove statement like this:
table.remove( RectTable, i ) -- or RectTable[i] = nil
Now… To remove the images from the screen (as you already knew how to so previously) goes like this (in your case, once the logic and other problems are sorted)
display.remove( RectTable[i] ) -- or RectTable[i]:removeSelf()
The difference between both ways is listed on their respective documentation pages.
I would strongly suggest that you take a step back for a bit. Go to the corona university guides (listed on the resources page) and run through them, to get a better grasp of the basics.
Also J.A Whye’s (hope i spelt his second name correctly) video and written tutorials are fantastic for people new to corona and would help you a lot.
Also the previous link i posted is an invaluable resource for explaining the Lua language itself. I cannot stress enough how important it is to have a firm grasp of Lua before getting too far into the deep end.
You will be using tables a lot in Lua, so now is the time to learn them 
Hope this helps.