# Can anyone suggest why this works datafilename <- "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" person.data <- read.table(datafilename,header=TRUE) # but this does not? dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" treedata <- read.table(dd, header=TRUE) ================================================================== Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : unsupported URL scheme # I can access both through a hyperlink in OOO Calc. t # Thanks
The only difference I see is the http vs https, perhaps you require a sort of auth to access that file. On 6 January 2011 19:53, John Kane <jrkrideau@yahoo.ca> wrote:> # Can anyone suggest why this works > > datafilename <- " > http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" > person.data <- read.table(datafilename,header=TRUE) > > # but this does not? > > dd <- " > https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" > treedata <- read.table(dd, header=TRUE) > > ==================================================================> > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : unsupported URL scheme > > # I can access both through a hyperlink in OOO Calc. t > # Thanks > > ______________________________________________ > R-help@r-project.org mailing list > 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. >[[alternative HTML version deleted]]
I don't know. I can access it from within OOo Calc so it might be an authority problem but it seems unlikely or would Google sites have some strange restrictions ? I did discover that the trees.txt file was rather messed up so I tried again with a clean csv file and I'm still getting the same results. It currently is not all that important but it's definately annoying. --- On Thu, 1/6/11, Alberto Negron <albertonegron@gmail.com> wrote: From: Alberto Negron <albertonegron@gmail.com> Subject: Re: [R] Accessing data via url To: "John Kane" <jrkrideau@yahoo.ca> Cc: "R R-help" <r-help@stat.math.ethz.ch> Received: Thursday, January 6, 2011, 3:38 PM The only difference I see is the http vs https, perhaps you require a sort of auth to access that file. On 6 January 2011 19:53, John Kane <jrkrideau@yahoo.ca> wrote: # Can anyone suggest why this works datafilename <- "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" person.data <- read.table(datafilename,header=TRUE) # but this does not? dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" treedata <- read.table(dd, header=TRUE) ================================================================== Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : unsupported URL scheme # I can access both through a hyperlink in OOO Calc. t # Thanks ______________________________________________ R-help@r-project.org mailing list 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. [[alternative HTML version deleted]]
https your second link is an https that's not supported as I recall. ?url On Thu, Jan 6, 2011 at 11:53 AM, John Kane <jrkrideau@yahoo.ca> wrote:> # Can anyone suggest why this works > > datafilename <- " > http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" > person.data <- read.table(datafilename,header=TRUE) > > # but this does not? > > dd <- " > https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" > treedata <- read.table(dd, header=TRUE) > > ==================================================================> > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : unsupported URL scheme > > # I can access both through a hyperlink in OOO Calc. t > # Thanks > > ______________________________________________ > R-help@r-project.org mailing list > 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. >[[alternative HTML version deleted]]
Here John, from the manual URLs A note on file:// URLs. The most general form (from RFC1738) is file://host/path/to/file, but R only accepts the form with an empty host field referring to the local machine. This is then file:///path/to/file, where path/to/file is relative to ‘/’. So although the third slash is strictly part of the specification not part of the path, this can be regarded as a way to specify the file ‘/path/to/file’. It is not possible to specify a relative path using a file URL. No attempt is made to decode an encoded URL: call URLdecode if necessary. Note that https:// connections are not supported. So, when you use a https Url as opposed to a http url the former is not supported. You might try RCurl package getURL() which has support for HTTPS, provided your libcurl has support for SSL ( as I recall) On Thu, Jan 6, 2011 at 11:53 AM, John Kane <jrkrideau@yahoo.ca> wrote:> # Can anyone suggest why this works > > datafilename <- " > http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" > person.data <- read.table(datafilename,header=TRUE) > > # but this does not? > > dd <- " > https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" > treedata <- read.table(dd, header=TRUE) > > ==================================================================> > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : unsupported URL scheme > > # I can access both through a hyperlink in OOO Calc. t > # Thanks > > ______________________________________________ > R-help@r-project.org mailing list > 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. >[[alternative HTML version deleted]]
?read.table says ?file? can also be a complete URL. This is implemented by url(): see the section on URLs on its help page. You haven't followed the posting guide and told us your OS, and what the section says does depend on the OS. On Thu, 6 Jan 2011, John Kane wrote:> # Can anyone suggest why this works > > datafilename <- "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" > person.data <- read.table(datafilename,header=TRUE) > > # but this does not? > > dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" > treedata <- read.table(dd, header=TRUE) > > ==================================================================> > Error in file(file, "rt") : cannot open the connection > In addition: Warning message: > In file(file, "rt") : unsupported URL scheme > > # I can access both through a hyperlink in OOO Calc. t > # Thanks-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
John Kane-2 wrote:> > # Can anyone suggest why this works > > datafilename <- > "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" > person.data <- read.table(datafilename,header=TRUE) > > # but this does not? > > dd <- > "https://sites.google.com/site/jrkrideau/home/general-stores/trees.txt" > treedata <- read.table(dd, header=TRUE) > > ==================================================================> > Error in file(file, "rt") : cannot open the connection >Your original file is no longer there, but when I try RCurl with a png file that is present, I get a certificate error: Dieter -------- library(RCurl) sessionInfo() dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/history.png" x = getBinaryURL(dd) -------------> sessionInfo()R version 2.12.1 (2010-12-16) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C [5] LC_TIME=German_Germany.1252 attached base packages: [1] stats graphics grDevices datasets utils methods base other attached packages: [1] RCurl_1.5-0.1 bitops_1.0-4.1 loaded via a namespace (and not attached): [1] tools_2.12.1> dd <- > "https://sites.google.com/site/jrkrideau/home/general-stores/history.png"> x = getBinaryURL(dd)Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) : SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- View this message in context: http://r.789695.n4.nabble.com/Accessing-data-via-url-tp3178094p3178773.html Sent from the R help mailing list archive at Nabble.com.
--- On Fri, 1/7/11, Dieter Menne <dieter.menne at menne-biomed.de> wrote:> From: Dieter Menne <dieter.menne at menne-biomed.de>> Your original file is no longer there, but when I try RCurl > with a png file > that is present, I get a certificate error: > > DieterSince replaced with dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/duplicates.csv" library(RCurl) dd <- "https://sites.google.com/site/jrkrideau/home/general-stores/duplicates.csv" x = getBinaryURL(dd, ssl.verifypeer = FALSE) seems to be downloading a binary file. Thanks
hi I think this already a closed topic since you figure it out yourself. but you can always try to fetch data from Google docs (first make the spreadsheet public) and then writing this snippet: library(RCurl) u="https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0As6HUAxhy0Q7dDB0bjh4T2RyS3pIQkdXdGc2U0ZZc3c&single=true&gid=0&output=csv" content = getBinaryURL(u, ssl.verifypeer = FALSE) tmp = tempfile() write(rawToChar(content), file = tmp) mydata<- read.csv(gzfile(tmp)) mydata it works for me and hopefully it'll work nor newbies like me too :) -- View this message in context: http://r.789695.n4.nabble.com/Accessing-data-via-url-tp3178094p3853451.html Sent from the R help mailing list archive at Nabble.com.