I am using R studio 1a Please read all the text in httpwwwun
I am using R studio
1.(a)
Please read all the text in http://www.unomaha.edu/mahbubulmajumder/index.html and store
your texts in
myText
. Show rst few rows of
myText
and examine the structure of the data.
(b)
Now write a regular expression that would extract all the emails from
myText
. Include your codes
and display the results that show only the email addresses and nothing else.
(c)
Now we want to extract all the phone/fax numbers in
myText
. Write a regular expression that
would do this. Demonstrate your codes showing the results.
(d)
The link of ggplot2 documentation is http://docs.ggplot2.org/current/ and we would like to get
the list of ggplot2 geoms from there. Write a regular expression that would extract all the geoms
names (geom
bar is one of them) from this link and display the unique geoms. How many unique
geoms does it have
Solution
readLines(con=\"http://www.unomaha.edu/mahbubulmajumder/index.html\")
[1] \"<!DOCTYPE html>\"
[2] \"<head>\"
[3] \"<link rel=\\\"stylesheet\\\" href=\\\"script/style.css\\\">\"
[4] \"<link href=\\\"http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css\\\" rel=\\\"stylesheet\\\">\"
[5] \"\"
[6] \"<title>Mahbubul Majumder</title>\"
[7] \"</head>\"
[8] \"<body>\"
[9] \"<div id=\\\"navbar\\\"> \"
[10] \"<h1> Mahbubul Majumder\'s Site </h1>\"
[11] \"</div>\"
[12] \"<div id=\\\"wrap\\\", class=\\\"wrapper\\\">\"
[13] \"<header>\"
[14] \"<img src=\\\"images/UNO-lockup-color-dark-backgrd.png\\\"/>\"
[15] \"<p>Mathematics</p>\"
[16] \"<ul class=\\\"header\\\">\"
[17] \"<li><a href=\\\"index.html\\\">Home</a></li>\"
[18] \"<li><a href=\\\"html/publication.html\\\">Publications</li>\"
[19] \"<li><a href=\\\"html/teaching.html\\\">Teaching</li>\"
Answer is longer this is not include

