Methods for writing data to Excel sheet
xl.write(r.obj, xl.rng, na = "", ...)# S3 method for current.graphics
xl.write(r.obj, xl.rng, na = "", delete.file = FALSE, ...)
# S3 method for list
xl.write(r.obj, xl.rng, na = "", ...)
# S3 method for matrix
xl.write(r.obj, xl.rng, na = "", row.names = TRUE, col.names = TRUE, ...)
# S3 method for data.frame
xl.write(r.obj, xl.rng, na = "", row.names = TRUE, col.names = TRUE, ...)
# S3 method for default
xl.write(r.obj, xl.rng, na = "", row.names = TRUE, ...)
R object
An object of class COMIDispatch
(as used in RDCOMClient
package) - reference to Excel range
character. NA representation in Excel. By default it is empty string
arguments for further processing
a logical value indicating whether delete file with graphics after insertion in Excel
a logical value indicating whether the row names/vector names of r.obj should to be written along with r.obj
a logical value indicating whether the column names of r.obj should to be written along with r.obj
c(rows,columns) Invisibly returns rows and columns number ocuppied by
r.obj
on Excel sheet.
xl.rng
should be COM-reference to Excel range, not string. Method
invisibly returns number of columns and rows occupied by r.obj
on
Excel sheet. It's useful for multiple objects writing to prevent their
overlapping. It is more convenient to use xl
object. xl.write
aimed mostly for programming purposes, not for interactive usage.
xl
,
xlr
, xlc
, xlrc
,
current.graphics
# NOT RUN { xls = xl.get.excel() xl.workbook.add() rng = xls[["Activesheet"]]$Cells(1,1) nxt = xl.write(iris,rng,row.names = TRUE,col.names = TRUE) rng = rng$Offset(nxt[1] + 1,0) nxt = xl.write(cars,rng,row.names = TRUE,col.names = TRUE) rng = rng$Offset(nxt[1] + 1,0) nxt = xl.write(as.data.frame(Titanic),rng,row.names = TRUE,col.names = TRUE) data(iris) data(cars) data(Titanic) xl.sheet.add() rng = xls[["Activesheet"]]$Cells(1,1) data.sets = list("Iris dataset",iris, "Cars dataset",cars, "Titanic dataset",as.data.frame(Titanic)) xl.write(data.sets,rng,row.names = TRUE,col.names = TRUE) # }
Run the code above in your browser using DataCamp Workspace