[R] Help with dimnames()

Smith, Phil (CDC/NIP/DMD) pzs6 at CDC.GOV
Tue Jun 20 19:00:51 CEST 2006


Hi R people:

I'm trying to set the dimnames of a data frame called "ests" and am
having trouble!

First, I check to see if "ests" is a data.frame... 

> is.data.frame( ests )
[1] TRUE

... and it is a data frame!

Next, I try to assign dimnames to that data frame....

> dimnames( ests )[[ 1 ]] <- as.character( ests$stfips )
Error in "row.names<-.data.frame"(`*tmp*`, value = c("1001", "1003",
"1005",  : 
        missing 'row.names' are not allowed

... and I have trouble!!

Finally, I check to see if ests$stfips has the same length as the number
of rows in "ests"...

> nrow( ests ) == length( as.character( ests$stfips ) )
[1] TRUE

... and it does!!

Does anybody have a suggestion to solve this problem?

Thanks!
Phil Smith
pzs6 at cdc.gov
National Immunization Program
Centers for Disease Control and Prevention
Atlanta, GA



More information about the R-help mailing list