Shira
Shira

Reputation: 129

tidyverse divide by rowSums using pipe

I want to do df/rowSums(df) in tidyverse.

I tried df %>% ./rowSums(.) but this does not work.

Do you have ideas? Thanks so much!

Upvotes: 0

Views: 128

Answers (1)

akrun
akrun

Reputation: 887251

We can wrap it inside the {}

library(dplyr)
df %>%
   {./rowSums(.)}

Upvotes: 1

Related Questions