当我尝试编织以下文件时:
我收到以下错误信息
这是NASA_Launch_Data.csv中数据的开头:
----
title: "jerHW52"
output: html_document
params:
missiontype: "Successful.Unmanned"
---
```{r warning=FALSE,echo=FALSE}
knitr::opts_chunk$set(echo=FALSE)
library(tidyr)
library(ggplot2)
Launch_Data<-read.csv("NASA_Launch_Data.csv",header=TRUE)
NASA_Launch_Data<- Launch_Data %>% filter(Launch_Data$Type==params$missiontype)
ggplot(NASA_Launch_Data, aes(x=Year, y=Missions)) + geom_line()
```
我收到以下错误信息
为什么无法找到params?Error in filter(., Launch_Data$Type == params$missiontype) : object 'params' not found Calls: ... _fseq -> freduce -> withVisible -> -> filter Execution halted
这是NASA_Launch_Data.csv中数据的开头:
"","Year","Type","Missions"
"1",1957,"Successful.Unmanned",3
"2",1958,"Successful.Unmanned",28
"3",1959,"Successful.Unmanned",23
"4",1960,"Successful.Unmanned",40
"5",1961,"Successful.Unmanned",48
"6",1962,"Successful.Unmanned",76
"7",1963,"Successful.Unmanned",67
"8",1964,"Successful.Unmanned",99
"9",1965,"Successful.Unmanned",119
"10",1966,"Successful.Unmanned",129
NASA_Launch_Data.csv
的一些示例数据会很有用。但是看起来您正在错误地使用filter
,正如消息所说,根本没有名为params
的对象。如果有一个名为Type
的列,请直接使用该名称,而不是Launch_Data$Type
。是否存在名为params
或missiontype
的列? - neilfwsparams
的使用。 - neilfws