创建 Tibble 时出现未使用的参数错误 table
Unused argument error when creating a Tibble table
我正在处理这些数据:
library("RCurl")
library("plm")
library("tibble")
library("dplyr")
library("car")
library("AER")
library("arm")
library("broom")
x <- getURL("https://raw.githubusercontent.com/dothemathonthatone/maps/master/main_merge1.csv")
maindf <- read.csv(text = x)
我正在尝试做一些非常简单的事情:
data <- maindf %>% as_tibble() %>% select(reg_schl, year, age_group, fee_monthly, daily_hours, fee_per_inc, deubthrt_total) %>% print()
我收到以下错误:
Error in select(., reg_schl, year, age_group, fee_monthly, daily_hours, : unused arguments (reg_schl, year, age_group, fee_monthly, daily_hours, fee_per_inc, deubthrt_total)
Traceback:
1. maindf %>% as_tibble() %>% select(reg_schl, year, age_group,
. fee_monthly, daily_hours, fee_per_inc, deubthrt_total) %>%
. print()
2. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. eval(quote(`_fseq`(`_lhs`)), env, env)
4. eval(quote(`_fseq`(`_lhs`)), env, env)
5. `_fseq`(`_lhs`)
6. freduce(value, `_function_list`)
7. function_list[[i]](value)
所以我使用 R 数据尝试了相同的代码:
data(Fatalities, package = "AER")
road <- Fatalities %>%
as_tibble() %>%
select(state, year, beertax, fatal, pop) %>%
print()
我也遇到了同样的错误。
加载 library(ARM)
时,您应该会看到以下消息:
Loading required package: MASS
Attaching package: ‘MASS’
The following object is masked from ‘package:dplyr’:
select
这意味着当您调用 select
时,您使用的是 MASS::select
而不是 dplyr::select
相反,您可以显式 运行:
maindf %>% as_tibble() %>%
dplyr::select(reg_schl, year, age_group, fee_monthly, daily_hours,
fee_per_inc, deubthrt_total)
MASS::select
和 dplyr::select
之间的冲突很常见。您还可以重新定义 select 以使用 dplyr::select
,使用:select <- dplyr::select
以节省一些输入。
我正在处理这些数据:
library("RCurl")
library("plm")
library("tibble")
library("dplyr")
library("car")
library("AER")
library("arm")
library("broom")
x <- getURL("https://raw.githubusercontent.com/dothemathonthatone/maps/master/main_merge1.csv")
maindf <- read.csv(text = x)
我正在尝试做一些非常简单的事情:
data <- maindf %>% as_tibble() %>% select(reg_schl, year, age_group, fee_monthly, daily_hours, fee_per_inc, deubthrt_total) %>% print()
我收到以下错误:
Error in select(., reg_schl, year, age_group, fee_monthly, daily_hours, : unused arguments (reg_schl, year, age_group, fee_monthly, daily_hours, fee_per_inc, deubthrt_total)
Traceback:
1. maindf %>% as_tibble() %>% select(reg_schl, year, age_group,
. fee_monthly, daily_hours, fee_per_inc, deubthrt_total) %>%
. print()
2. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. eval(quote(`_fseq`(`_lhs`)), env, env)
4. eval(quote(`_fseq`(`_lhs`)), env, env)
5. `_fseq`(`_lhs`)
6. freduce(value, `_function_list`)
7. function_list[[i]](value)
所以我使用 R 数据尝试了相同的代码:
data(Fatalities, package = "AER")
road <- Fatalities %>%
as_tibble() %>%
select(state, year, beertax, fatal, pop) %>%
print()
我也遇到了同样的错误。
加载 library(ARM)
时,您应该会看到以下消息:
Loading required package: MASS
Attaching package: ‘MASS’
The following object is masked from ‘package:dplyr’:
select
这意味着当您调用 select
时,您使用的是 MASS::select
而不是 dplyr::select
相反,您可以显式 运行:
maindf %>% as_tibble() %>%
dplyr::select(reg_schl, year, age_group, fee_monthly, daily_hours,
fee_per_inc, deubthrt_total)
MASS::select
和 dplyr::select
之间的冲突很常见。您还可以重新定义 select 以使用 dplyr::select
,使用:select <- dplyr::select
以节省一些输入。