I am knitting a code below in R Markdown (I work on ESS9 data: https://www.europeansocialsurvey.org/data/download.html?r=9)
ess$social_trust<-rowSums(select(ess, ppltrst, pplfair, pplhlp), na.rm=TRUE)
tapply(ess$social_trust, ess$gndr, dfSummary)
tapply(ess$social_trust, ess$gndr, freq)`
The code works while being run manually (also in a separate R document) but after knitting (both to pdf and HTML) I receive such errors:
tapply(ess$social_trust, ess$gndr, dfSummary)
## X[[i]] was converted to a data frame
## X[[i]] was converted to a data frame
## x must either be a summarytools object created with freq(), descr(), or a list of summarytools objects created using by()
tapply(ess$social_trust, ess$gndr, freq)
## x must either be a summarytools object created with freq(), descr(), or a list of summarytools objects created using by()
The solution proposed here doesn't work.
I will be grateful for your support!