[R] How to read Excel file and access the data item?

Petr Pikal petr.pikal at precheza.cz
Thu Mar 4 08:35:38 CET 2004


Hi

On 3 Mar 2004 at 11:25, Grace Conlon wrote:

> In R, How to read Excel file and access the data item?
> Thank you.

Quite strightforward way is to copy your data to notepad, save to 
a txt file and read this txt file to r by appropriate read.table() 
command.

Or you can use coppying through clipboard (with some 
restrictions) by this function.

readClip<- function(n=3, header=T)
{

vstup<-readClipboard()


if (header) {
jmena<-vstup[1]
vstup<-vstup[-1]
jmena<-as.character(unlist(strsplit(jmena,split="[[:space:]]")))

}

vystup<-
data.frame(matrix(as.numeric(unlist(strsplit(vstup,split="[[:space:]
]"))),length(vstup),n,byrow=T))

if (header) names(vystup)<-jmena

vystup

}

where n is number of columns you want to copy.






> 
> 
> ---------------------------------
> 
>  [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
petr.pikal at precheza.cz




More information about the R-help mailing list