
Last chance! 50% off unlimited learning
Sale ends in
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 cr
[[(x, str.rng, drop = !(has.rownames(x) | has.colnames(x)), na = "", ...)
# S3 method for cr
[[(x, str.rng, na = "", ...) <- value
character Excel range. For single bracket operations it can be without quotes in almost all cases.
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.
character. NA representation in Excel. By default it is empty string.
logical value indicating whether the Excel range contains the row names as its first column.
logical value indicating whether the Excel range contains the column names as its first row.
additional parameters. Not yet used.
One of cr
, crc
, crr
, crrc
objects.
cr
- read/write with/without column and row names, "r" - with
rownames, "c" - with colnames
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.
Returns appropriate dataset from Excel.
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
# NOT RUN {
# }
# 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
# }
Run the code above in your browser using DataLab