Hi,
May be this helps:
dat1<- as.data.frame(matrix(1:30,6,5))
lapply(seq_len(ncol(dat1)),function(i) dat1[,i])
[[1]]
[1] 1 2 3 4 5 6
[[2]]
[1] 7 8 9 10 11 12
[[3]]
[1] 13 14 15 16 17 18
[[4]]
[1] 19 20 21 22 23 24
[[5]]
[1] 25 26 27 28 29 30
#from excel dataset (the same data)
library(XLConnect)
wb<- loadWorkbook("Test1New.xlsx")
res1<-lapply(LETTERS[1:5],function(x)
{unlist(readWorksheet(wb,sheet="Sheet1",region=paste0(paste0(x,1),":",paste0(x,7))),use.names=FALSE)})
res1
[[1]]
[1] 1 2 3 4 5 6
[[2]]
[1] 7 8 9 10 11 12
[[3]]
[1] 13 14 15 16 17 18
[[4]]
[1] 19 20 21 22 23 24
[[5]]
[1] 25 26 27 28 29 30
is.vector(res1[[1]])
#[1] TRUE
A.K.
- Original Message -
From: "Banks, Mary,M.D."
To: "'smartpink...@yahoo.com'"
Cc:
Sent: Monday, August 26, 2013 1:37 PM
Subject: RE: Pasting excell spreedsheet into notepad for R
I have a set of 6 columns. I want to read each column as a vector in R.
-Original Message-
From: smartpink...@yahoo.com [mailto:smartpink...@yahoo.com]
Sent: Monday, August 26, 2013 1:21 PM
To: Banks, Mary,M.D.
Subject: Pasting excell spreedsheet into notepad for R
Hi,
The question is not very clear especially the vector part.. Do you want to
read only one column as a vector?
Please provide a reproducible example.
Tx.
Hi all,
Does anyone know how to export an excell spreedsheet into notepad in R
format as a linear vector as opposed to columns? I.e. 2,3,4,5,6,7 etc.
Thanks,
Mary
Quoted from:
http://r.789695.n4.nabble.com/Pasting-excell-spreedsheet-into-notepad-for-R-tp4674568.html
_
Sent from http://r.789695.n4.nabble.com
The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.
__
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.