Arun Kumar Saha wrote: > Dear R users, > > Suppose I have a 4*5 data frame like this: > > Date x1 x2 x3 x4 > 1/1/2004 100 22 12 34 > 2/1/2004 33 -22 33 12 > 3/1/2004 12 12 -11 5 > 4/1/2004 1 223 22 1 > > Now I want to get a correlation matrix for this dataset excluding column-1 > and column-3 i.e. I want to get a correlation matrix for variables x1, x3, > x4. I know that if this dataframe has only three columns containing x1, x3 > and x4 instead of five columns then I can use "cor" function. If anyone give > me any code for doing this I will be very grateful >
cor(dat[,-c(1,3)] Uwe Ligges > Thanks, > Arun > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html