Error in setInternet2(TRUE) : use != NA is defunct - r

Since I upgraded to R Version 3.3.1, when I try and exit from R using q(), I get the following message: "Error in setInternet2(TRUE) : use != NA is defunct"
This happens on every exit.
I haven't used setInternet2 and it is not in .Rprofile, or .Rprofile.site.
I do not have a .Renviron.site file.
I checked I had the right setup files using:
file.path(getwd(),".Rprofile")
file.path(getwd(),".Rprofile.Site")
file.path(getwd(),".Renviron.site")
I'm using R version 3.3.1 (2016-06-21) and Windows 7 x64 Service Pack 1

I know it's a late reply, but for the record:
This happened because
as of R 3.3.0, setInternet2 is now defunct. Use of setInternet2 should be replaced with the method = "wininet" argument to the url and download.file functions
So it's not like anything else got changed or added, just before this wouldn't have caused such a message.
To know where it stems from is maybe not that easy, it could also be that you had in the past set it and saved your workspace and never cleaned your workspace completely afterwards.

Related

how can fix this issue "Error in h2o.upload_model() : could not find function "h2o.upload_model"?

I have installed h2o package(in R from RStudio console). Post h2o.init() I am trying to use the built in function upload_model()/upload_mojo() but I am getting following error.
h2o.upload_mojo()
Error in h2o.upload_mojo() : could not find function "h2o.upload_mojo"
h2o.upload_model()
Error in h2o.upload_model() : could not find function "h2o.upload_model"
I found work around to resolve this issue. Please find below the steps I followed:
Remove the package using: remove.packages("h2o")
Quit the current session and launch the new one.
Move out lock file for h2o from path where package was installed mostly under R with file name like - 00LOCK-h2o
Install new/latest version of package via RStudio console using install.packages()
It should now resolve this issue.

Why can't Rserve run?

I want to use R on Qlik, and I began by following this process : https://community.qlik.com/servlet/JiveServlet/previewBody/18785-102-1-25264/Installing%20R%20with%20Qlik%20Sense.pdf
I installed R (with the specific install path, but R-3.4.4), and Qlik (September 2018 version).
Then I followed the different steps, until the 6th.
There, when I run Rserve.exe, I get an error : "Fatal error: unable to open the base package".
However I checked that the base package is well installed.
I didn't find where does it come from.
-> Is it a problem of R or Qlik version ?
-> Or is there someting else to take care of ?
Thank you very much for your advice !
I finally found the answer :
creating an environment variable
calling it R_HOME
value : the path to R (C:\R\R-3.4.4)

RStudio Error: STRING_ELT() can only be applied to a 'character vector', not a 'builtin'

Upon startup in RStudio. Before doing anything I get the following error display on the console window:
Error: STRING_ELT() can only be applied to a 'character vector', not a 'raw'
I'm working on a Windows 10 OS R version 3.2.2
How can I get rid of the message? How can I identify where the source of where this error is coming from? I'm thinking it may have something to do with a previous session but I'm having trouble identifying the pattern for why this error occurs.
In RStudio I went to Session - Clear Workspace
Then I went to Session - Terminate R
Then I went to Session - Restart R
Then I closed the program and restarted it. Some how that fixed the issue.
I had a similar error. In my case, the default Computer\HKEY_LOCAL_MACHINE\SOFTWARE\R-core\R64\Current Version regkey was pointing to some ancient 2015 version of a Microsoft Revolution Analytics version of R. Not sure how that happened, but I updated it to point to the latest version of R in C:\Program Files\R\R-4.1.2 and all was well.
YMMV

RStudio : Rook does not work?

I would like to build a simple webserver using Rook, however I am having strange errors when trying it in R-Studio:
The code
library(Rook)
s <- Rhttpd$new()
s$start()
print(s)
returns the rather useless error
"Error in listenPort > 0 :
comparison (6) is possible only for atomic and list types".
When trying the same code in a simple R-Console,everything works - so I would like to understand why that happens and how I can fix it.
RStudio is Version 0.99.484 and R is R 3.2.2
I've experienced same thing.
TLDR: This pull request solves the problem: https://github.com/jeffreyhorner/Rook/pull/31
RStudio is treated in different way and Rook port is same as tools:::httpdPort value. The problem is that in current Rook master tools:::httpdPort is assigned directly. It's a function that's why we need to evaluate it first.
If you want to have it solved right now, without waiting for merge into master: install devtools and load package from my fork #github.
install.packages("devtools")
library(devtools)
install_github("filipstachura/Rook")

Warning message In download.file: download had nonzero exit status

I am downloading data from data.gov website and I get following two types of errors in the process:
fileUrl <- "http://catalog.data.gov/dataset/expenditures-on-children-by-families"
download.file(fileUrl,destfile=".data/studentdata.csv",method="curl")
Warning message:
In download.file(fileUrl, destfile = ".data/studentdata.csv", method = "curl") :
download had nonzero exit status
I tried to remove the method="curl" as suggested in other forum, but again I get this new error
download.file(fileUrl,destfile=".data/studentdata.csv")
Error in download.file(fileUrl, destfile = ".data/studentdata.csv") :
cannot open destfile '.data/studentdata.csv', reason 'No such file or directory'
I think there are two major factors why your curl doesn't work well.
First, the problem is on your URL. fileUrl <- "http://catalog.data.gov/dataset/expenditures-on-children-by-families". In your URL, it is not referred to a csv file. So, they won't work even if you set the destination into a csv file such as destfile = ".data/studentdata.csv"
I have an example of getting a csv dataset using the same code (different dataset):
DataURL<- "https://data.baltimorecity.gov/api/views/dz54-2aru/rows.csv?accessType=DOWNLOAD" (This link refers to a rows.csv file)
download.file(DataURL, destfile="./data/rows.csv", method="curl") (The method is quite same, using curl)
Second, previously I had the same problem that the curl does not work, even I used a proper URL that refers to a csv file. However, when I diagnosed a bit deeper, I found something interesting fact about why my curl method cannot work properly. It was my R session program. I used a 32-bit R, in which the error occurs. Later then, I tried to change the session into a 64-bit R. Amazingly, and the download status was running at that time. To see your R session architecture (whether you are using 32-bit or 64-bit), type in your R:
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-ming32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
You have to switch your R, from 32-bit to 64-bit to avoid 'curl' call had nonzero exit status. You go to your R directory folder, and then you run a 64-bit R.
If you are using a Windows OS and installing the R in a default path folder, you can run this C:\Program Files\R\R-3.5.3\bin\x64\R.exe. (I used a version of 3.5.3, so it may be different with your version)
If you are using R-studio, you can switch the R session on the menubar Tools -> Global Options -> R version -> Change -> Use your machine's default version of R64 (64-bit) -> OK. Then restart your R-studio.
However, it depends on your OS architecture. If you are using a 32-bit OS, hence you have to find another way to solve this.
So looking at the code for download.file(...), if you specify method="curl" the function tries to use the curl shell command. If this command does not exist on your system, you will get the error above.
If you do not specify a method, the default is to use an internal R method to download, which evidently works on your system. In that case, the function is trying to put the file in .data/studentdata.csv but evidently there is not .data directory. Try taking out the ..
When this download works, you will get a text/html file, not a csv file. Your url points to a web page, not a download link. That page does have a download link, but unfortunately it is a pdf, not a csv.
Finally, if your goal is to have the data in R (is it?), and if the link actually produces a csv file, you could more easily use
df <- read.csv(fileUrl)
If I'm not very much mistaken you just have a simple typo here. I suspect you have a "data" directory, not a ".data" directory - in which case your only problem is that your destfile string needs to begin "./data", not ".data".
I was having the same problem.
Then I realized that I forget to create the "data" directory!
So try adding this above your fileURL line to create the directory first.
if(!file.exists("data")){
dir.create("data")
}
Also, if you are running a Mac, then you want to keep method="curl" when downloading a https file. I don't believe Windows has that problem hence the suggestions to remove it.
Try this:
file<-'http://catalog.data.gov/dataset/expenditures-on-children-by-families'
file<- read.csv(file)

Resources