[R] Convert to a vector to read.table output format

കുഞ്ഞായി kunjaai dileepkunjaai at gmail.com
Sun May 17 13:28:13 CEST 2015


Thank you all for your time......


Thank you.... Now its working.... :))


Cheers .....



On Sun, May 17, 2015 at 4:34 AM, Jim Lemon <drjimlemon at gmail.com> wrote:

> Hi കുഞ്ഞായി,
> It looks like you want write.table.
>
> # as Rui Suggested
> names(index_data) <- paste0("V", 1:length(index_data))
> write.table(index.table,"index_table_file.txt",row.names=FALSE)
>
> Jim
>
>
> On Sun, May 17, 2015 at 4:33 AM, Rui Barradas <ruipbarradas at sapo.pt>
> wrote:
> > Hello,
> >
> > I'm not exactly sure of what you want.
> > 1) If you just want that output, just set the names attribute  of
> > index_data.
> >
> > names(index_data) <- paste0("V", 1:length(index_data))
> >
> > 2) If you want to create a data.frame from index_data try the following.
> >
> > dat <- data.frame(index_data[1])
> > for(i in 2:length(index_data))
> >         dat <-cbind(dat, index_data[i])
> > names(dat) <- paste0("V", 1:length(index_data))
> > dat
> >
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> >
> > Em 16-05-2015 18:12, കുഞ്ഞായി kunjaai escreveu:
> >>
> >> Dear all,
> >>
> >>   I want to convert a variable (that variable obtained from an 'nc '
> file)
> >> I
> >> want to convert  it into a* read.table* output format
> >>
> >> Example:
> >>
> >>> index_data<-get.var.ncdf(f_hist ,"meant_iitm_ALLIN_YEAR")
> >>> index_data
> >>
> >>   [1] 24.06333 24.07208 24.20208 24.12625 24.27333 24.42458 24.26583
> >>   [8] 24.30042 24.49750
> >>
> >>
> >> I want to convert it in to
> >>
> >>
> >>>    V1           V2         V3          V4              V5
> >>
> >> V6          V7          V8
> >> 24.06333  24.07208  24.20208 24.12625  24.27333 24.42458 24.26583
> 24.30042
> >>      V9
> >> 24.49750
> >>
> >>
> >> Thank you all in advance......
> >> --
> >> DILEEPKUMAR. R
> >> J R F, IIT DELHI
> >>
> >>         [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> 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.
> >>
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>



-- 
DILEEPKUMAR. R
J R F, IIT DELHI

	[[alternative HTML version deleted]]



More information about the R-help mailing list