Closed GreyRockIQ closed 2 years ago
Hi,
Not member of dev team but hopefully can be helpful. %>%
is the magrittr pipe. Did you load the dplyr package indicated at start of vignette? That should import the magrittr pipe for use without actually loading magrittr too. Alternatively can just load magrittr.
Best, Sam
Not a member of dev team either, but I think if you just throw:
`%>%` <- magrittr::`%>%`
at the beginning of your script, and run the command, it will add %>%
functionality to your environment. (I like to do it this way, rather than loading the whole magrittr via library(magrittr)
or the whole tidyverse via library(tidyverse)
)
If that doesn't work you might first have to install magrittr
by using the following command:install.packages("magrittr")
or install the larger tidyverse
package that contains magrittr
: install.packages("tidyverse")
, and then either one of the 3 options above.
EDIT: It might be easiest to just load dplyr
on second thought as is in the standard Seurat
workflow cause I think group_by()
and top_n()
are apart of that, and you won't be able to run those commands without getting dplyr
into your script... the easiest way is to just do: library(dplyr)
at the beginning of your script.
Thanks Samuel-marsh and Pancreas-Pratik for suggesting.. Reloading tidyverse and dplyr before script run solved first set of script for table but the second set is still on issue even after reloading dplyr with error commands below:
Error in UseMethod("group_by") : no applicable method for 'group_by' applied to an object of class "function"
@GreyRockIQ can you post the full code you are running that leads to error?
Here is the full code..
pbmc.markers %>%
group_by(cluster) %>%
top_n(n = 10, wt = avg_log2FC) -> top10
Seurat::DoHeatmap(pbmc, features = top10$gene) + Seurat::NoLegend()
Error in UseMethod("group_by") : no applicable method for 'group_by' applied to an object of class "function"
Hi @GreyRockIQ
Assuming pbmc markers is an output from FindAllMarkers
I ran your exact code using pbmck object from SeuratData and have no such errors. I would reccomend restarting your R session and re-running code and see if error persists. If so can you please post entire code you are running and output of sessionInfo
Best, Sam
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.
Hello I am unable to run following codes on Seurat R 4.0 version
pbmc.markers %>% group_by(cluster) %>% slice_max(n = 2, order_by = avg_log2FC)
Errors as: Error in pbmc.markers %>% group_by(cluster) %>% slice_max(n = 2, order_by = avg_log2FC) : could not find function "%>%"
pbmc.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC) -> top10 DoHeatmap(pbmc, features = top10$gene) + NoLegend()
Errors as: Error in pbmc.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC) : could not find function "%>%"
Any suggestions? Thanks GreyRock