unlist gives me a longer vector than i thought

The issue would be that some of the symbol (which is a SimpleLogicalList) contains more than one element, so we loop over the list with sapply, and wrap with any which returns a single TRUE/FALSE if any of the elements in the list element are present %in% ‘house_keeping_genes. The \(x) is a concise way to represent lambda function (function(x)) in the recent versions of R

hk1 <- sapply(features.info$symbol, \(x) 
         any(x %in% house_keeping_genes, na.rm = TRUE)) 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top