[R] data manipulation

Jim Lemon jim at bitwrit.com.au
Wed May 15 15:15:41 CEST 2013


On 05/15/2013 04:15 PM, catalin roibu wrote:
> Hello all!
> I have a problem with my data.
> My initial data is a list years and months (see below). I want to transpose
> my data (12 rows (months) and year values as column). I try t(spi3), but
> the year values do not appear as column names, but as values. Please help
> me to solve this problem!

Hi catalin,
Try this:

spi4<-data.frame(t(spi3[,-1]))
names(spi4)<-spi3$year

Jim



More information about the R-help mailing list