Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
708 views
in Technique[技术] by (71.8m points)

r - Why am I getting the "'...' is not empty" error mostly when using pipe and basic functions?

I am very new to R but seem to be getting this error more and more frequently, especially when using the pipe operator:

"Error: ... is not empty. We detected these problematic arguments:

  • logical

These dots only exist to allow future extensions and should be empty.
Did you misspecify an argument?"

I even get it on simple functions like select as in:

HM_74_Duplicates_test <- HM_74_Duplicates %>%
  select(State)

HM_74_Duplicates is loaded as a data.frame, tidyverse is in library.

What am I doing wrong?

    HM74_1 <- read.csv("/Users/spencepurnell/Downloads/hm74_r - Base_Sheet.csv")

HM74_1 <- as.data.frame(HM74_1)

#Convert Appropriate Metrics to Numeric
HM74_1$Total.Interstate <- as.numeric(gsub(",","", HM74_1$Total.Interstate))
HM74_1$Total.OFE <- as.numeric(gsub(",","", HM74_1$Total.OFE))
HM74_1$Total.OPA <- as.numeric(gsub(",","", HM74_1$Total.OPA))
HM74_1$Total.Arterial..Minor. <- as.numeric(gsub(",","", HM74_1$Total.Arterial..Minor.))

#Creates new True/False column for duplicate variables where TRUE = DUPLICATE 
HM74_1 <- HM74_1 %>% 
  group_by(Federal.Area) %>%
  mutate(duplicate.flag = n() > 1) %>% 
  ungroup()  

#Creates df of duplicates using new TRUE/FAlSE column
HM_74_Duplicates <- HM74_1 %>%
  filter(duplicate.flag == TRUE) 

#Duplicates as data.frame
HM_74_Duplicates <- as.data.frame(HM_74_Duplicates)

#Select State
HM_74_Duplicates_Test <- HM_74_Duplicates %>%
  select(State)

#dput
dput(HM_74_Duplicates)

Here is the output from dput:

structure(list(Federal.Area = structure(c(10L, 10L, 29L, 29L, 
42L, 42L, 46L, 46L, 55L, 55L, 60L, 60L, 69L, 69L, 80L, 80L, 82L, 
82L, 84L, 84L, 86L, 86L, 86L, 87L, 87L, 95L, 95L, 104L, 104L, 
104L, 110L, 110L, 123L, 123L, 125L, 125L, 126L, 126L, 128L, 128L, 
134L, 134L, 132L, 132L, 138L, 138L, 142L, 142L, 144L, 144L, 153L, 
153L, 162L, 162L, 166L, 166L, 179L, 179L, 179L, 199L, 199L, 199L, 
222L, 222L, 226L, 226L, 231L, 231L, 251L, 251L, 264L, 264L, 286L, 
286L, 286L, 289L, 289L, 294L, 294L, 309L, 309L, 312L, 312L, 318L, 
318L, 318L, 322L, 322L, 328L, 328L, 336L, 336L, 338L, 338L, 341L, 
341L, 341L, 341L, 353L, 353L, 354L, 354L, 356L, 356L, 358L, 358L, 
381L, 381L, 411L, 411L, 411L, 414L, 414L, 420L, 420L, 426L, 426L, 
427L, 427L, 437L, 437L, 441L, 441L, 465L, 465L, 467L, 467L, 467L, 
473L, 473L, 473L, 477L, 477L, 487L, 487L, 491L, 491L), .Label = c("Aberdeen--Bel Air South--Bel Air North, MD", 
"Abilene, TX", "Aguadilla--Isabela--San Sebastian, PR", "Akron, OH", 
"Albany--Schenectady, NY", "Albany, GA", "Albany, OR", "Albuquerque, NM", 
"Alexandria, LA", "Allentown, PA--NJ", "Alton, IL--MO", "Altoona, PA", 
"Amarillo, TX", "Ames, IA", "Anchorage, AK", "Anderson, IN", 
"Anderson, SC", "Ann Arbor, MI", "Anniston--Oxford, AL", "Antioch, CA", 
"Appleton, WI", "Arecibo, PR", "Arroyo Grande--Grover Beach, CA", 
"Asheville, NC", "Athens-Clarke County, GA", "Atlanta, GA", "Atlantic City, NJ", 
"Auburn, AL", "Augusta-Richmond County, GA--SC", "Austin, TX", 
"Avondale--Goodyear, AZ", "Bakersfield, CA", "Baltimore, MD", 
"Bangor, ME", "Barnstable Town, MA", "Baton Rouge, LA", "Battle Creek, MI", 
"Bay City, MI", "Beaumont, TX", "Beckley, WV", "Bellingham, WA", 
"Beloit, WI--IL", "Bend, OR", "Benton Harbor--St. Joseph--Fair Plain, MI", 
"Billings, MT", "Binghamton, NY--PA", "Birmingham, AL", "Bismarck, ND", 
"Blacksburg, VA", "Bloomington--Normal, IL", "Bloomington, IN", 
"Bloomsburg--Berwick, PA", "Boise City, ID", "Bonita Springs, FL", 
"Boston, MA--NH--RI", "Boulder, CO", "Bowling Green, KY", "Bremerton, WA", 
"Bridgeport--Stamford, CT--NY", "Bristol--Bristol, TN--VA", "Brownsville, TX", 
"Brunswick, GA", "Buffalo, NY", "Burlington, NC", "Burlington, VT", 
"Camarillo, CA", "Canton, OH", "Cape Coral, FL", "Cape Girardeau, MO--IL", 
"Carbondale, IL", "Carson City, NV", "Cartersville, GA", "Casa Grande, AZ", 
"Casper, WY", "Cedar Rapids, IA", "Chambersburg, PA", "Champaign, IL", 
"Charleston--North Charleston, SC", "Charleston, WV", "Charlotte, NC--SC", 
"Charlottesville, VA", "Chattanooga, TN--GA", "Cheyenne, WY", 
"Chicago, IL--IN", "Chico, CA", "Cincinnati, OH--KY--IN", "Clarksville, TN--KY", 
"Cleveland, OH", "Cleveland, TN", "Coeur d'Alene, ID", "College Station--Bryan, TX", 
"Colorado Springs, CO", "Columbia, MO", "Columbia, SC", "Columbus, GA--AL", 
"Columbus, IN", "Columbus, OH", "Concord, CA", "Concord, NC", 
"Conroe--The Woodlands, TX", "Conway, AR", "Corpus Christi, TX", 
"Corvallis, OR", "Cumberland, MD--WV--PA", "Dallas--Fort Worth--Arlington, TX", 
"Dalton, GA", "Danbury, CT--NY", "Danville, IL", "Daphne--Fairhope, AL", 
"Davenport, IA--IL", "Davis, CA", "Dayton, OH", "Decatur, AL", 
"Decatur, IL", "DeKalb, IL", "Delano, CA", "Deltona, FL", "Denton--Lewisville, TX", 
"Denver--Aurora, CO", "Des Moines, IA", "Detroit, MI", "Dothan, AL", 
"Dover--Rochester, NH--ME", "Dover, DE", "Dubuque, IA--IL", "Duluth, MN--WI", 
"Durham, NC", "East Stroudsburg, PA--NJ", "Eau Claire, WI", "El Centro--Calexico, CA", 
"El Paso de Robles (Paso Robles)--Atascadero, CA", "El Paso, TX--NM", 
"Elizabethtown--Radcliff, KY", "Elkhart, IN--MI", "Elmira, NY", 
"Erie, PA", "Eugene, OR", "Evansville, IN--KY", "Fairbanks, AK", 
"Fairfield, CA", "Fajardo, PR", "Fargo, ND--MN", "Farmington, NM", 
"Fayetteville--Springdale--Rogers, AR--MO", "Fayetteville, NC", 
"Flagstaff, AZ", "Flint, MI", "Florence, AL", "Florence, SC", 
"Florida--Imbery--Barceloneta, PR", "Fond du Lac, WI", "Fort Collins, CO", 
"Fort Smith, AR--OK", "Fort Walton Beach--Navarre--Wright, FL", 
"Fort Wayne, IN", "Frederick, MD", "Fredericksburg, VA", "Fresno, CA", 
"Gadsden, AL", "Gainesville, FL", "Gainesville, GA", "Gastonia, NC--SC", 
"Gilroy--Morgan Hill, CA", "Glens Falls, NY", "Goldsboro, NC", 
"Grand Forks, ND--MN", "Grand Island, NE", "Grand Junction, CO", 
"Grand Rapids, MI", "Grants Pass, OR", "Great Falls, MT", "Greeley, CO", 
"Green Bay, WI", "Greensboro, NC", "Greenville, NC", "Greenville, SC", 
"Guayama, PR", "Gulfport, MS", "Hagerstown, MD--WV--PA", "Hammond, LA", 
"Hanford, CA", "Hanover, PA", "Harlingen, TX", "Harrisburg, PA", 
"Harrisonburg, VA", "Hartford, CT", "Hattiesburg, MS", "Hazleton, PA", 
"Hemet, CA", "Hickory, NC", "High Point, NC", "Hilton Head Island, SC", 
"Hinesville, GA", "Holland, MI", "Homosassa Springs--Beverly Hills--Citrus Springs, FL", 
"Hot Springs, AR", "Houma, LA", "Houston, TX", "Huntington, WV--KY--OH", 
"Huntsville, AL", "Idaho Falls, ID", "Indianapolis, IN", "Indio--Cathedral City, CA", 
"Iowa City, IA", "Ithaca, NY", "Jackson, MI", "Jackson, MS", 
"Jackson, TN", "Jacksonville, FL", "Jacksonville, NC", "Janesville, WI", 
"Jefferson City, MO", "Johnson City, TN", "Johnstown, PA", "Jonesboro, AR", 
"Joplin, MO", "Juana Diaz, PR", "Kahului, HI", "Kailua (Honolulu County)--Kaneohe, HI", 
"Kalamazoo, MI", "Kankakee, IL", "Kansas City, MO--KS", "Kennewick--Pasco, WA", 
"Kenosha, WI--IL", "Killeen, TX", "Kingsport, TN--VA", "Kingston, NY", 
"Kissimmee, FL", "Knoxville, TN", "Kokomo, IN", "La Crosse, WI--MN", 
"Lady Lake--The Villages, FL", "Lafayette--Louisville--Erie, CO", 
"Lafayette, IN", "Lafayette, LA", "Lake Charles, LA", "Lake Havasu City, AZ", 
"Lake Jackson--Angleton, TX", "Lakeland, FL", "Lancaster--Palmdale, CA", 
"Lancaster, PA", "Lansing, MI", "Laredo, TX", "Las Cruces, NM", 
"Las Vegas--Henderson, NV", "Lawrence, KS", "Lawton, OK", "Lebanon, PA", 
"Leesburg--Eustis--Tavares, FL", "Leominster--Fitchburg, MA", 
"Lewiston, ID--WA", "Lewiston, ME", "Lexington Park--California--Chesapeake Ranch Estates, MD", 
"Lexington-Fayette, KY", "Lima, OH", "Lincoln, NE", "Little Rock, AR", 
"Livermore, CA", "Lodi, CA", "Logan, UT", "Lompoc, CA", "Longmont, CO", 
"Longview, TX", "Longview, WA--OR", "Lorain--Elyria, OH", "Los Angeles--Long Beach--Anaheim, CA", 
"Los Lunas, NM", "Louisville/Jefferson County, KY--IN", "Lubbock, TX", 
"Lynchburg, VA", "Macon, GA", "Madera, CA", "Madison, WI", "Manchester, NH", 
"Mandeville--Covington, LA", "Manhattan, KS", "Mankato, MN", 
"Mansfield, OH", "Manteca, CA", "Marysville, WA", "Mauldin--Simpsonville, SC", 
"Mayagüez, PR", "McAllen, TX", "McKinney, TX", "Medford, OR", 
"Memphis, TN--MS--AR", "Merced, CA", "Miami, FL", "Michigan City--La Porte, IN--MI", 
"Middletown, OH", "Midland, MI", "Midland, TX", "Milwaukee, WI", 
"Minneapolis--St. Paul, MN--WI", "Mission Viejo--Lake Forest--San Clemente, CA", 
"Missoula, MT", "Mobile, AL", "Modesto, CA", "Monessen--California, PA", 
"Monroe, LA", "Monroe, MI", "Montgomery, AL

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

SOLUTION:

From rlang::last_trace() You can see the error is in line 27 in the package vctrs

   These dots only exist to allow future extensions and should be empty.
Did you misspecify an argument?
Backtrace:
     █
  1. └─joineddf %>% select(Apportioned)
  2.   ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3.   └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  4.     └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
  5.       └─`_fseq`(`_lhs`)
  6.         └─magrittr::freduce(value, `_function_list`)
  7.           ├─base::withVisible(function_list[[k]](value))
  8.           └─function_list[[k]](value)
  9.             ├─dplyr::select(., Apportioned)
 10.             └─dplyr:::select.data.frame(., Apportioned)
 11.               └─tidyselect::vars_select(tbl_vars(.data), !!!enquos(...))
 12.                 └─tidyselect:::eval_select_impl(...)
 13.                   ├─tidyselect:::with_subscript_errors(...)
 14.                   │ ├─base::tryCatch(...)
 15.                   │ │ └─base:::tryCatchList(expr, classes, parentenv, handlers)
 16.                   │ │   └─base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
 17.                   │ │     └─base:::doTryCatch(return(expr), name, parentenv, handler)
 18.                   │ └─tidyselect:::instrument_base_errors(expr)
 19.                   │   └─base::withCallingHandlers(...)
 20.                   └─tidyselect:::vars_select_eval(...)
 21.                     └─tidyselect:::walk_data_tree(expr, data_mask, context_mask)
 22.                       └─tidyselect:::eval_c(expr, data_mask, context_mask)
 23.                         └─tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
 24.                           └─tidyselect:::walk_data_tree(init, data_mask, context_mask)
 25.                             └─tidyselect:::as_indices_sel_impl(...)
 26.                               └─tidyselect:::as_indices_impl(x, vars, strict = strict)
 27.                                 └─vctrs::vec_as_subscript(x, logical = "error")
 28.                                   └─ellipsis::check_dots_empty()
 29.                                     └─ellipsis:::action_dots(...)

Tidyverse was installing a version of vctrs 0.2.99.99011 - a version I could not find anywhere on the web. What is causing this?

The solution is simply to manually install vctrs before tidyverse

install.packages("vctrs") library(vctrs)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...