Lookateachcharacter checktoseeifitiss

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: por0on
of
characters
that
are
capitals
 
 One
example
 4
 10/18/12
 A
small
problem
 •  County
names
in
census
file
have
no
“.”
ater
 St,
e.g.
“St
John”
 •  County
names
in
geographic
file
do
have
the
 “.”,
e.g.
“St.
John”
 •  Let’s
find
a
way
to
update
the
county
names
in
 the
census
file
to
add
the
period
ater
“St”
 String
manipula0on
func0ons
 •  paste(x, y, z, …, sep = " ", collapse = NULL)
 –
paste
together
character
strings
separated
 by
one
blank
 •  tolower(x) toupper(x) ‐

convert
upper‐ case
characters
to
lower‐case,
or
vice
versa.
 Non‐alphabe0c
characters
are
let
unchanged
 String
manipula0on
func0ons
 –
extract
a
 por0on
of
a
character
s0ng
from
text,
 beginning
at
first,
ending
at
last
 •  
nchar(text) –
return
the
number
of
 characters
in
a
string
 •  strsplit(x, split) –
split
the
string
into
 pieces
using
split
to
divide
it

strsplit(x,
“”)
–
 splits
into
one
character
pieces
 •  substring(text, first, last) Test
Data
 > cNames [1]
"DewiN
County"






...
View Full Document

Ask a homework question - tutors are online