dgrtwo / tidy-text-mining

Manuscript of the book "Tidy Text Mining with R" by Julia Silge and David Robinson
http://tidytextmining.com
Other
1.31k stars 806 forks source link

count() stopped working w dplyr? #22

Closed jedgore closed 7 years ago

jedgore commented 7 years ago

i've used your example in the past, and was using it again today, and this stopped working tidy_text <-tidy_text %>% count(word)

this is what i went with tidy_text <- tidy_text %>% group_by(word) %>% summarize(n=n()) %>% arrange(desc(n))

juliasilge commented 7 years ago

Hmmmm, I'm not sure that I can reproduce that problem. I just ran the following code, and count seems to be working:

library(tidytext)
library(janeaustenr)
library(dplyr)

austen_books() %>% 
  unnest_tokens(word, text) %>% 
  count(word, sort = TRUE)
#> # A tibble: 14,520 × 2
#>     word     n
#>    <chr> <int>
#> 1    the 26351
#> 2     to 24044
#> 3    and 22515
#> 4     of 21178
#> 5      a 13408
#> 6    her 13055
#> 7      i 12006
#> 8     in 11217
#> 9    was 11204
#> 10    it 10234
#> # ... with 14,510 more rows
jedgore commented 7 years ago

and i get Error in count(., word, sort = TRUE) : unused argument (sort = TRUE)

clearly a library is out of order in my install. i've got a couple dev tidytext library installs going so maybe that's the issue.

dgrtwo commented 7 years ago

You likely have another package (loaded after dplyr) that defines a count function. Plyr is one possibility. You can find out by typing "count" and seeing what prints (at the end will be "namespace:something")

To solve this you can restart R, and be sure to load that package before dplyr, not after

jedgore commented 7 years ago

thank you, this has devolved from the original topic my apologies. i got The following objects are masked by ‘.GlobalEnv’: count clearing the global environment and re-starting R fixed the problem. welcome to error messages in R. i will be more careful choosing variable names in future. thank you for the help.

nitish11497 commented 6 years ago

thanks that's right plyr and dplyr package had created issue with count function

ghost commented 6 years ago

The following should revolve the namespace conflict issue: tidy_books %>% dplyr::count(word, sort = TRUE)

mgmtscience commented 5 years ago

Thank you for this thread. It helped me as well.

yigitsener commented 5 years ago

Okay process is well and deploy -------- Orijinal mesaj --------Kimden: Magesh Nagarajan notifications@github.com Tarih: 12.05.2019 00:54 (GMT+03:00) Alıcı: dgrtwo/tidy-text-mining tidy-text-mining@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Konu: Re: [dgrtwo/tidy-text-mining] count() stopped working w dplyr? (#22) Thank you for this thread. It helped me as well.

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or mute the thread. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/dgrtwo/tidy-text-mining/issues/22#issuecomment-491546653", "url": "https://github.com/dgrtwo/tidy-text-mining/issues/22#issuecomment-491546653", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

Robfohe commented 2 years ago

You likely have another package (loaded after dplyr) that defines a count function. Plyr is one possibility. You can find out by typing "count" and seeing what prints (at the end will be "namespace:something")

To solve this you can restart R, and be sure to load that package before dplyr, not after

this saved my life