[R] Convert to a vector to read.table output format
Rui Barradas
ruipbarradas at sapo.pt
Sat May 16 20:33:57 CEST 2015
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.
>
More information about the R-help
mailing list