xl.write: Methods for writing data to Excel sheet

Description Usage Arguments Details Value See Also Examples

View source: R/xl.write.R

Description

Methods for writing data to Excel sheet

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
xl.write(r.obj, xl.rng, na = "", ...)

## S3 method for class 'current.graphics'
xl.write(r.obj, xl.rng, na = "",
  delete.file = FALSE, ...)

## S3 method for class 'list'
xl.write(r.obj, xl.rng, na = "", ...)

## S3 method for class 'matrix'
xl.write(r.obj, xl.rng, na = "", row.names = TRUE,
  col.names = TRUE, ...)

## S3 method for class 'data.frame'
xl.write(r.obj, xl.rng, na = "", row.names = TRUE,
  col.names = TRUE, ...)

## Default S3 method:
xl.write(r.obj, xl.rng, na = "", row.names = TRUE, ...)

Arguments

r.obj

R object

xl.rng

An object of class COMIDispatch (as used in RDCOMClient package) - reference to Excel range

na

character. NA representation in Excel. By default it is empty string

...

arguments for further processing

delete.file

a logical value indicating whether delete file with graphics after insertion in Excel

row.names

a logical value indicating whether the row names/vector names of r.obj should to be written along with r.obj

col.names

a logical value indicating whether the column names of r.obj should to be written along with r.obj

Details

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.

Value

c(rows,columns) Invisibly returns rows and columns number ocuppied by r.obj on Excel sheet.

See Also

xl, xlr, xlc, xlrc, current.graphics

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## 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)


## End(Not run)

gdemin/excel.link documentation built on May 24, 2018, 9:31 p.m.