R - Error in UseMethod("groups") : no applicable method for 'groups' applied to an object of class "character"

no applicable method for 'distinct_' applied to an object of class character
no applicable method for 'tbl_vars' applied to an object of class character
no applicable method for 'filter' applied to an object of class null
select in r
filter vs select in r

I was using "count" to summarize the column of a dataframe. The column (dataset$Nationality) consists of nationalities that can occur more than once (eg. Swiss, German, French, Swiss, etc.). It worked fine, until it today suddenly produced an error message:

Error in UseMethod("groups") : no applicable method for 'groups' applied to an object of class "character".

I reinstalled dplyr but it still did not work.

For example:

dataset$Nationality consists of c("Swiss", "French","German","Swiss")

then

count(dataset$Nationality) 

would give something like

Swiss,2, French, 1, German,1

Can somebody tell me what I could do to make it work again?

Thanks a lot!

Hope this Answers your Question.

If you are using "plyr" Library library(plyr)

Correct Syntax: count(dataset$Nationality)

If you are using "dplyr" Library library(dplyr)

Correct Syntax: count(dataset, Nationality)

If you are using Both, You will have to use the syntax of the library you added last.

Adding what Dzej Suggested:

We can also use a specific library as well.

Syntax to use dplyr directly: dplyr::count(dataset, Nationality)

Syntax to use plyr directly: plyr::count(dataset$Nationality)

Error in UseMethod("select_") : when trying to Knit Rmarkdown, Error in UseMethod("select_") : when trying to Knit Rmarkdown. is just saying that 'select` doesn't know what to do with a function. frame to something more descriptive and try to avoid a name that conflicts with an existing function (like age_df , for example). R possesses a simple generic function mechanism which can be used for an object-oriented style of programming. Method dispatch takes place based on the class(es) of the first argument to the generic function or of the object supplied as an argument to UseMethod or NextMethod .

Writing what I feel is a more complete answer that combines what Ankit and aosmith have said and adds to it.

count() in the dplyr package can be called from two different contexts. The first is what aosmith and Ankit have suggested, which calls count() with the data frame as the first argument, followed by the variable(s) you want to count, separated by commas.

count(df, var1)

or

count(df, var1, var2)

The second way you can do this is using the R pipe (%>%) to pass the data frame into count().

df %>% count(var1)

or

df %>% count(var1, var2)

Failing to provide the data frame in either context will result in the 'no applicable method' error seen in the question.

Error in UseMethod("select_"), I'm in an introductory R course and I'm trying to create histograms and Error in UseMethod("select_") : no applicable method for 'select_'  Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information.

According to Ankit Gupta's answer:

If you are using both, plyr and dplyr, you can use specific library's function by providing library_name::function_name(params), ex:

plyr::count(dataset$nationality)

R: Error in UseMethod("tbl_vars"), change anti_join(stopwords) to anti_join(stop_words) . stopwords probably doesn't exist or isn't what you want it to be. If your question has been answered don't forget to mark the solution Folks in the future can come along and easily see what worked for you. You acknowledge the person who solved the issue.

If you mis-use count() inside of a group_by(...) %>% summarise(...), you will get this error

For example, this code will produce the error:

ufo_tibble %>% 
  group_by(state) %>% 
  summarize(number_sightings = count(`duration (seconds)`))

count() (in dplyr::count(..., ..., [...]) and plyr::count(...)) produces a "value count"; a list of values and the frequencies of the distinct values in the vector. (vs a single number showing the length of the vector )

In this case, I wanted the n() "summary function" instead (more info in the summarise documentation)

ufo_tibble %>% 
  group_by(state) %>% 
  summarize(number_sightings = n())

Error in UseMethod("select_") · Issue #3863 · tidyverse/dplyr · GitHub, Dear All,. I was trying to run "Rscript dosth.R" on the command line. In the script, I used "select( )" method. I got the following error message:  It's not easy, but you can run R under a debugger, and it will show you the location of the crash. As far as I know only gdb supports debugging R on Windows (there's a copy in the Rtools collection), but perhaps that will change now that Microsoft has purchased Revolution Analytics.

Error in UseMethod("compile") : no applicable method for 'compile , I built a model using keras 2.2.4 but I got compile error like this. I tried to downgrade the R version from 3.5 to 3.4 and tried  If so, R will find it when running the individual chunk with the tiny play button. However, when kniting - R will restart completely. This means Knitr starts with a completely clean environment and your df object is gone. The simple fix is to define df within the body of the knitr document.

Warning: Error in UseMethod: no applicable method for 'spread_' , Warning: Error in UseMethod: no applicable method for 'spread_' applied to an object of class "table" in shiny Apps in R Can someone help? R possesses a simple generic function mechanism which can be used for an object-oriented style of programming. Method dispatch takes place based on the class(es) of the first argument to the generic function or of the object supplied as an argument to UseMethod or NextMethod.

Error in UseMethod("select_") : no applicable method for 'select_ , Error in UseMethod("select_") : no applicable method for 'select_' applied to an object of class "NULL". 3. 0. I get a strange error when knitting this R Markdown  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Comments
  • Shouldn't the code for count be count(dataset, Nationality)?
  • It works! Thanks. Strangely before it accepted the dataset$Nationality format.
  • @thixio Upvote and accept my answer if you think it is useful so that others know this is the right answer, thanks!