Here's some useful functions learned from the video lectures:
tolower(): change character to lower case
sub(): subtitute out certain characters
grep(), grepl() (return logical value)
stringr package: nchar(), substr(), str_trim() (remove extra space)
Principles: name of variables should avoid dots; variables with character values should be made into factor and be descriptive.
Metacharacter:
^ beginning of a line
$ end of a line
[] upper/lower case (e.g. [Bb]
[-] a range of letters and numbers (regardless of order)
^ in [] will indicate NOT in the indicated class.
沒有留言:
張貼留言