Cted blank characters ie space or tab

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: possible,
possible
+
2)
 [1]
"Sli"
"St
"
 >
substring(string,
possible,
possible
+
2)
==
"St
"
 [1]
FALSE

TRUE
 What
are
we
doing
here?
 •  •  •  •  Look
at
each
character
 Check
to
see
if
it
is
“S”
 If
it
is,
then
look
at
the
next
character(s)
 This
is
the
idea
behind
regular
expressions
 7
 10/18/12
 Luckily,
we
don t
actually
need
to
write
our
own
 func0ons
for
replacement.

The
R
func0ons
gsub() and
sub()
look
for
a
paNern
and
replace
it
within
a
 string
with
some
other
text.
 The
regular
expression
 St
 
is
made
up
of
three
literal
 characters.

The
regular
expression
matching
engine
 does
something
very
similar
to
what
we
just
did.
 The
 g 
in
gsub()
refers
to
global.

It
changes
all
 the
matches,
whereas
sub()
only
replaces
the
first
 match
(in
each
element
–
both
gsub()

and
sub
are
 vectorized).
 The Slipp...
View Full Document

Ask a homework question - tutors are online