r - 继承错误(x,“tbl_df”):缺少参数“x”,没有默认值
问题描述
我正在尝试复制在 R 博客上发布的代码,但是我对数据有一些问题。
这是我下载的包:
# Load the necessary packages
# Tidyverse is our rock in data analysis (includes ggplot2)
if(!require("tidyverse")) install.packages("tidyverse")
# Janitor cleans data like the best janitor out there!
if(!require("janitor")) install.packages("janitor")
# ggsci has my favourite color palettes
if(!require("ggsci")) install.packages("ggsci")
# ggalt is necessary for the dumbbell chart
if(!require("ggalt")) install.packages("ggalt")
# ggtext allows for great text to include for charts
if(!require("ggtext")) install.packages("ggtext")
这是我的问题:
# Load the csv data file
df <- read_csv("WomenInGovernment_Data.csv")
──
Column specification ────────────────────────────────────────────────────────────────────────────────────────
cols(
.default = col_character()
)
ℹ Use `spec()` for the full column specifications.
Warning: 13 parsing failures.
row col expected actual file
33 -- 27 columns 1 columns 'WomenInGovernment_Data.csv'
64 -- 27 columns 1 columns 'WomenInGovernment_Data.csv'
65 -- 27 columns 1 columns 'WomenInGovernment_Data.csv'
78 -- 27 columns 1 columns 'WomenInGovernment_Data.csv'
91 -- 27 columns 1 columns 'WomenInGovernment_Data.csv'
... ... .......... ......... ............................
See problems(...) for more details.
> spec()
Error in inherits(x, "tbl_df") : argument "x" is missing, with no default
我从 GitHub 1下载数据作为 csv 文件。
解决方案
推荐阅读
- c - 出于演示目的,如何打印悬空指针?
- python - 类上的 Cycle() 函数
- html - Chrome 67 不会为我的 PWA 触发“beforeinstallprompt”
- javascript - 来自 ES6 类的 proto 继承
- ssh - 我错误地卸载了 OpenSSH 客户端。我怎样才能重新激活它?
- ios - 将从网站接收到的数据置于地图视图中
- javascript - 滚动时增加/减少变量
- python - PyQt:如何在另一个类中重用方法(def)?
- ios - 从 Firebase 打印出一些孩子
- python - 错误:失败:ModuleNotFoundError(没有名为“atoms”的模块)