lecture_07

lecture_07 - BIOS 735: Statistical Computing Michael Wu...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
BIOS 735: Statistical Computing Michael Wu Lecture 7: More Text Processing, Intro to Regular Expressions, File I/O September 13, 2011 Michael Wu (Lecture 7) BIOS 735 September 13, 2011 1 / 16
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Administrative Details Homework 1 is out and has been updated (both the problem statement and the sample data set for problem 4) Handing in homework: I Please e-mail your homework to Baiming Zou [email protected] (DO NOT CC THE INSTRUCTOR) F E-mails should originate from valid UNC account F E-mail subject should read BIOS735 Homework 1 <Name> F Example: BIOS735 Homework 1 MikeWu I The functions for each problem should be in a separate text file F the file name for each problem should be: <Name>-problem * .txt F Example: MikeWu-problem1.txt or MikeWu-problem4.txt etc I No late homework, please address questions to the grader or instructor well before the due date. I In your e-mail, the body must contain the UNC honor statement: I have neither given nor received unauthorized assistance while preparing this assignment. I Please cite anybody you may have worked with in the body of your e-mail. I worked with Joe Blow and Bob Slob Michael Wu (Lecture 7) BIOS 735 September 13, 2011 2 / 16
Background image of page 2
String Manipulation: String Matching ( grep regexpr ) a = c("asdfA","asdfB", "12365)C", "asdfD","asdfqwerty") grep("df", a) grepl("df", a) regexpr("df", a) regexpr("d", a) gregexpr("a", a[1], ignore.case = T) Michael Wu (Lecture 7) BIOS 735 September 13, 2011 3 / 16
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
String Manipulation: Example Suppose for instance, we have text we wish to split into it’s consituent words. dat = readLines( "http://www.bios.unc.edu/˜mwu/bios735/Strings/abstract.txt")[[1]] strsplit(dat, " ") strsplit(dat, "asdf") strsplit(dat, "[asdf]") What’s going on? Regular expressions. strsplit(dat, "[[:punct:]]") strsplit(dat, "[ [:punct:]]") strsplit(dat, "[[:space:]]") strsplit(dat, "[[:space:][:punct:]]") strsplit(dat, ".") strsplit(dat, "[.]") Michael Wu (Lecture 7) BIOS 735 September 13, 2011 4 / 16
Background image of page 4
String Manipulation: Regular Expressions Regular expressions : description of a “codified method of SEARCHING”; R calls it a pattern that describes a set of strings. We will focus on “Extended Regular Expressions” which are the default in R.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/18/2011 for the course BIOS 735 taught by Professor Staff during the Spring '10 term at UNC.

Page1 / 16

lecture_07 - BIOS 735: Statistical Computing Michael Wu...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online