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)
"[["(x, str.rng, drop = !(has.rownames(x) | has.colnames(x)), na = "")
"[["(x, str.rng, na = "") <- value
cr
, crc
, crr
, crrc
objects.
cr
- read/write with/without column and row names, "r" - with
rownames, "c" - with colnamescr
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
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)
Run the code above in your browser using DataLab