xl | R Documentation |
xl
, xlc
, xlr
, xlrc
objects are already defined in
the package. It doesn't need to create or init them. Just after attaching
package one can write something like this: xl[a1] = "Hello, world!"
and this text should appears in A1
cell on active sheet of active
Excel workbook. xl(*)n
family of functions creates new worksheet for
output. You can provide sheet name and position via
xl.sheet.name
/before
.
## S3 method for class 'xl'
x[str.rng, drop = !(has.rownames(x) | has.colnames(x)), na = "", ...]
## S3 method for class 'xl'
x[[str.rng, drop = !(has.rownames(x) | has.colnames(x)), na = "", ...]]
## S3 method for class 'xl'
x$str.rng
## S3 replacement method for class 'xl'
x[[str.rng, na = "", ...]] <- value
## S3 replacement method for class 'xl'
x$str.rng <- value
## S3 replacement method for class 'xl'
x[str.rng, na = "", ...] <- value
## S3 replacement method for class 'xln'
x[[str.rng, na = "", xl.sheet.name = NULL, before = NULL, ...]] <- value
## S3 replacement method for class 'xln'
x$str.rng <- value
## S3 replacement method for class 'xln'
x[str.rng, na = "", xl.sheet.name = NULL, before = NULL, ...] <- value
xl.selection(drop = TRUE, na = "", row.names = FALSE, col.names = FALSE, ...)
x |
One of |
str.rng |
character Excel range. For single bracket operations it can be without quotes in almost all cases. |
drop |
logical. If TRUE the result is coerced to the lowest possible dimension. By default dimensions will be dropped if there are no columns and rows names. |
na |
character. NA representation in Excel. By default it is empty string. |
... |
additional parameters. Not yet used. |
value |
suitable replacement value. It will be recycled to fill excel range only if it is object of length 1. In other cases size of excel range is ignored - all data will be placed in Excel sheet starting from top-left cell of submitted range. |
xl.sheet.name |
character. sheet name in active workbook (for |
before |
character/numeric. sheet name or sheet number in active
workbook before which new sheet will be added (for |
row.names |
logical value indicating whether the Excel range contains the row names as its first column. |
col.names |
logical value indicating whether the Excel range contains the column names as its first row. |
xl
object represents Microsoft Excel application. For
convenient interactive usage arguments can be given without quotes in most
cases (e. g. xl[a1] = 5
or xl[u2:u85] = "Hi"
or
xl[MyNamedRange] = 42
, but xl["Sheet1!A1"] = 42
). When it
used in your own functions or you need to use variable as argument it is
recommended apply double brackets notation: xl[["a1"]] = 5
or
xl[["u2:u85"]] = "Hi"
or xl[["MyNamedRange"]] = 42
.
Difference between xl
, xlc
, xlrc
and xlr
is
xl
ignore row and column names, xlc
suppose read and write to
Excel with column names, xlrc
- with column and row names and so on.
There is argument drop
which is TRUE
by default for xl
and FALSE
by default for other options. xl.selection
returns
data.frame with data from current selection in Excel.
All these functions never coerce characters to factors
Returns appropriate dataset from Excel.
cr
, xl.current.region
,
## Not run:
data(iris)
rownames(iris) = as.character(rownames(iris))
iris$Species = as.character(iris$Species)
xl.workbook.add()
xlrc$a1 = iris
xl.iris = xl.current.region("a1",row.names=TRUE,col.names=TRUE)
identical(xl.iris,iris)
xl.sheet.add("Datasets examples")
data.sets = list("Iris dataset",iris,"Cars dataset",cars,"Titanic dataset",as.data.frame(Titanic))
xlrc[a1] = data.sets
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.