[R] from .csv file to a pca plot

Petr Pikal petr.pikal at precheza.cz
Tue Apr 13 13:55:02 CEST 2004


On 13 Apr 2004 at 13:25, Dansen, Ing. M.C. wrote:

> Hi,
> I'm just a beginner, who has just encountered a problem!
> 1. -	I wanted to load a csv file with names in the rows (1st column)
>     and and numbers in the 2nd til 10th column. The file contains
> names in the headers.
>    - 	I used;  a <- as.matrix(read.table("filename", sep=',",
> row.names=1, header=TRUE)

maybe read.csv("filename") will do the same without need for other 

Why do you convert it to matrix? What is wrong with data frame?

> Question;	1 -	I would like to select the first four columns

>   2 -	and execute a pca(plot) from the mva package on
> those four columns

go through examples in mva

>   3 -	how can I set the data type eg(string, integer,
> double) separate for each column

During loading process you can use colClasses argument to read.csv or 

Or you can change the column type by as.xxxxxxx statement

> Can anyone help me out, Help!
> Thanks in advance,
> Marinus


> This e-mail and its contents are subject to the DISCLAIMER at
> http://www.tno.nl/disclaimer/email.html
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz

More information about the R-help mailing list