How to change the value of a variable?

Asked

Viewed 75 times

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.

2 answers

3

If the numeric variable calls x, do

x <- as.character(x)

1

Iago, all right?

R does not require variable declaration, so you just need to directly assign the desired Character value. Test there:

x <- 0
class(x)

x <- "Hello world"
class(x)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.