Entering edit mode
8.2 years ago
1769mkc
★
1.3k
gene HSC_7256 HSC_6792 HSC_7653 HSC SU048_Blast SU209_Blast
APOBEC3A -0.9621548 0.000000 -1.235946 0.000000 0.8818193 -0.9603217
ATAD2B 5.6414714 5.402059 5.79380 5.755443 6.1243134 5.4867616
I m trying to get mean of these multiple columns like HSC one column and Blast another column where mean of each sample would be calculated.
Im doing this
j <- HSC_Blast_EPI_factor_gene %>% rowwise() %>%
mutate(HSC =mean(c(HSC_7256,HSC_6792,HSC_7653,HSC),na.rm = TRUE))
then I get a new column , but Im not able to pipe the same then when I try to do for the sample after HSC
When I doing this
j <- HSC_Blast_EPI_factor_gene %>% rowwise() %>%
mutate(HSC =mean(c(HSC_7256,HSC_6792,HSC_7653,HSC),
mutate(LSC =mean(c(SU048_Blasts,SU209_Blasts))),na.rm = TRUE))
I get this error
> Error in mutate_impl(.data, dots) : Evaluation error: argument
> ".data" is missing, with no default.
what am i doing wrong ?any suggestion or help would be appreciated
Why not
meltthe data frame (orgather) instead of moving onto the pain ofrowwiseoperations?rowwiseoperations never really worked for me.Your code has two issues:
Your code should be:
thank you for rectifying me
Is it working now?
its working perfectly fine ..instead of comment if you could have answered then i would have vote up all the answers
This is not answer to your question. However there is another way to do the same in R:
output:
okay I will try your way ,i was just trying to see what is going wrong its a pretty simple operation...isn't it ..
dplyr solution without rowwise function:
Command:
Output:
Well, rowwise and two mutate functions are not necessary (in OP code). I guess for the second mutate function, it was looking for data to operate and could not find (IANP/S).