I want to get the count of different labels in one column in a dataframe, I'm fine witt the output, I used:
c.1 <- function(n) case_when( n > 0.05 ~ 'ns',
n > 0.01 ~ '*',
n > 0.001 ~ '**',
n > 0.0001 ~ '***',
n >=0 ~ '****',
is.na(n) ~ 'missing')
p.type1<-c.1(nav$pvalue)
tab.1<-table(c.1(nav$pvalue))
nav<-as.factor(tab.1)
nav
The output:
*: 12 **: 23 ***: 44 ****: 76 missing: 5 n.s.: 109
First row of my data input:
n.name bMean log2FoldChange lfcSE stat pvalue padj
<fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
469 TNFRSF1B 542.82545 -3.406411 0.2267235 -15.024517 5.07e-51 3.25e-48
Is there away to get the same results using lapply?