How to change the value of a variable?

1

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.

    
asked by anonymous 28.05.2018 / 21:15

2 answers

2

If the numeric variable calls x , do

x <- as.character(x)
    
28.05.2018 / 21:38
1

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)
    
04.06.2018 / 16:57