View source: R/xl.current.region.R
xl.current.region | R Documentation |
Current region is a region that will be selected by pressing
Ctrl+Shift+*
in Excel. The current region is a range bounded by any
combination of blank rows and blank columns. cr
, crc
,
crr
, crrc
objects are already defined in the package. It
doesn't need to create or init them.
xl.current.region(
str.rng,
drop = TRUE,
na = "",
row.names = FALSE,
col.names = FALSE,
...
)
## S3 method for class 'cr'
x[[str.rng, drop = !(has.rownames(x) | has.colnames(x)), na = "", ...]]
## S3 replacement method for class 'cr'
x[[str.rng, na = "", ...]] <- value
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. |
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. |
... |
additional parameters. Not yet used. |
x |
One of |
value |
suitable replacement value. All data will be placed in Excel sheet starting from top-left cell of current region. Current region will be cleared before writing. |
cr
object represents Microsoft Excel application. For
convenient interactive usage arguments can be given without quotes in most
cases (e. g. cr[a1] = 5
or cr[u2:u85] = "Hi"
or
cr[MyNamedRange] = 42
, but cr["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: cr[["a1"]] = 5
or
cr[["u2:u85"]] = "Hi"
or cr[["MyNamedRange"]] = 42
.
Difference between cr
, crc
, crrc
and crr
is
cr
ignore row and column names, crc
suppose read and write to
Excel with column names, crrc
- with column and row names and so on.
There is argument drop
which is TRUE
by default for cr
and FALSE
by default for other options.
All these functions never coerce characters to factors
Returns appropriate dataset from Excel.
xl
## Not run:
data(iris)
data(mtcars)
xl.workbook.add()
xlc$a1 = iris
identical(crc[a1],xlc[a1:e151]) # should be TRUE
identical(crc$a1,xlc[a1:e151]) # should be TRUE
identical(crc$a1,xlc[a1]) # should be FALSE
# current region will be cleared before writing - no parts of iris dataset
crrc$a1 = mtcars
identical(crrc$a1,xlrc[a1:l33]) # should be TRUE
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.