Troubleshooting with MetaboAnalyst - r

I am trying to run MetaboAnalyst 3.0.3 Pathway Analysis on R (see session information below), and I am getting an error when I try to run the second line of code.
Pathway Analysis Tutorial
I keep getting this error:
> mSet<-InitDataObjects(data.type = "conc", anal.type = "pathora", FALSE)
Error: $ operator is invalid for atomic vectors
Session Info
I tried following this advice but will no luck. I would really appreciate guidance on this seemingly trivial problem!

Related

Making one table in R

I am learning programming languages for the first time. I am trying to combine tables in R using:
Trip_data <- bind_rows(oct_td, sep_td, aug_td,jul_td, jun_td,may_td)
and I get the following error:
Error in bind_rows():
! Value of SET_STRING_ELT() must be a 'CHARSXP' not a 'symbol'
Run rlang::last_error() to see where the error occurred.
What does that means? and how do I solve it?
I have another set of tables and I managed to combine them just fine, I also ran that yesterday and I did not get an error.

Error when using ggstatsplot - Error in 'mutate()': Caused by error in vapply()':

Just installed ggstatsplot and tried running the Example in the Documentation to just see what inputs it requires and how to manipulate the function.
library(ggstatsplot)
ggbetweenstats(mtcars, am, mpg)
I was immediately met with the error:
Error in `mutate()`:
! Problem while computing `n_label = paste0(am, "\n(n = ", .prettyNum(n), ")")`.
Caused by error in `vapply()`:
! values must be length 1,
but FUN(X[[1]]) result is length 3
I have tried multiple examples I found online of how to use the package and all result in the same error. I also tried ggwithinstats and received the same error. I updated all of my packages and have restarted R Studio at each step.
Any help would be appreciated, please let me know if I can provide any other information.
Sorry for the troubles.
This is due to update to insight package (https://github.com/IndrajeetPatil/ggstatsplot/issues/749).
EDIT on 21 May 22:
Both statsExpressions and ggstatsplot updates are now on CRAN, so all these issues should go away.
I get the exact same error.
#for reproducibility and data
set.seed(123)
library(WRS2)
library(ggstatsplot)
ggwithinstats(
data = bugs_long,
x = condition,
y = desire
)
May it is a bug?

How to fix lmer error: "Error in as(value, fieldClass, strict=FALSE) :"?

I'm getting a strange error when I run an lmer function in r.
I've tried changing the variable types (all of them are numeric or factor) and removing the NA before analysis, but nothing seems to work.
model_1 <- lmer(Q14 ~ gender * time + (1|OMID), data=data)
summary(model_1)
Specifically, my error message reads:
Error in as(value, fieldClass, strict = FALSE) :
internal problem in as(): “labelled” is(object, "numeric") is TRUE, but the metadata asserts that the 'is' relation is FALSE
Not sure why this is happening, but I can't seem to find any answers for it. Any help would be appreciated.
Thanks!
I think lmer has a problem with 'labelled' data. If you un-label the predictors it should work fine.
I had the same error: the code for the lme-formula worked perfectly fine and one day I encountered that error. The solution in my case was simply to restart the R session, reload the data - in my case from SPSS via library("haven")::read.sps and after that load library("lme4") and execute the lme-formula.
So, if the formula worked before without any error, maybe just clean the project environment and re-run the most crucial code without any additional packages loaded. Maybe it's just some "cross-contamination" between packages or an unwanted effect of any package on the dataframe.

Reading in XML data from URL using parLapply R

Beginner here, so please alert me to any formatting errors, or general etiquette mistakes.
I am attempting to scrape data from ~800 websites, to increase speed I was looking into running in parallel.
I have simplified my code to produce the error:
url=c("https://apps.hydroshare.org/apps/nwm-forecasts/api/GetWaterML/?config=long_range&geom=channel_rt&variable=streamflow&COMID=6251152&startDate=2018-03-12&lag=t18z&member=4",
"https://apps.hydroshare.org/apps/nwm-forecasts/api/GetWaterML/?config=long_range&geom=channel_rt&variable=streamflow&COMID=6244518&startDate=2018-03-12&lag=t18z&member=4"
cores.number=2
cluster1=makeCluster(cores.number)
clusterExport(cluster1,"url")
clusterEvalQ(cluster1,library("xml2"))
clusterEvalQ(cluster1,url)
temp=parLapply(cluster1,
url,
function(x)
read_xml(x,fill=TRUE,row.names=NULL))
stopCluster(cluster1)
I get the following error:
Error in checkForRemoteErrors(val) :
2 nodes produced errors; first error: HTTP error 500.
When doing the same functions with lapply instead of parLapply I have no issues and when I adjust the cores.number to 1 I have no issues.
Thanks

Example code of the Thinknum package does not run

The following example code in the documentation of the Thinknum package
install.packages("Thinknum")
library(Thinknum)
thinknumdata = Thinknum("total_revenue(goog)")
leads on my machine to the following error:
Error in Thinknum("total_revenue(goog)") : Requested Expression does not exist.
It would help me a lot, if one or more people could run the example code on another machine.

Resources