How to Split R Code Over Multiple Lines in a Script (Example Code)
In this R tutorial you’ll learn how to write long code over several lines.
Example: How to Split a Character String Over Multiple Lines
string_one_line <- "my example string in R" # One line character string string_one_line # Returning character string # "my example string in R" |
string_one_line <- "my example string in R" # One line character string string_one_line # Returning character string # "my example string in R"
string_multiple_lines <- "my example string in R" # Multiple lines character string string_multiple_lines # Returning character string # "my \nexample \nstring \nin \nR" |
string_multiple_lines <- "my example string in R" # Multiple lines character string string_multiple_lines # Returning character string # "my \nexample \nstring \nin \nR"
cat(string_multiple_lines) # Returning character string using cat() # my # example # string # in # R |
cat(string_multiple_lines) # Returning character string using cat() # my # example # string # in # R