[R] Help Please!!!!!!!!!

Adaikalavan Ramasamy a.ramasamy at imperial.ac.uk
Tue Nov 30 13:03:32 CET 2010


Dear Melissa,

If Jim's solution doesn't work then for some reason your function is 
converting numerical values into either character or factor and I would 
suggest you use the colClasses argument to force the right class.

For example,

  mat <- read.table( file="lala.txt", sep="\t", row.names=1, header=T,
                     colClasses=rep("numeric", 4) )

Then do a str(mat) and see what you get.

Regards, Adai



On 29/11/2010 13:02, jim holtman wrote:
> Your data seems to read in just fine, so what is the problem you are
> trying to solve?
>
>> x<- read.table('clipboard', sep='\t', header=TRUE)
>> str(x)
> 'data.frame':   5 obs. of  5 variables:
>   $ X     : Factor w/ 5 levels "JE","JM","S",..: 5 2 4 1 3
>   $ None  : int  4 4 25 18 10
>   $ Light : int  2 3 10 24 6
>   $ Medium: int  3 7 12 33 7
>   $ Heavy : int  2 4 4 13 2
>> summary(x)
>    X          None          Light        Medium         Heavy
>   JE:1   Min.   : 4.0   Min.   : 2   Min.   : 3.0   Min.   : 2
>   JM:1   1st Qu.: 4.0   1st Qu.: 3   1st Qu.: 7.0   1st Qu.: 2
>   S :1   Median :10.0   Median : 6   Median : 7.0   Median : 4
>   SE:1   Mean   :12.2   Mean   : 9   Mean   :12.4   Mean   : 5
>   SM:1   3rd Qu.:18.0   3rd Qu.:10   3rd Qu.:12.0   3rd Qu.: 4
>          Max.   :25.0   Max.   :24   Max.   :33.0   Max.   :13
>
>
> On Mon, Nov 29, 2010 at 12:29 AM, Melissa Waldman
> <melissawaldman at gmail.com>  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
>>
>> my email: melissawaldman at gmail.com
>>
>> ______________________________________________
>> 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