I am trying to use the R package xlsx to load a file available at this URL:
http://www.plosgenetics.org/article/fetchSingleRepresentation.action?uri=info:doi/10.1371/journal.pgen.1002236.s019
library(xlsx)
filename="/home/avilella/00x/mobile.element.insertions.1000g.journal.pgen.1002236.s019.xlsx"
system(paste("ls -l",filename))
-rw-rw-r-- 1 avilella avilella 2372143 2011-12-11 16:36 /home/avilella/00x/mobile.element.insertions.1000g.journal.pgen.1002236.s019.xlsx
Once downloaded, I try to load it in R using read.xlsx or read.xlsx2:
file <- system.file("mobile.element.insertions.1000g", filename, package = "xlsx")
res <- read.xlsx2(file, 1) # read first sheet
But I get an error:
Error in
.jnew("java/io/FileInputStream", file):
java.io.FileNotFoundException: (No such file or directory)
Any ideas?
1) xlsx package. Try using
file.choosewhich will allow you to interactively navigate to the file and thereby eliminate the possibility of misidentifying it:2) gdata package. If the above still does not work then you might try
read.xlsin gdata. It uses a perl program rather than java. It can read bothxlsandxlsxfiles and can read data right off the net (downloading it into a temporary file and reading it from there in a manner that is transparent to the user):?read.xlsin gdata has more info.