How to read CSV from web?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to read CSV from web?

ryguy7272
This post has NOT been accepted by the mailing list yet.
I am trying to read the date from this web-based CSV.

https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv


I tried the following two sample scripts:

df <- read.table("https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv", header = TRUE, sep = ",")


library("ff")
df <- read.csv.ffdf(file="https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv", header=TRUE, VERBOSE=TRUE, first.rows=10000, next.rows=50000)


I got those ideas from this site.
https://en.wikibooks.org/wiki/R_Programming/Importing_and_exporting_data


Anyway, how can I import the data into a dataframe?  I think that's what it's called.  I've been using R on and off, mostly off, for a while.  I don't use it much; never for work and only for fun.  Anyway, I'm trying to learn it better.  
Reply | Threaded
Open this post in threaded view
|

Re: How to read CSV from web?

jpara3
data<-read.csv("https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv",header=T,sep=",")
Guided Tours Basque Country Guided tours in the three capitals of the Basque Country: Bilbao, Vitoria-Gasteiz and San Sebastian, as well as in their provinces. Available languages. Travel planners for groups and design of tourist routes across the Basque Country.
Reply | Threaded
Open this post in threaded view
|

Re: How to read CSV from web?

ryguy7272
How about this?


library(XML)
library(RCurl)

url <-
"https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv"

urldata <- getURL(url)
data <- readHTMLTable(urldata, stringsAsFactors = FALSE)







On Wednesday, July 29, 2015 at 6:41:35 AM UTC-4, jpara3 wrote:

>
> data<-read.csv("
> https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv",header=T,sep=",")
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-read-CSV-from-web-tp4710502p4710513.html 
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] <javascript:> mailing list -- To UNSUBSCRIBE and
> more, see
> https://stat.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code.
>
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: How to read CSV from web?

ryguy7272
In reply to this post by jpara3
Also, you should bookmark this link.

http://www.r-bloggers.com/this-r-data-import-tutorial-is-everything-you-need/




On Wednesday, July 29, 2015 at 6:41:35 AM UTC-4, jpara3 wrote:

>
> data<-read.csv("
> https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv",header=T,sep=",")
>
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-read-CSV-from-web-tp4710502p4710513.html 
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] <javascript:> mailing list -- To UNSUBSCRIBE and
> more, see
> https://stat.ethz.ch/mailman/listinfo/r-help 
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code.
>
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: How to read CSV from web?

Gabor Grothendieck
In reply to this post by jpara3
Your read.csv call works for me under Windows on "R version 3.2.2 Patched
(2015-08-25 r69180)"  but not on "R version 3.1.3 Patched (2015-03-16
r68169)".

Suggest you upgrade your R installation and try again.

If you are on Windowsw and don't want to upgrade right now an alternative
is to issue this command first: setInternet2()

Also note that header = TRUE and sep = "," are the defaults for read.csv so
those arguments can be optionally omitted.



On Wed, Jul 29, 2015 at 6:37 AM, jpara3 <[hidden email]>
wrote:

> data<-read.csv("
> https://raw.githubusercontent.com/sjkiss/Survey/master/mlogit.out.csv
> ",header=T,sep=",")
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/How-to-read-CSV-from-web-tp4710502p4710513.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.