[R] invalid 'row.names' length error when running scatterplots or plot in R Commander
Samantha McKenzie
s.mckenzie5 at uq.edu.au
Wed Sep 22 09:49:38 CEST 2010
Thank you everyone for your helpful feedback.
To clarify a few things that people have been asking:
Part of the problem comes from the fact that these are external
students, so our conversations are over email and I'm not there to try
things.
I admit my shortcomings when it comes to R script writing. We use R
Commander only in the course and play around with script within the
Script Window when needed. I am realizing that R Commander can do things
slightly differently to R itself.
Scatterplot is a function within R commander and it sounds like it isn't
a function in R itself--plot does the same thing. The error message that
they received is the entire error message that R Commander produces.
This dataset is one of ours and does not come from an R package. The
problem happens on any dataset whether it is read from an .rda or .csv
file.
I've used these datasets with Rcmdr over the last year and several
hundred students without problem before now.
I don't teach attach() to the students, but had these two use it in this
instance because Rcmdr wasn't recognizing dataset$variable.
>plot(Calf~Bicep, data=Mass) will also work.
The students can correctly run stats using the data and the appropriate
variables are present, etc, suggesting that the data are being read in
OK.
I will get the students to run the code in R itself to see if that works
and also push for full output including str(), ls(), sessionInfo(),
traceback() etc from the students and will report back.
Cheers,
Sam
-----Original Message-----
From: Dejian Zhao [mailto:dejian.zhao at gmail.com]
Sent: Monday, 20 September 2010 5:32 PM
To: r-help at r-project.org
Cc: Samantha McKenzie
Subject: Re: [R] invalid 'row.names' length error when running
scatterplots or plot in R Commander
I did not reproduce the error either, because I failed to find the
function scattperplot in your script. :D I suggest that you check
whether they read the data into R correctly.
On 2010-9-20 10:00, Samantha McKenzie wrote:
> Hello,
> I teach statistics and use R Commander for teaching. I have 2 students
> out of 169 that can't get scatterplots or plot to work. I have had
them
> update packages, restart R/R Commander/their computers and even
> reinstall R/R Commander. One is using Windows 7 on a new pc and the
> other is a pc user (not sure the OS). They are both using R2.11.1 and
R
> Commander 1.6-0.
>
> The data look like this:
>> Mass
> Mass Fore Bicep Chest Neck Shoulder Waist Height Calf Thigh Head
> 1 77.0 28.5 33.5 100.0 38.5 114.0 85.0 178.0 37.5 53.0 58.0
> 2 85.5 29.5 36.5 107.0 39.0 119.0 90.5 187.0 40.0 52.0 59.0
> 3 63.0 25.0 31.0 94.0 36.5 102.0 80.5 175.0 33.0 49.0 57.0
> 4 80.5 28.5 34.0 104.0 39.0 114.0 91.5 183.0 38.0 50.0 60.0
> 5 79.5 28.5 36.5 107.0 39.0 114.0 92.0 174.0 40.0 53.0 59.0
> 6 94.0 30.5 38.0 112.0 39.0 121.0 101.0 180.0 39.5 57.5 59.0
> 7 66.0 26.5 29.0 93.0 35.0 105.0 76.0 177.5 38.5 50.0 58.5
> 8 69.0 27.0 31.0 95.0 37.0 108.0 84.0 182.5 36.0 49.0 60.0
> 9 65.0 26.5 29.0 93.0 35.0 112.0 74.0 178.5 34.0 47.0 55.5
> 10 58.0 26.5 31.0 96.0 35.0 103.0 76.0 168.5 35.0 46.0 58.0
>
>
> This script:
>> scatterplot(Calf~Bicep, reg.line=lm, smooth=FALSE, spread=FALSE,
> + boxplots=FALSE, span=0.5, data=Mass)
>
> Produces this error:
> invalid 'row.names' length
>
> The data look fine and correlation/regression can be done on them with
> correct output. Just not scatterplots.
>
> I tried a work around using the following script, but still with the
> same result:
> attach(Mass)
> Mass
> str(Mass)
> names(Mass)
> plot(Calf~Bicep)
> abline(lm(Calf~Bicep))
>
> I cannot repeat the error, nor have I found much information on that
> error message, and I'm a bit stumped why these two students are
getting
> the error even after one has reinstalled the program.
>
> Cheers,
> Sam McKenzie
> The University of Queensland
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list