In this tutorial you will learn about the R Strings and its application with practical example.
R Strings
String is a series or sequence of characters – letters, numbers, and special characters. In R, strings can either be declared using double quotes “Hello World” or single quote ‘Hello World’, internally all string values stored in double quotes, even it is created with single quote.
Example:-
1 2 3 4 5 6 7 8 |
a <- 'String created with single quotes' print(a) b <- "String created with double quotes" print(b) c <- "String with ' single quote between double quotes" print(c) d <- 'String with " Double quotes between single quote' print(d) |
Output:-
1 2 3 4 |
[1] "String created with single quotes" [1] "String created with double quotes" [1] "String with ' single quote between double quote" [1] "String with \" Double quote between single quote" |