[R] Pasting excell spreedsheet into notepad for R

arun smartpink111 at yahoo.com
Mon Aug 26 20:27:12 CEST 2013


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." <MBANKS3 at PARTNERS.ORG>
To: "'smartpink111 at yahoo.com'" <smartpink111 at 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: smartpink111 at yahoo.com [mailto:smartpink111 at 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.

<quote author='Docbanks84'>
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
</quote>
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.




More information about the R-help mailing list