Error while using write_xes function : Error in defaultvalues[[datatype]] : invalid subscript type 'list' - r

I want to export an eventlog object built in R using bupaR package function - eventlog as an xes file. For that I am using function write_xes() of package xesreadR. But the function is giving out error :
Error in defaultvalues[[datatype]] : invalid subscript type 'list'
>class(log)
output:
[1] "eventlog" "tbl_df" "tbl" "data.frame"
write_xes(log,"myxes.xes")
According to the documentation it should save the log to the destined file.But instead it is producing the error :
ERROR : Error in defaultvalues[[datatype]] : invalid subscript type
'list'
I have tried multiple things to troubleshoot this problem but haven't came up with a solution. So can somebody help me to solve this error. Thank You!

Your function is defined as follow:
write_xes ( eventlog, case_attributes = NULL, file = file.choose())
Thus, writing
write_xes(log,"myxes.xes")
means
write_xes(eventlog = log, case_attributes = "myxes.xes").
Instead, you shall write
write_xes(eventlog = log, file = "myxes.xes")

Related

filterAndTrim : Error in add(bin) : record does not start with '#'

I'm using dada 2 version ‘1.22.0’ on windows 10, i have list of compressed (.gz ) fastq files, when i use the function filterAndTrim i get this error message :
Error in add(bin) : record does not start with '#'
But when i want to see if i can read th .gz file with library(ShortRead) :
library(ShortRead)
fn <- "path/to/example.fastq.gz"
reads <- readFastq(fn)
it doesn't give any error message message
I don't understand why the function filterAndTrim give the error message
Error in add(bin) : record does not start with '#'
Do you have any solution?

Error when trying to prase a HTTP-Request in R

im using R package httr to get a HTTP-Response for a specific link.
When trying to parse the content of the response im getting the Error:
Fehler in parse(text = script_content) : <text>:1:10: Unerwartete(s) '['
1: {"lines":[
Translated to enlgish it says something like this (sorry for my error messages being in German):
Error in parsing(text = script_content) : <text>1:10: Unexpected '['
1: {"lines":[
It seems as there is a problem with the format/encoding of the text. Here is my code:
script <-
GET(
url = "https://my_url.which_origin_is_not_important/my_script.R",
authenticate(username, pass)
)
script_content <- content(script, as = "text", encoding = "ISO-8859-1")
parsed_condent <- parse(text = script_content )
The value of script_content looks like this:
"{\"lines\":[{\"text\":\"################## FUNCTION ##################\"},{\"text\":\"\"},{\"text\":\"library(log4r)\"}],\"start\":0,\"size\":32,\"isLastPage\":true,\"limit\":500,\"nextPageStart\":null}"
Some more background to this operation: Im trying to source a code, which is currently inside of a private repository. I wrote the code myself i'm trying to source. I made sure, that the issue is not coming from within th code.
I got the solution from: Sourcing R files in a private github folder
Thanks for any advice!!

H2o with predict_json: "Error: Could not find or load main class water.util.H2OPredictor"?

I tried to use the H2o predict_json in R,
h2o.predict_json(modelpath, jsondata)
and got the error message:
Error: Could not find or load main class water.util.H2OPredictor
I am using h2o_3.20.0.8.
I searched the documentation from H2o but didn't help.
> h2o.predict_json(modelpath, jsondata)
$error
[1] "Error: Could not find or load main class water.util.H2OPredictor"
Warning message:
In system2(java, args, stdout = TRUE, stderr = TRUE) :
running command ''java' -Xmx4g -cp .:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/h2o-genmodel.jar:/Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models:genmodel.jar:/ water.util.H2OPredictor /Library/Frameworks/R.framework/Versions/3.5/Resources/library/mylib/Models/mymodel.zip '[{"da1":252,"da2":22,"da3":62,"da4":63,"da5":84.83}]' 2>&1' had status 1
It looks like you are missing your h2o-genmodel.jar file - this is what the error message Could not find or load main class water.util.H2OPredictor indicates. You may want to provide all the arguments to checkoff that you have everything:
h2o.predict_json(model, json, genmodelpath, labels, classpath, javaoptions)
documentation here

safely get variable from enviroment

When I execute:
my_env <- new.env(parent = emptyenv())
test <- purrr::safely(get("meta", envir = my_env))
I get the following error:
Error in get("meta") : object 'meta' not found
The error is correct in the sense of that the meta variable is not defined in the environment but my line of thinking was that safely would return a NULL in that case.
I can get around the error by using checking using exists first but I was curious about why safely fails. Am I wrong in thinking of safely as the equivalent of a try-catch?
You are misinterpreting the actions of the safely function. It was actually succeeding. If you had examined the value of test, you should have seen:
> test
[1] "Error in get(\"meta\", env = my_env) : object 'meta' not found\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in get("meta", env = my_env): object 'meta' not found
To suppress error messages from being visible at the console you can either turn off reporting with options(show.error.messages = FALSE) or you can redirect the destination of stderr().

object 'CexpandAltRep' not found

Two errors i've encountered recently:
Error in setDT(data) : object 'CexpandAltRep' not found
and
Error in setDT(list(indices = rep.int(indices__, len__),
irows = irows)) : object 'CexpandAltRep' not found
Do you have any clues how to solve that?

Resources