Error coming in Rmd file while all the chunks are running perfectly

data<-read_excel("F:\\DATA ANALYSIS\\EXCEL SHEETS\\farms.xlsx")
colSums(is.na(data))

summary(data)

names(data)

data1<-subset(data,select=-c(id,hiredlabor,famlabor,region))

Error in parse(text = x, keep.source = TRUE) :
attempt to use zero-length variable name
Calls: -> -> getParseData -> parse
Execution halted

I'm going to assume, because of the lack of a reproducible example, called a reprex, that data is a data frame.

I can't tell if you want to include or exclude the fields in the c function. I'l assume include.

If you haven't already

install.packages('tidyverse')
library(tidyverse)

Then, to make data one

data1 <- data %>% select(id, hiredlabor,  farmlabor, region)

Use

head(data)

to make sure that they are all there and all correctly spelled case-sensitively.

If your spreadsheet has multiple tabs, consult the documentation for read_excel or export your sheet to csv format and use readr::read.csv to bring it into your workspace.

Please don't be discouraged; with experience, this will become second nature and the ease of manipulating data will more than make up for the initial hassle.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.