
Last chance! 50% off unlimited learning
Sale ends in
xl.read.file(filename, header = TRUE, row.names = NULL, col.names = NULL, xl.sheet = NULL, top.left.cell = "A1", na = "", password = NULL, excel.visible = FALSE)
xl.save.file(r.obj, filename, row.names = TRUE, col.names = TRUE, xl.sheet = NULL, top.left.cell = "A1", na = "", password = NULL, excel.visible = FALSE)
xl.read.file
always returns data.frame. xl.save.file
invisibly returns NULL.
xl.read.file
reads only rectangular data set. It is highly
recommended to have all column names and ids in data set. Orphaned
rows/columns located apart from the main data will be ignored.
xl.save.file
can save all objects for which xl.write
method exists -
see examples.
xl.write
, xl.workbook.save
,
xl.workbook.open
, current.graphics
## Not run:
# data(iris)
# xl.save.file(iris,"iris.xlsx")
# xl.iris = xl.read.file("iris.xlsx")
# all(iris == xl.iris) # Shoud be TRUE
# unlink("iris.xlsx")
#
# # Save to file list with different data types
# dists = dist(iris[,1:4])
# clusters = hclust(dists,method="ward.D")
# iris$clusters = cutree(clusters,3)
# png("1.png")
# plot(clusters)
# dev.off()
# pl.clus = current.graphics(filename="1.png")
# cross = table(iris$Species,iris$clusters)
# png("2.png")
# plot(cross)
# dev.off()
# pl.cross = current.graphics(filename="2.png")
# output = list("Iris",pl.clus,cross,pl.cross,"Data:","",iris)
# xl.save.file(output,"output.xls")
# xl.workbook.open("output.xls")
# # xl.workbook.close() # close workbook
# # unlink("output.xls") # delete file
#
# # password-protected file
# data(iris)
# xl.save.file(iris,"iris.xlsx", password = "pass")
# xl.iris = xl.read.file("iris.xlsx", password = "pass")
# all(iris == xl.iris) # Shoud be TRUE
# unlink("iris.xlsx")
#
# ## End(Not run)
Run the code above in your browser using DataLab