I would like to know how to change the value of a variable. I have a numeric variable and would like to change it to a character.
I would like to know how to change the value of a variable. I have a numeric variable and would like to change it to a character.
If the numeric variable calls x
, do
x <- as.character(x)
Iago, how are you?
R does not require variable declaration, so you simply assign the desired character value directly. Take the test there:
x <- 0
class(x)
x <- "Hello world"
class(x)