Skip to content

Coverting HTML data into CSV

3 messages · El Polidan, Mark Sharp, Rui Barradas

#
Good evening,


I need to convert and HTML data file into a CSV file.


I managed to read the html files in R. Any pointers on how to convert  into a readable data frame or csv?


Thank you.


Sent from Outlook<http://aka.ms/weboutlook>
1 day later
#
An example of your data will be very helpful. Saying that you have contents of an HTML file is not sufficiently descriptive. Note that the instructions recommend commented, minimal, self-contained, reproducible code. In leu of the HTML data file and code used to read it, you can use dput() with its argument being the object containing the HTML data.

Mark
R. Mark Sharp, Ph.D.
msharp at TxBiomed.org
CONFIDENTIALITY NOTICE: This e-mail and any files and/or...{{dropped:10}}
#
Hello,

You could give us an example of what html you are trying to read.
Follow this example:

install.packages("XML")

library(XML)

url <- 
"http://www.databaseolympics.com/sport/sportevent.htm?enum=110&sp=ATH"
dat <- readHTMLTable(readLines(url), which=2, header=TRUE, 
stringsAsFactors = FALSE)
str(dat)


Hope this helps,

Rui Barradas

Em 19-01-2017 22:11, El Polidan escreveu: