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

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?

Related

Error in Seurat - Error in validityMethod()

I am running the below code
pbmc.sce <- as.SingleCellExperiment(pbmc,assay = "RNA")
then i got this
Error in validityMethod(as(object, superClass)) :
object 'CsparseMatrix_validate' not found
in some old post, it ask us to update.packages("Matirx")
tried and didn't work for me. Your help would be much appreciated

Error msg in R: Error in unlist_as_integer(x#subscript) : object 'fancy_mseq' not found

I am reading 2 vcf files in to R. They load fine (I have used 3 different methods to do this (read.vcf, readVCF, and fread) and all are fine) however when I go on to try and do anything with 1 of the vcf files, the msg reads:
Error in unlist_as_integer(x#subscript) : object 'fancy_mseq' not found
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'from': object 'fancy_mseq' not found
Usually I just google error msgs but I can not find anything online about this. Does anyone have any idea what could be causing this error message? Whilst it's hard to be 100% sure because of the vcf format, I can't see anything wrong with the file when I call str(), head() or any other ways of looking at the data.
Thank you!

Invalid formula error in R - xtabs function giving environment issure

When trying to run this (or any other) command
xtabs(ugdata$response, ugdata$Equity, data=ugdata)
I keep receiving this error
Error in formula.default(object, env = baseenv()) : invalid formula
I have been looking around all day, including similar posts on this website, but I cannot find a solution to help me fix this.
Any help would be greatly appreciated
I believe the error is in the syntax. Please try:
xtabs(ugdata$response ~ ugdata$Equity, data = ugdata)

Function not working anymore when executed from own package

Hope you can give me a quick help:
I have a function that works perfect as run in the global envir. When I eval the function from my own package it gives me an error. I can't figure out what the problem is. Seem so random to me.
catTableFun(aaa,grouped_by = "varNameAsString",preview=T) #from global envir works as expected
elricoFuns::catTableFun(aaa,grouped_by = "varNameAsString",preview=T) # identical function run from package gives the following error
Error:
#Error in get(grouped_by) : object 'varNameAsString' not found
Its such a construct causing the error. But why?
setDT(x)
gnLevels <- x[,get(grouped_by),drop=F]
I'm sorry I cant give you some rep example and this is a broad question, but I hope someone has encountered a similar phenomenon or has an educated guess about it.

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)

Resources