Lab 3E
Directions: Follow along with the slides and answer the questions in red font in your journal.
Lab 3F
.https://labs.idsucla.org/extras/webdata/mountains.html
HTML
is the code that’s used to render every website you’ve ever visited.HTML
code used to create the first two rows of the web data.
HTML
different than the data tables we’re used to seeing in R
, for example, when we use the View() function?<TABLE>
, <TR>
, <TH>
, <TD>
mean? How does HTML
use these tags to display the table?<TABLE>
<TR>
<TH>peak</TH>
<TH>range</TH>
<TH>state</TH>
<TH>long</TH>
<TH>lat</TH>
<TH>elev_ft</TH>
<TH>elev_m</TH>
<TH>prominence_ft</TH>
<TH>prominence_m</TH>
<TH>rank</TH>
</TR>
<TR>
<TD>Denali (Mount McKinley)</TD>
<TD>Alaska Range</TD>
<TD>Alaska</TD>
<TD>-151.0063</TD>
<TD>63.0690</TD>
<TD>20236</TD>
<TD>6168</TD>
<TD>20174</TD>
<TD>6149</TD>
<TD>1</TD>
</TR>
</TABLE>
data_url
in R
.
R
scrape every web table available on the site:readHTMLTable()
scrapes every table that is on a particular web URL, we need to find out which table has the data we’re interested in.
wikipedia.org
often has articles with 3 or more tables.length()
function to find out how many tables of data were scraped in our set of tables
.which
argument to the readHTMLTable()
function.
readHTMLTable()
to re-scrape the data from the web but this time use the which
argument to scrape just the individual table.which
argument should be the integer denoting which table you want scraped.mtns
names()
and str()
functions on last time to make sure the variable names and types are correct.elev_ft
?state
has the most mountains in our data?