issue in getting data with getGEO in R - r

I want to download the soft file of the GPL6480 platform in R.
I've used this command :
gset<-getGEO("GPL6480")
but I faced with this problem:
curl: (6) Could not resolve host: www.ncbi.nlm.nih.gov
File stored at:
/tmp/RtmpbHgZqQ/GPL6480.soft
Error in file(fname, "r") : cannot open the connection
In addition: Warning messages:
1: In download.file(myurl, destfile, mode = mode, quiet = TRUE, method = getOption("download.file.method.GEOquery")) :
download had nonzero exit status
2: In file(fname, "r") :
cannot open file '/tmp/RtmpbHgZqQ/GPL6480.soft': No such file or directory
I googled for this problem but I can't find the answer. acctauly i don't know that what is the problem exactly.you should know that my connection to net is ok.
I'm using R version 3.2.0 on Ubuntu 14.04.2 trusty
tnx mansoor

Related

How to fix Error cannot open connection on Ubuntu machine?

This might be a very trivial issue with R-related Ubuntu settings, but I'm pretty new to it and have no clue to solve this issue.
I'm trying to load a file from URL on a linux Ubuntu machine into R (R-Studio) with different strategies:
load(url("http://www.yaj.ch/data/test.rda"))
read.csv(url("http://www.yaj.ch/data/test.csv"))
readstata13::read.dta13("http://www.yaj.ch/data/test.dta")
data.table::fread("http://www.yaj.ch/data/test.csv")
but they all fail with similar error messages:
Error in load(url("http://www.yaj.ch/data/test.rda")) :
cannot open the connection to 'http://www.yaj.ch/data/test.rda'
In addition: Warning message:
In load(url("http://www.yaj.ch/data/test.rda")) :
cannot open URL 'http://www.yaj.ch/data/test.rda': HTTP status was '403 Forbidden'
that of fread is somewhat different:
trying URL 'http://www.yaj.ch/data/test.csv'
Error in download.file(input, tmpFile, method = method, mode = "wb", quiet =
!showProgress) :
cannot open URL 'http://www.yaj.ch/data/test.csv'
In addition: Warning message:
In download.file(input, tmpFile, method = method, mode = "wb", quiet =
!showProgress) :
cannot open URL 'http://www.yaj.ch/data/test.csv': HTTP status was '403 Forbidden'
This is what I got when I was mobile:
Error in load(url("http://www.yaj.ch/data/test.rda")) :
cannot open the connection to 'http://www.yaj.ch/data/test.rda'
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> load
Execution halted
When I Shift-click on the link in the script, the data opens in the browser, so the connection seems to be okay.
On my Windows machine everything works fine. So I guessed the issue is related to Ubuntu, as if R has connection problems or wrong access rights. But I'm not sure, since strangely enough e.g. this one opens in Ubuntu:
load(url("http://www.rdatamining.com/data/graph.rdata?attredirects=0&d=1"))
This solution wasn't helpful to me, and Google won't tell me anything either.
Is there any help?

R failure in package downloads using install_github() for REmap and other packages

I am using R studio 3.5.1 on windows 7 in China. I installed devtools and trying to install other packages like REmap, but I'm unable to download packages from GitHub.
I got the following errors:
library(devtools)
install_github('lchiffon/REmap')
Error in read.dcf(path) :
Found continuation line starting ' interactive map ...' at begin of record.
install_git("https://github.com/Lchiffon/REmap")
Downloading git repo https://github.com/Lchiffon/REmap
File C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file55385d2e4379 contains
invalid line(s)
%TSD-Header-###%o物浸变,MT橰
They were ignored
File C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file55381faa65e6 contains
invalid line(s)
%TSD-Header-###%p物浸变,MT橰
77w珰L懫
They were ignored
错误: 1:1: 意外的SPECIAL 1: %TSD-Header-###%
^ 停止执行 Error in processx::run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), : System command
error
I tried other packages as well.
devtools::install_github("dengfei2013/GS")
Downloading GitHub repo dengfei2013/GS#master
gzip: stdin: not in gzip format /Rtools/bin/tar: Child returned status
1 /Rtools/bin/tar: Error is not recoverable: exiting now External tar
failed with --force-local, trying without
gzip: stdin: not in gzip format /Rtools/bin/tar: Child returned status
1 /Rtools/bin/tar: Error is not recoverable: exiting now External tar
failed with --force-local, trying without Error: Does not appear to
be an R package (no DESCRIPTION) In addition: Warning messages: 1: In
utils::untar(tarfile, ...) : ‘tar.exe -zxf
"C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file553843c77145.tar.gz"
-C "C:/Users/heqi/AppData/Local/Temp/RtmpKsksur/remotes553857a6482"’ returned error code 2 2: In system(cmd, intern = TRUE) : running
command 'tar.exe -ztf
"C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file553843c77145.tar.gz"'
had status 2
I tried to change some of the options but the results are the same.
options(download.file.method = "wget")
options(unzip = "internal")
install_github('r-lib/remotes')
Downloading GitHub repo r-lib/remotes#master
gzip: stdin: not in gzip format /Rtools/bin/tar: Child returned status
1 /Rtools/bin/tar: Error is not recoverable: exiting now External tar
failed with --force-local, trying without
gzip: stdin: not in gzip format /Rtools/bin/tar: Child returned status
1 /Rtools/bin/tar: Error is not recoverable: exiting now External tar
failed with --force-local, trying without Error: Does not appear to
be an R package (no DESCRIPTION) In addition: Warning messages: 1: In
utils::untar(tarfile, ...) : ‘tar.exe -zxf
"C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file553845a824ac.tar.gz"
-C "C:/Users/heqi/AppData/Local/Temp/RtmpKsksur/remotes553845fa49b"’ returned error code 2 2: In system(cmd, intern = TRUE) : running
command 'tar.exe -ztf
"C:\Users\heqi\AppData\Local\Temp\RtmpKsksur\file553845a824ac.tar.gz"'
had status 2
>
I am trying to do a heat map analysis, but I can't use REmap, and I can't open google API maps...
> library(ggplot2)
> library(ggmap)
> map <- get_map(location = 'united states', zoom =4 ,maptype =
'terrain', source = 'google',color ='color')
Error in download.file(url, destfile = tmp, quiet = !messaging, mode = "wb") : cannot open URL 'http://maps.googleapis.com/maps/api/staticmap?center=united+states&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false'
In addition: Warning message: In download.file(url, destfile = tmp,
quiet = !messaging, mode = "wb") : URL
'http://maps.googleapis.com/maps/api/staticmap?center=united+states&zoom=4&size=640x640&scale=2&maptype=terrain&language=en-EN&sensor=false':
status was 'Failure when receiving data from the peer'
>
Other information
I am an intern at an online credit loan company, they are using encryptions to encrypt the files so that you can't open it unless you are using the company's computers. I don't know how they do it but I ran into a lot of problems when I am trying to learn R.
I remember that I ran into some file reading problems last time. Could this have anything to do with it?
I downloaded the zip file from GitHub
> install.packages("C:/Users/heqi/Desktop/REmap-master.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/heqi/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
> library(`REmap-master`)
Error in library(`REmap-master`) : 不存在叫‘REmap-master’这个名字的程辑包
> library(`REmap`)
Error in library(REmap) : 不存在叫‘REmap’这个名字的程辑包
> install.packages("C:/Users/heqi/Desktop/baidumap-master.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/heqi/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
> library(`baidumap`)
baidumap 0.2.2
Apply an application from here: http://lbsyun.baidu.com/apiconsole/key
Then register you key by running `options(baidumap.key = 'xxx')`
> options(baidumap.key = 'qKBOY2C0s678Dl33wxrTYnbMn9KZCRu5')
> baidumap::getBaiduMap(location = "上海")
trying URL 'http://api.map.baidu.com/staticimage?width=400&height=400&center=NA,NA&zoom=10&scale=2'
Content type 'image/png' length 154 bytes
downloaded 154 bytes
Map from URL : http://api.map.baidu.com/staticimage?width=400&height=400&center=NA,NA&zoom=10&scale=2
Error in data.frame(ll.lat = ll[1], ll.lon = ll[2], ur.lat = ur[1], ur.lon = ur[2]) :
arguments imply differing number of rows: 0, 1
In addition: Warning messages:
1: In trans(result) : NAs introduced by coercion
2: In trans(result) : NAs introduced by coercion
I also tried GitHubinstall,It's all the same
> library("githubinstall", lib.loc="~/R/win-library/3.5")
> githubinstall::gh_install_packages('REmap')
Suggestion:
- Lchiffon/REmap create a map by R
Do you want to install the package (Y/n)? y
Error in read.dcf(path) :
Found continuation line starting ' interactive map ...' at begin of recor
d.
I think it's not because of the commands but the config of my system?
I am really new to Rstudio, someone suggested me to download the packages to local, then install.
Can someone show me how to do that using terminal?
I have had a similar problem on both my own package and another one. The error on my package was in the Description: block of the DESCRIPTION file. Even though this is supposed to be a thorough description, the only thing that worked to fix it, in my multiple attempts, was to reduce this entry to one line.
The other package I was trying to load has the problem in the Authors#R: field. It looks fine compared to another I sampled, except perhaps that the closing paren is not on a separate line.

RStudio cannot load web file, but R in terminal can; why?

I'm running RStudio on Ubuntu 18.04. When I want to load this data from GitHub
d <- read.csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv")
I get the following error message.
Error in file(file, "rt") : cannot open the connection to 'https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv'
In addition: Warning message:
In file(file, "rt") :
URL 'https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv': status was 'Problem with the SSL CA cert (path? access rights?)'
Yet when I run the very same command in the terminal it works without any error. How can that be? And how can I fix it?
That seems similar to issue 1079 which includes:
Please restart R
then install.packages(c("curl", "httr"))
then try again.
If this is not enough, follow swirldev/swirl/issue 475.

download.file "operation timed out" error with large files

I'm using R 3.1.2 with RStudio 0.98 on Windows 7 32 bits.
I want to download some weather forecasts files of the GFS model, to be found on an open ftp server, e.g.:
ftp://nomads.ncdc.noaa.gov/GFS/Grid4/201412/20141221/gfs_4_20141221_0000_000.grb2
The internet connection is done through a proxy (.Renviron is properly configured), and I'm basically using the donwload.file function for this purpose.
url <- file.path("ftp://nomads.ncdc.noaa.gov/GFS/Grid4/201412/20141221/gfs_4_20141221_0000_000.grb2")
download.file(url, destfile="temp.grb2", mode="wb")
Where I get the following error message:
trying URL 'ftp://nomads.ncdc.noaa.gov/GFS/Grid4/201412/20141221/gfs_4_20141221_0000_000.grb2'
using Synchronous WinInet calls
Error in download.file(url, destfile = "temp.grb2", mode = "wb", :
cannot open URL 'ftp://nomads.ncdc.noaa.gov/GFS/Grid4/201412/20141221/gfs_4_20141221_0000_000.grb2'
In addition: Warning message:
In download.file(url, destfile = "temp.grb2", mode = "wb", :
InternetOpenUrl failed: 'Operation timed out'
This message appears exactly 30 seconds after running those lines, and no issues appear when downloading a smaller file, such as 'ftp://nomads.ncdc.noaa.gov/GFS/Grid4/201412/20141221/gfs_4_20141221_0000_000.inv', so I assume it's a matter of timeout configuration.
Setting:
options(timeout=240) doesn't seem to work.
With another computer, using R 3.0.2 with RStudio 0.98 on Windows 8 64 bits, and without using proxy connection, it works perfect.
Any suggestions?

tm readPDF: Error in file(con, "r") : cannot open the connection

I have tried the example code recommended in the tm::readPDF documentation:
library(tm)
if(all(file.exists(Sys.which(c("pdfinfo", "pdftotext"))))) {
uri <- system.file(file.path("doc", "tm.pdf"), package = "tm")
pdf <- readPDF(PdftotextOptions = "-layout")(elem = list(uri = uri),
language = "en",
id = "id1")
pdf[1:13]
}
But I get the following error (which occurs after calling the function returned by readPDF):
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\DOCUME~1\Tomas\LOCALS~1\Temp\RtmpU33iWo\pdfinfo31c2bd5762a': No such file or directory
Note that I have installed all xpdf binaries to current directory (but this is handled by the if condition).
EDIT: found out this is a bug. What would be the easiest workaround?
Did some debugging and see it fails in tm:::pdfinfo():
status <- system2("pdfinfo", shQuote(normalizePath(file)),
stdout = outfile)
This command doesn't create the outfile. According to Redirect system2 stdout to a file on windows this is a bug!

Resources