[R] data() problem solved

Edna Bell edna.bell01 at gmail.com
Thu Aug 9 10:54:08 CEST 2007


Problem solved:
 sapply(data(package="car")$results[,3], function(x)class(get(x)))
sorry for the silliness



Hi R Gurus:

I'm using the data() function to get the list of data sets for a package.

I would like to find the class for each data set; i.e.,data.frame, etc.

Using str(), I can find the name of the data set.

However, when I try the class function on the str output, I get
"character", since the name in the str is a character.

I've also tried this with just plain results column.  Still no luck.

Any help would be much appreciated.

Sincerely,

Edna Bell


Hi R Gurus:

I'm using the data() function to get the list of data sets for a package.

I would like to find the class for each data set; i.e.,data.frame, etc.

Using str(), I can find the name of the data set.

However, when I try the class function on the str output, I get
"character", since the name in the str is a character.

I've also tried this with just plain results column.  Still no luck.

Any help would be much appreciated.

Sincerely,

Edna Bell



More information about the R-help mailing list