Description Usage Arguments Details Value Examples
data.frame.rc
creates a data.frame
using the [R,C] format like 'matrix' (arguments: 'nrow', 'ncol').
1 2 | data.frame.rc(values, nrow, ncol = length(values),
column_names = names(values))
|
values |
Type: list or vector to repeat. The values inside the data.frame. |
nrow |
Type: numeric. The number of rows in the data.frame to create. |
ncol |
Type: numeric. The number of columns in the data.frame to create. Defaults to |
column_names |
Type: character. The names of the columns in the data.frame to create. Defaults to |
Please see vignette for demos: vignette("data.frame.rc", package = "Laurae2")
or help_me("data.frame.rc")
.
A data.frame with [nrow, ncol] strucure specified, along with column names (defaults to V1, V2, V3...
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | # Create default named [5, 5] data.frame
data.frame.rc(0, nrow = 5, ncol = 5)
# Create named [5, 5] data.frame
data.frame.rc(0, nrow = 5, ncol = 5,
column_names = c("car", "minicooper", "truck", "porsche", "speedo"))
# Create named [5, 5] data.frame with values
data.frame.rc(list(1:5,
c(TRUE, FALSE, TRUE, FALSE, TRUE),
5:1,
c("has", "not", "has", "not", "has"),
c(150L, 200L, 250L, 300L, 350L)),
nrow = 5, ncol = 5)
# Create named [5, 5] data.frame with named values
data.frame.rc(list(1:5,
c(TRUE, FALSE, TRUE, FALSE, TRUE),
5:1,
c("has", "not", "has", "not", "has"),
c(150L, 200L, 250L, 300L, 350L)),
nrow = 5, ncol = 5,
column_names = c("car", "minicooper", "truck", "porsche", "speedo"))
# Create named [5, 5] data.frame with values
data.frame.rc(list(car = 1:5,
minicooper = c(TRUE, FALSE, TRUE, FALSE, TRUE),
truck = 5:1,
porsche = c("has", "not", "has", "not", "has"),
speedo = c(150L, 200L, 250L, 300L, 350L)),
nrow = 5, ncol = 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.