I am trying to create an automated report of questionnaire responses in R Markdown for single respondents. In the top of the document (below a title and subtitle), I want to include a list with the name, birthdate and some other details (like specific average scores) of the respondent (the report will be sent to the respondent). However, these details are output from lines 170-175 in my R code. As I said, I would like to display this output at the top of the Markdown document.
For my purposes, I created a one-row dataframe, with all results for one respondent (participant number, name, birthday, average score x, average score z). I have already saved the output as values. E.g. AverageX <- my_data$averagex. Thus, a simple command like “Average” in R would yield this value.
The problem is, that this output is created later in the R document (ca line 170) and I want to display it at the top of my markdown document (ca. line 5). I have searched for similar problems in stackoverflow and other places, but unfortunately I cannot find others with the same problem and I do not know where to proceed from here. Any help would be greatly appreciated!
William is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.