Error when Knitr

I have two questions,
I am new to R and was using dplyr to summarize my data. below is my code but I think I used a long method, it could be shorter.

Workingdata <-  select(cSVDATA, current_reading_type,consumption, bill,region_name, date,
                                   custtype,anonid, groups, year, billmonth ) 
 
 #Table 1 of summary statistics
 UniqueID <- Workingdata %>% group_by(groups) %>% count(anonid, name = "Frequency")
 FrequencyT <- UniqueID %>%  group_by (groups) %>% summarise(Frequency = sum(Frequency))
 Anonid <- UniqueID %>%  group_by(groups) %>% tally(name = "customers")
 output2 <- left_join(Anonid,FrequencyT, by = "groups")
 print(output2)

Now, after getting my code right, I keep getting this error when knitting. Please note I have other codes before this and a bib file (I am writing a manuscript). See my knit error:

Quitting from lines 59-99 (Manuscript28thApril.Rmd) 
Error in select(cSVDATA, current_reading_type, consumption, bill, region_name,  : 
  unused arguments (current_reading_type, consumption, bill, region_name, date, custtype, anonid, groups, year, billmonth)
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
In addition: Warning messages:
1: package 'ggplot2' was built under R version 4.0.5 
2: package 'ggpubr' was built under R version 4.0.5 
3: package 'broom' was built under R version 4.0.5 
4: package 'AICcmodavg' was built under R version 4.0.5 
5: package 'dplyr' was built under R version 4.0.5 
6: package 'multcomp' was built under R version 4.0.5 
7: package 'TH.data' was built under R version 4.0.5 
8: package 'MASS' was built under R version 4.0.5 
9: package 'tibble' was built under R version 4.0.5 
10: package 'tidyr' was built under R version 4.0.5 
Execution halted

It looks like you may have the name of the data.frame in the select statement.

Assuming your data is cSVDATA does this work?

Workingdata <- cSVDATA  %>%  select( current_reading_type,consumption, bill,region_name, date,
                                   custtype,anonid, groups, year, billmonth ) 

Otherwise we probably need a reproducible example (reprex)

About the warning messages, what is your version of R? The command sessionInfo() will give you that infrmation.

1 Like

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.