I want to generate random string and have installed the random package.
However, I couldn't run my code and received this error:
Error in url(urltxt, ..., method = "libcurl") : cannot open connection
In addition: Warning message: In url(urltxt, ..., method = "libcurl")
: URL 'https://www.random.org/strings/?num=7&len=6&digits=on&upperalpha=on&loweralpha=off&unique=on&format=plain&rnd=new'
: status was 'SSL connect error'
Here's my code:
library("random")
String<-randomStrings(n=7, len = 6, digits = TRUE, upperalpha = TRUE, loweralpha = FALSE, unique = TRUE, check = FALSE)
Anybody knows what's the source of this error?
Related
I'm trying to use the driver for R colab but it gives the following error
if (file.exists("/usr/local/lib/python3.6/dist-packages/google/colab/_ipython.py")) {
install.packages(" R.utils")
library("R.utils")
library("httr")
my_check <- function() {return(TRUE)}
reassignInPackage("is_interactive", pkgName = "httr", my_check)
options(rlang_interactive=TRUE )
}
drive_auth(
email = gargle:: gargle_oauth_email (),
path = NULL,
scopes = "https://www.googleapis.com/auth/drive",
cache = gargle:: gargle_oauth_cache (),
use_oob = gargle:: gargle_oob_default () ,
token = NULL
)
Error in drive_auth():
! Can't get Google credentials
ℹ Are you running googledrive in a non-interactive session? Consider:
• drive_deauth() to prevent the attempt to get credentials
• Call drive_auth() directly with all necessary specifics
ℹ See gargle's "Non-interactive auth" vignette for more details:
ℹ https://gargle.r-lib.org/articles/non-interactive-auth.html
Traceback:
drive_auth(use_oob = TRUE, cache = TRUE)
drive_abort(c("Can't get Google credentials", i = "Are you running googledrive in a non-interactive session? \\n Consider:",
. * = "{.fun drive_deauth} to prevent the attempt to get credentials",
. * = "Call {.fun drive_auth} directly with all necessary specifics",
. i = "See gargle's "Non-interactive auth" vignette for more details:",
. i = "{.url https://gargle.r-lib.org/articles/non-interactive-auth.html}"))
cli::cli_abort(message = message, ..., .envir = .envir)
rlang::abort(message, ..., call = call, use_cli_format = TRUE,
. .frame = .frame)
signal_abort(cnd, .file)
The following code works in a Azure Databricks Python cell:
dbutils.fs.mount(
source = "wasbs://my-container#mystorageaccount.blob.core.windows.net",
mount_point = "/mnt/mount1",
extra_configs = {"fs.azure.account.key.mystorageaccount.blob.core.windows.net":dbutils.secrets.get(scope = "my-scope", key = "storagekey")})
However, if I try to run this code from an Azure Databricks R cell I get an error, can somebody explain what's going on?
dbutils.fs.mount(
source = 'wasbs://my-container#mystorageaccount.blob.core.windows.net',
mountPoint = '/mnt/mount1',
extraConfigs = {'fs.azure.account.key.mystorageaccount.blob.core.windows.net':dbutils.secrets.get(scope = 'my-scope', key = 'storagekey')}
)
Warning in as.list(extraConfigs) : NAs introduced by coercion Warning in as.list(extraConfigs) : NAs introduced by coercion Error in
"fs.azure.account.key.mystorageaccount.blob.core.windows.net":dbutils.secrets.get(scope
= "my-scope", : NA/NaN argument Some( Error in
"fs.azure.account.key.mystorageaccount.blob.core.windows.net":dbutils.secrets.get(scope
= "my-scope", : NA/NaN argument ) Error in "fs.azure.account.key.mystorageaccount.blob.core.windows.net":dbutils.secrets.get(scope
= "my-scope", : NA/NaN argument
The problem is that you're trying to use Python syntax for extraConfigs parameter, but it's incorrect. In R you need to use following syntax for dicts: c(key1="value1", key2="value2")
I did a Scopus search using rscopus package with the following code:
author_search(au_id = "Smith",
searcher = "affil(princeton) and authlast")
I got the following error:
Error in get_results(au_id, start = init_start, count = count, facets = facets, :
Unauthorized (HTTP 401).
However, this code works well:
scopus_search(query = "Vocabulary", max_count = 20,
count = 10)
I have set the Scopus API Key using options("elsevier_api_key" = "MY-API-KEY-HERE"). So, I wonder what the problem is.
I want to convert r neural network model into pmml, using r2pmml package based on jpmml:
mynn <- nnet(Churn ~ ., data=trainNN, size=3, decay=1.0e-5, maxit=50, softmax = TRUE)
r2pmml(mynn,"churn_nnet_pmml.xml")
But I have such error:
Jul 11, 2018 10:18:48 AM org.jpmml.rexp.Main run
INFO: Converting..
Jul 11, 2018 10:18:48 AM org.jpmml.rexp.Main run
SEVERE: Failed to convert
java.lang.IllegalArgumentException: nmatrix.2
at org.jpmml.rexp.RExpUtil.getDataType(RExpUtil.java:46)
at org.jpmml.rexp.FormulaUtil.createFormula(FormulaUtil.java:71)
at org.jpmml.rexp.NNetConverter.encodeSchema(NNetConverter.java:59)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:69)
at org.jpmml.rexp.Converter.encodePMML(Converter.java:39)
at org.jpmml.rexp.Main.run(Main.java:149)
at org.jpmml.rexp.Main.main(Main.java:97)
Exception in thread "main" java.lang.IllegalArgumentException: nmatrix.2
at org.jpmml.rexp.RExpUtil.getDataType(RExpUtil.java:46)
at org.jpmml.rexp.FormulaUtil.createFormula(FormulaUtil.java:71)
at org.jpmml.rexp.NNetConverter.encodeSchema(NNetConverter.java:59)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:69)
at org.jpmml.rexp.Converter.encodePMML(Converter.java:39)
at org.jpmml.rexp.Main.run(Main.java:149)
at org.jpmml.rexp.Main.main(Main.java:97)
Error in .convert(tempfile, file, converter, converter_classpath, verbose) :
1
As explained on https://github.com/jpmml/r2pmml/issues/28 this is a minor bug in the JPMML-R library.
I tried suggested workaround (to generate a fully populated variable.levels attribute manually):
mynn$variable.levels <- lapply(trainNN, function(x){ if(is.factor(x)){ levels(x) } else { NULL }})
And run with verbose option and added variable.levels:
r2pmml(mynn,"churn_nnet_pmml.xml", verbose = TRUE, variable.levels = mynn$variable.levels)
But then I have an error:
Error in decorate.default(x, ...) :
unused argument (variable.levels = list(X.area.code.408 = NULL,
X.area.code.510 = NULL, X.international.plan.1 = NULL, X.voice.mail.plan.1 =
NULL, X.total.eve.charge. = NULL, X.total.night.charge. = NULL,
X.total.intl.charge. = NULL, Churn = NULL))
So how to cope with that issue with r2pmml?
Thanks
I am trying to export a 3D plot that was made using the plot3d function from the rgl package using the WrtieWebGL function for web viewing. I don't really understand the example in the WriteWebGL documentation because it saves to a temp directory. Could someone please provide an example on how to use this function and/or point out my error(s) with usage? Thank you for your time and help.
attach(dataset1)
plot3d(Days_Prep_Time,ACT_Score,Coffee,size=5,col="blue", type="s")
writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"),
template = system.file(file.path("WebGL", "template.html"), package = "rgl",
snapshot = TRUE, font = "Arial")
I get the following error:
Error in writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"), :
template ‘’ does not contain %WebGL%
In addition: Warning message:
In file(con, "r") :
file("") only supports open = "w+" and open = "w+b": using the former
You are adding the snapshot and font parameters to the system.file function, not the writeWebGL function:
writeWebGL(dir = "webGL", filename = file.path(dir, "index.html"),
template = system.file(file.path("WebGL", "template.html"), package = "rgl"),
snapshot = TRUE, font = "Arial")
In particular, note that
system.file(file.path("WebGL", "template.html"), package = "rgl")
returns the correct path from console, whereas
system.file(file.path("WebGL", "template.html"), package = "rgl", snapshot = TRUE, font = "Arial")
returns "".