to_data_frame | R Documentation |
Given an object convert it to data.frame
.
to_data_frame(x, remove_na = FALSE)
x |
( |
remove_na |
( |
The following rules are applied when converting the object to matrix depending the object's type:
numeric
vector: It is converted to a one column data.frame
.
character
, logical
and factor
vectors: All of these are considered
to be categorical variables and therefore a coerced to factor
in a one
column data.frame
.
matrix
: If it is character
, logical
or factor
are included in the
same way as described for vectors and only coerced to data.frame
for
numeric
matrices.
For all the columns a name is assigned if they has no one.
A data.frame
.
## Not run:
to_data_frame(iris)
to_data_frame(1:10)
to_data_frame(c("a", "b", "c"))
to_data_frame(data.frame(a = c("a", "b"), b = c("c", "d")))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.