Slide 5
Slide 5 text
5
Text
Manipula=on
> args(grep)!
> function (pattern, x, ignore.case = FALSE, perl = FALSE, value = FALSE,!
fixed = FALSE, useBytes = FALSE, invert = FALSE) !
> grep('N.t', c('Mark', 'Nathan','Jo','Natasha', 'Dave'))!
> [1] 2 4!
grep()
:
searches
for
a
specified
substring
paJern
in
a
vector
x
of
strings
> args(nchar)!
> function (x, type = "chars", allowNA = FALSE)!
> nchar('package')!
> [1] 7!
nchar()
:
length
of
string
x
> args(gsub)!
> function (pattern, replacement, x, ignore.case = FALSE, perl = FALSE, !
fixed = FALSE, useBytes = FALSE)!
> gsub("rt ", "", 'please rt asap')!
> [1] "please asap"!
gsub()
:
perform
replacement
of
the
first
and
all
matches