Question
How to convert data frame in R to a "character" data type?
The labeller function which I'm using for ggplot requires data of the type:
tempdat <- c(
"1" = "one",
"2" = "two"
)
If I use typeof(tempdat)
it gives an output saying that it is of type character
.
I have a data frame that looks like:
> tempdf
parent name
1 1 one
2 2 two
I want to convert my data frame tempdf
to the same data type as tempdat
. How do I do this?
2 51
2