On 29/11/10 05:29, Melissa Waldman wrote:
Hi,

I have been working with Program R for my stats class and I keep coming upon
the same error, I have read so many sites about inputting data from a text
file into R and I'm using the data to do a correspondence analysis.  I feel
like I have read everything and it is still not explaining why the error
message keeps coming up, I have used the exact examples I have seen in
articles and the same error keeps popping up: Error in sum(N) : invalid
'type' (character) of argument

I have spent sooooooooooooo long trying to figure this out without success,
I am sure it has to do with the fact that my rows have names in them.  I
have attached the text file I have been using and if you have any ideas as
to how I can get R to plot the data using correspondence analysis with the
column and row names that would be really helpful!  Or if you could pass
this email to someone who may know how to help me, that would be much
appreciated.

Thank you,
Melissa Waldman

Hi Melissa,

Welcome to the world of R. You didn't tell us which commands you were running that gave an error, but the error 'invalid 'type'' suggests to me you were trying to sum a variable that R thought was a character, and not a number.

I would recomend you (re) read the introduction to R (http://cran.r-project.org/doc/manuals/R-intro.pdf), especially chapter 2, which deals with this.

As a quick example, if you've read your file into a dataframe called foo, with columns none, light etc then doing

class(foo$none)

will tell you what R thinks this field is. If it is character then you can do

foo$none <- as.numeric(foo$none)

to tell R to treat it as numbers.

Regards,

Paul.

______________________________________________
R-help@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.

Reply via email to