What causes this? rdplot Error in R: Error in seq.default(x_min, c, jump_l) : invalid '(to - from)/by' - r

I am trying to use some very simple data in rdplot but I keep getting the error: Error in seq.default(x_min, c, jump_l) : invalid '(to - from)/by' I found this response from a diffrent post on Stack Overflow but can seem to apply the fix to the rdplot function. does anyone know how can this be fixed?
The actual code I am using is:
library(rdrobust)
rdplot(y = dt$treated, x = dt$score)
Reproducibility:
Here is a sample of my data, as I've said it is fairly common data. So far I have found a couple of things:
There are multiple subsets of the observations that seem to cause problems
Changing the nbins or binselect arguments from their default will fix the problem
The first time you get an error is on the set 1:1463, however using only observations 2:1464 is OK.

The recent rdrobust version 1.0.1 should take care of this error.

Related

How to solve the following error message related to dates :Incompatible methods ("-.Date", "-.POSIXt") R?

I am new using R, I need to calculate the time between two dates: date_inclusion and date_point, for which I am doing the following.
cancer$date_point <- as_date("1980 - 02 - 15")
cancer$delai_recul_j <-(cancer$date_point-cancer$Date_inclusion)
but I get the following message.
'Warning message: Incompatible methods ("-.Date", "-.POSIXt") for "-"'
At first I thought it was the Mac date format, but it didn't work, I don't know what to do, since obviously with the column that is created I can't work.
Thank you very much!

Error in validityMethod(as(object, superClass)) : object 'Matrix_validate' not found

I just try to use :
scRNA <- FindNeighbors(scRNA, dims = pc.num)
and
scRNA.counts <- Read10X(data.dir = "filtered_feature_bc_matrix")
and both of them gives error like :
Error in validityMethod(as(object, superClass)) : object 'Matrix_validate' not found
I guess these code totally run well in other's computer
so I wonder what's wrong with my code and how to fix it ?
Indeed, to solve the problem for you, it should be sufficient to do what #Mikael Jagan says:
update.packages("Matrix")
2nd thought: The above may not solve the problem entirely:
As there are other packages involved, some of these may have to be re-installed (after the updating of Matrix).
Can you post the output (or good summary of that if it's too long) of
traceback()
immediately after producing the error you are seeing?

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.

How can I find the mean of three rasters?

I have three dataframes, for which I am trying to find a cell-by-cell mean.
r1<-raster('a.tif')
r2<-raster('b.tif')
r3<-raster('c.tif')
However, doing this is giving me the following error
q<-mean(r1,r2,r3)
or
q<-(r1+r2+r3)/3
Error
Error in .local(.Object, ...) : options(warn) not set
Warning message:
closing unused connection 4 .....
That is a weird error message. Often this type of situation goes away if you restart R without loading an old workspace (which may be stale). If that is what is going on use unlink(".RData"), exit R without saving and start again.
To answer your aside question, yes it is much easier to stack them. E.g.
f <- list.files(pattern='tif$')
s <- stack(f)
x <- sum(s)

"PickSoftThreshold" function issue in WGCNA?

Currently I am applying one dataset to WGCNA codes for Network construction and Module detection. Here I have to use a function called "pickSoftThreshold" to detect the network topology. When I run that it shows me this error-
> sft = pickSoftThreshold(datExpr, powerVector = powers, verbose = 5)
pickSoftThreshold: will use block size 18641.
pickSoftThreshold: calculating connectivity for given powers...
..working on genes 1 through 18641 of 54675
Error in serialize(data, node$con) : error writing to connection
Any idea how to get rid of that?
Thanks in Advance!!
I myself just started using WGCNA a couple of days ago and am not really familiar with it yet. But the error looks like you are using too many genes (up to 55k): I think you should find a way to filter out some of them, if your computer isn't powerful enough.
(Ideas from http://labs.genetics.ucla.edu/horvath/CoexpressionNetwork/Rpackages/WGCNA/faq.html )

Resources