OneBite.Dev - Coding blog in a bite size

declare a string in R

Code snippet on how to declare a string in R

  str <- "Hello World!"

This code declares a string variable in R. The variable is named ‘str’ and its content is “Hello World!“. To declare the variable, the ’<-’ arrow operator is used. It assigns the string “Hello World!” to the variable ‘str’, so that it can be used in the code at later points. The quotation marks around the text ensure that the string is saved as one single value, rather than as separate words or characters. Once the variable has been declared, it can be used in other parts of the code in a variety of ways.

r