[R] Error message: attempt to set rownames on object with no dimensions

David Winsemius dwinsemius at comcast.net
Wed Jul 21 16:07:14 CEST 2010


On Jul 21, 2010, at 9:39 AM, Igor Blanco wrote:

> Hi there,
>
> I am trying to analyze some data using the lme package.
> In my case there is a variable called Newmarker that can only take 2  
> values
> (number 1 or number 2).
> I have used the as.factor to remark this fact but an error message  
> appears
> stating: attempt to set rownames on object with no dimensions.
>
> Here is the code I have used:
>
> *Dataset <-   read.table("Data2.txt", header=TRUE, sep="",  
> na.strings="NA",
> dec=".", strip.white=TRUE)
>
> Dataset$Newmarker <- as.factor(Dataset$Newmarker)

Why do you use as.factor? It's probably already a factor. What does  
str(Dataset) show?

>
> attach(Dataset)

You do not need to do this, and it creates potential for confusion.  
The data= argument will allow the column names to be accessed by the  
lme() function.

>
> lme.1 <- lme(Newmarker ~ Age, data=Dataset,  random= ~1|ID)
>
> summary(lme.1)*
>
> If I don't use the as.factor I have no problems but I don't think  
> this is
> the correct way to proceed... The other variables I use can have any  
> value.


-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list