a<- data.frame(x=runif(10), y = runif(10), Acc = 1)
b<- data.frame(x=runif(10), y = runif(10), Acc = 0)
ls<- list(a,b)
When I type ls[[1]]
and ls[[2]]
, it prints the respective data frames. class(ls[1])
and class(ls[2])
shows me they are list. class(ls[[1]])
and class(ls[[2]])
shows me they are data frames. However when I type rm(ls[1])
or rm(ls[[1]])
, I get the following error :
Error in rm(ls[1]) : ... must contain names or character strings.
I never see these kind of data frames which I create by a list in the environment window of R Studio. If I use rm(list=ls())
, I can remove everything without retaining what I want.
How shall remove ls[[1]]
and ls[[2]]
?