Strings Flashcards Preview

R > Strings > Flashcards

Flashcards in Strings Deck (12)
Loading flashcards...
1

paste(...)

concatenate vectors after converting to character; sep= is the string to separate terms (a single space is the default); collapse= is an optional string to separate “collapsed” results

2

substr(x,start,stop)

substrings in a character vector; can also as- sign, as substr(x, start, stop) <- value

3

strsplit(x,split)

split x according to the substring split

4

grep(pattern,x)

searches for matches to pattern within x; see ?regex

5

gsub(pattern,replacement,x)

replacement of matches determined
by regular expression matching sub() is the same but only replaces
the first occurrence.

6

tolower(x)

convert to lowercase

7

toupper(x)

convert to uppercase

8

match(x,table)

a vector of the positions of first matches for the elements
of x among table

9

x %in% table

id. but returns a logical vector

10

pmatch(x,table)

partial matches for the elements of x among table

11

nchar(x)

number of characters

12