• Register
0 votes

Problem :

I want to select some columns from my data frame by the use of below code:


dv %>% select(LGA)

select(dv, LGA)

Both of them are failing with below error :

Unable to find an inherited method for function ‘select’ for signature ‘"data.frame"’

But my following code gives me desired output :

dplyr::select(dv, LGA)

Is there a confliction in packages?

My all libraries imported are as below:










I' am very new to R, so need guidance in resolving the problems like this?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

When you call select, R will searche through the "search path" and will matche the first function called select. And when you try to call dplyr::select then you are calling it directly from the namespace dplyr so the function will work as expected.

Below is an example using conflicted. We will try to load the raster and dplyr, here both of them have a select function.

d <- data.frame(a = 1:10, b = 1:10)

Now when we try to call select we will be prompted with the exact conflict:

> select(d, a)

Error: [conflicted] `select` found in 2 packages.
Either pick the one you want with `::` 
* raster::select
* dplyr::select
Or declare a preference with `conflict_prefer()`
* conflict_prefer("select", "raster")
* conflict_prefer("select", "dplyr")
9 7 4
38,600 points

Related questions

0 votes
1 answer 1.4K views
Problem : When ever i use the predict glmnet function i get the below mentioned error error in cbind2(1, newx) %*% nbeta : not-yet-implemented method for <data.frame> %*% <dgcmatrix>
asked Nov 12, 2019 peterlaw 6.9k points
0 votes
1 answer 19 views
Problem what is the function in r to get the # of observations in a data frame ?
asked Feb 9 charles mathews 3.9k points
0 votes
1 answer 1.3K views
Problem : I need answer to bellow issue don't know how to automatically pick scale for object of type data.frame. defaulting to continuous.
asked Nov 7, 2019 peterlaw 6.9k points
0 votes
2 answers 1.1K views
Problem : How to solve the below error, I will first show an example of the data file. My Data file: col1  col2    col3 1     2       3 1     2       3 5     6       7 My R code: read.table("mydemo.txt", header = TRUE, sep = "\t", row.names = "a") My Output ... In read.table(file = file, header = header, sep = sep, quote = quote,  : incomplete final line found by readTableHeader on '../mydemo.txt'
asked Jan 17, 2020 jwilliam 3.9k points
0 votes
1 answer 2.2K views
Problem : I have been facing below error message and traceback: Error in FUN(X[[i]], ...) : only defined on the data frame with all numeric variables 5 stop("only defined on the data frame with all numeric variables") 4 FUN(X[[i]], ...) 3 lapply(args, ... .numeric(data[good,]) But now I get the different error message back as below : "Error: (list) object cannot be coerced to type 'double'"
asked Dec 16, 2019 alecxe 7.5k points
0 votes
2 answers 1.5K views
Problem : I am facing below error and I am unable to understand the meaning of the error. All my variable names are correct and there are no typing errors. Does anybody faced this issue before any solution on it? My erroneous code : datNewagg <- aggregate (dataNew, by = ... mean) It gives following error : Error in aggregate.data.frame(datNew, by = list("x", "y", : arguments must have same length
asked Dec 6, 2019 alecxe 7.5k points
0 votes
1 answer 265 views
Problem : I want to use the TraMineR's (version 1.8.4) seqdef-funciton to define the sequence object, however I always face the following error message which is completely senseless to me: Error in row.names<-.data.frame(*tmp*, value = value) : invalid 'row. ... tried running it after re-labeling the states without "-", but it does not affect the error. Does someone knows what causes this error?
asked Dec 6, 2019 alecxe 7.5k points
0 votes
1 answer 67 views
Problem : Getting following error related to r error in `row.names<-.data.frame`(`*tmp*`, value = value) : duplicate 'row.names' are not allowed
asked Nov 11, 2019 peterlaw 6.9k points
1 vote
1 answer 105 views
Problem : I am very new to the php as well as the wordpress but because of some reason I had to work with the wordpress only. So just to begin that I refered the tutorial and created the wordpress theme of my own and after that I simply tried to ... my upload_max_filesize, post_max_size and memory_limit as well still I am facing the same error.Please note : Currently I am using Wordpress 3.5.2.
asked Dec 28, 2019 alecxe 7.5k points
0 votes
1 answer 13 views
Problem: attempt to select less than one element in integeroneindex.
asked Feb 18 charles mathews 3.9k points