- #1
Philip Wong
- 95
- 0
hello,
ok here is the situation, I wanted use R to plot a PC scores using a group variable (which is an external variable) as the plotting score. the command for printing the PC scores is prin$x. Below is some steps I've took so far:
> library(MASS) //loading the library called MASS
> island.df=read.csv(file.choose(),header=T) //feeding in the data file I want to do analyze on
> log.island.df=log((island.df[,4:10])+1) //log transform my data, because it was skewed
> x=island.df //rename my data into x, for easier used future
> prin=princomp(x[,4:10])
> scores=(x~as.factor(group)) //factorize the group variable as the plotting symbol, IS THIS HOW I DO IT? Is there other ways?
> prin$scores[,1:2] //I just want to print the first 2 components.IS this right? did I do something wrong? because I got no clue how the printout should looks like, so I don't know have I done it right or not!
ok here is the situation, I wanted use R to plot a PC scores using a group variable (which is an external variable) as the plotting score. the command for printing the PC scores is prin$x. Below is some steps I've took so far:
> library(MASS) //loading the library called MASS
> island.df=read.csv(file.choose(),header=T) //feeding in the data file I want to do analyze on
> log.island.df=log((island.df[,4:10])+1) //log transform my data, because it was skewed
> x=island.df //rename my data into x, for easier used future
> prin=princomp(x[,4:10])
> scores=(x~as.factor(group)) //factorize the group variable as the plotting symbol, IS THIS HOW I DO IT? Is there other ways?
> prin$scores[,1:2] //I just want to print the first 2 components.IS this right? did I do something wrong? because I got no clue how the printout should looks like, so I don't know have I done it right or not!