rmarkdown error attempt to use zero-length variable name
Putting this as an answer for visibility: this happens if you try to run by selecting all in the Rmd and pressing enter like you would with a normal R script. RStudio tries to run this all as R code, including the markdown parts, leading to the errors you saw.
You can avoid this by running an individual chunk by clicking the green play button or by selecting one of the run options in the dropdown at the top of the Rmd editor.
R: attempt to use zero-length variable name in filter.data.frame
The error is because of column names with NA
values. You can either remove them.
library(dplyr)
qb_stats_all <- qb_stats_all %>%
select(-num, -(28:32)) %>%
filter(player != 'Player')
Or rename them to give them any appropriate column name.
names(qb_stats_all)[28:32] <- paste0('col', 1:5)
qb_stats_all <- qb_stats_all %>% filter(player != 'Player')
Unexplained R failure: Error: attempt to use zero-length variable name
The error message makes it look as though you are trying to evaluate the chunk header as R code. You had
```{r figure_3_3_1, fig.height=jobs_levels}
The first two backticks would be parsed as a zero length variable name, as the error message states.
You can't run R Markdown code as R code, you need to use rmarkdown::render
or a related function to run it.
Related Topics
How to Create a List in R from Two Vectors (One Would Be the Keys, the Other the Values)
R How to Extract First Row of Each Matrix Within a List
Access Data.Table Columns with Strings
Plotting Functions on Top of Datapoints in R
Create All Possible Combiations of 0,1, or 2 "1"S of a Binary Vector of Length N
What Are the Caveats of Using Source Versus Parse & Eval
Model Matrix with All Pairwise Interactions Between Columns
Shiny R - Download the Result of a Table
Clear Memory Allocated by R Session (Gc() Doesnt Help !)
Saving a Data Frame as a Binary File
Index Element from List in Rcpp
Create Polygon from Set of Points Distributed
R: How to Select Files in Directory Which Satisfy Conditions Both on the Beginning and End of Name