Chapter 20 Character Values
A chracter object is a string value
= as.character(842)
x= as.character("Davut")
yprint(x)
## [1] "842"
print(y)
## [1] "Davut"
class(x) # print class of x
## [1] "character"
class(y)
## [1] "character"
Concatenate two characters
="Davut"; lastname="Ayan"
firstnamepaste(firstname, lastname) # concatenate
## [1] "Davut Ayan"
Create a readable string
sprintf("%s has %d dollars", "Davut", 5000)
## [1] "Davut has 5000 dollars"
Extract a substring
substr("Davut is a crazy person", start=2, stop = 5)
## [1] "avut"
vectors