theurl <- "http://finance.yahoo.com"
tables <- readHTMLTable(theurl)
n.rows <- unlist(lapply(tables, function(t) dim(t)))
the picked table is the longest one on the page
lstRes <- tables[[which.max(n.rows)]]
data was not properly loaded, no delimiter specified in the load data infile command when we run.
need to fix this:
First truncate the table, then modify the load data infile command add Fields terminated by “,” in the loading command. Check and see the data load correctly, do the same for Hus_b, pus_a, pus_b;
back to OS to compare the lines in files
table rows are exactly one less than the lines in files for each, yeeeeeeeeeee.
Connecting to MySQL:
Once the RMySQL library is installed create a database connection object.
mydb = dbConnect(MySQL(), user=’user’, password=’password’, dbname=’database_name’, host=’host’)
Listing Tables and Fields:
Now that a connection has been made we list the tables and fields in the database we connected to.
This will return a list of the tables in our connection.