Hi, Did you mean this? dat3$year<-1901:2009 dat4<-dat3[,c(13,1:12)] head(dat4,2) # year Jan Feb Mar Apr May Jun Jul #1 1901 NA NA NA NA 1.0309351 1.76204866 1.87906713 #2 1902 -1.195531 -0.8941016 -0.4601555 0.15921 0.3515647 0.04890923 0.03665184 # Aug Sep Oct Nov Dec #1 1.7191440 1.1226632 1.3777239 0.1114739 -0.51120062 #2 -0.1091491 -0.1324877 -0.1511746 -0.3828513 -0.08032998 A.K.
________________________________ From: catalin roibu <catalinro...@gmail.com> To: arun <smartpink...@yahoo.com> Sent: Wednesday, August 28, 2013 8:56 AM Subject: Re: [R] SPI package error I don't know how the set variables in first column, in rest a know to compute seq. On 28 August 2013 15:54, catalin roibu <catalinro...@gmail.com> wrote: Thank you! >A last question! In the first column I want to insert variable years at 1901 >to 2009. > > >Best regards! > > > >On 28 August 2013 15:39, arun <smartpink...@yahoo.com> wrote: > >Hi, >>str(dat2) >># ts [1:1308, 1] NA NA NA NA 1.03 ... >> #- attr(*, "tsp")= num [1:3] 1 110 12 >># - attr(*, "dimnames")=List of 2 >> # ..$ : NULL >> # ..$ : chr "Series 1" >> >>If you want it as a data.frame, >>dat3<-as.data.frame(matrix(as.numeric(dat2),ncol=12,byrow=TRUE)) >>colnames(dat3)<- month.abb >> head(dat3,2) >># Jan Feb Mar Apr May Jun Jul >>#1 NA NA NA NA 1.0309351 1.76204866 1.87906713 >>#2 -1.195531 -0.8941016 -0.4601555 0.15921 0.3515647 0.04890923 0.03665184 >># Aug Sep Oct Nov Dec >>#1 1.7191440 1.1226632 1.3777239 0.1114739 -0.51120062 >>#2 -0.1091491 -0.1324877 -0.1511746 -0.3828513 -0.08032998 >>A.K. >> >> >> >> >> >> >>----- Original Message ----- >>From: arun <smartpink...@yahoo.com> >>To: catalin roibu <catalinro...@gmail.com> >>Cc: R help <r-help@r-project.org> >>Sent: Wednesday, August 28, 2013 8:31 AM >>Subject: Re: [R] SPI package error >> >> >> >>Hi, >> >>If you wanted the 'fitted' values: >> source("cat1.txt") >>#dat1 is the dataset >>dat2<-dat1$fitted >> >>A.K. >> >> >>________________________________ >>From: catalin roibu <catalinro...@gmail.com> >>To: arun <smartpink...@yahoo.com> >>Sent: Wednesday, August 28, 2013 8:26 AM >>Subject: Re: [R] SPI package error >> >> >> >>I have another question, how can extract 12 monthly values for each year from >>this> >> >>> >>> >>> >>> >>> >>> >>>________________________________ >>>From: catalin roibu <catalinro...@gmail.com> >>>To: arun <smartpink...@yahoo.com> >>>Sent: Wednesday, August 28, 2013 8:12 AM >>>Subject: Re: [R] SPI package error >>> >>> >>> >>> >>>Thanks for help! >>>the reproducible example is> >>>data(spi_data) >>>write.table(spi_data,file="spi.txt",quote=FALSE,row.names=TRUE) >>>## Standard format with the output in the text format >>>spi(6,"spi.txt",1963,2010) >>> >>> >>> >>> >>>On 28 August 2013 15:09, arun <smartpink...@yahoo.com> wrote: >>> >>>HI, >>>>Could you provide a reproducible example? >>>>Tx. >>>> >>>> >>>> >>>> >>>> >>>>----- Original Message ----- >>>>From: catalin roibu <catalinro...@gmail.com> >>>>To: r-help@r-project.org >>>>Cc: >>>>Sent: Wednesday, August 28, 2013 8:05 AM >>>>Subject: [R] SPI package error >>>> >>>>Dear all! >>>> >>>>I find a problem from SPI package. When I try a 6 months scale I have this >>>>error: >>>>write.table(test,file="spi.txt",quote=FALSE,row.names=TRUE) >>>>spi3<-spi(6,"spi.txt",1902,2009) >>>>Error in paste(title, sep = "") : >>>> argument "title" is missing, with no default >>>>If I use 3 months scale everything is ok. >>>> >>>>Please help me to solve this problem! >>>> >>>>Thank you! >>>> >>>> >>>>-- >>>>--- >>>>Catalin-Constantin ROIBU >>>>Lecturer PhD, Forestry engineer >>>>Forestry Faculty of Suceava >>>>Str. Universitatii no. 13, Suceava, 720229, Romania >>>>office phone +4 0230 52 29 78, ext. 531 >>>>mobile phone +4 0745 53 18 01 >>>> +4 0766 71 76 58 >>>>FAX: +4 0230 52 16 64 >>>>silvic.usv.ro >>>> >>>> [[alternative HTML version deleted]] >>>> >>>>______________________________________________ >>>>R-help@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. >>>> >>>> >>> >>> >>>-- >>> >>>--- >>>Catalin-Constantin ROIBU >>>Lecturer PhD, Forestry engineer >>>Forestry Faculty of Suceava >>>Str. Universitatii no. 13, Suceava, 720229, Romania >>>office phone +4 0230 52 29 78, ext. 531 >>>mobile phone +4 0745 53 18 01 >>> +4 0766 71 76 58 >>>FAX: +4 0230 52 16 64 >>>silvic.usv.ro >>> >> >> >>-- >> >>--- >>Catalin-Constantin ROIBU >>Lecturer PhD, Forestry engineer >>Forestry Faculty of Suceava >>Str. Universitatii no. 13, Suceava, 720229, Romania >>office phone +4 0230 52 29 78, ext. 531 >>mobile phone +4 0745 53 18 01 >> +4 0766 71 76 58 >>FAX: +4 0230 52 16 64 >>silvic.usv.ro >> > > > >-- > >--- >Catalin-Constantin ROIBU >Lecturer PhD, Forestry engineer >Forestry Faculty of Suceava >Str. Universitatii no. 13, Suceava, 720229, Romania >office phone +4 0230 52 29 78, ext. 531 >mobile phone +4 0745 53 18 01 > +4 0766 71 76 58 >FAX: +4 0230 52 16 64 >silvic.usv.ro -- --- Catalin-Constantin ROIBU Lecturer PhD, Forestry engineer Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext. 531 mobile phone +4 0745 53 18 01 +4 0766 71 76 58 FAX: +4 0230 52 16 64 silvic.usv.ro ______________________________________________ R-help@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.