Strings Flashcards

1
Q

paste(…)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

substr(x,start,stop)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

strsplit(x,split)

A

split x according to the substring split

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

grep(pattern,x)

A

searches for matches to pattern within x; see ?regex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

gsub(pattern,replacement,x)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

tolower(x)

A

convert to lowercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

toupper(x)

A

convert to uppercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

match(x,table)

A

a vector of the positions of first matches for the elements

of x among table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

x %in% table

A

id. but returns a logical vector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

pmatch(x,table)

A

partial matches for the elements of x among table

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

nchar(x)

A

number of characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly