Closed remlapmot closed 4 years ago
Thanks for the comment. Sounds like my example has not kept up with changes in knitr and in my code – I’ll have a look.
From: Tom Palmer notifications@github.com Sent: Thursday, October 15, 2020 7:45 AM To: Hemken/Statamarkdown Statamarkdown@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Hemken/Statamarkdown] possible typo in commented out code in find_stata() helpfile example (#11)
I was wondering if there might be a small typo in the commented out code in the example on the helpfile for find_stata().
On the line herehttps://github.com/Hemken/Statamarkdown/blob/89ff92fa593c890c8fcb1714c0b10dae0ddbea72/man/find_stata.Rd#L38 should #engine.path=stataexe, be replaced with #engine.path = list(stata = stataexe) (as per your code in the Basic Use vignette) for the code to run when not commented out?
When I save the example Rmd code as a separate file and delete the 2 engine.path=stataexe chunk options and click the Knit button in RStudio the current code fails with an error message
Error: $ operator is invalid for atomic vectors
Execution halted
but with the edit it runs.
i.e. edited version is
indoc <- '
library(Statamarkdown)
stataexe <- find_stata()
knitr::opts_chunk$set(engine="stata", engine.path = list(stata = stataexe),
error=TRUE, cleanlog=TRUE, comment=NA)
sysuse auto, clear
generate gpm = 1/mpg
summarize price gpm
regress price gpm
'
fmd <- file.path(tempdir(), "test.md")
fhtml <- file.path(tempdir(), "test.html")
knitr::knit(text=indoc, output=fmd)
markdown::markdownToHTML(fmd, fhtml)
Happy to make a PR if that's easier.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/Hemken/Statamarkdown/issues/11, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACYBME264E7F7TEFDKHH24DSK3VETANCNFSM4SR6DVYA.
I've incorporated Tom's fix.
I was wondering if there might be a small typo in the commented out code in the example on the helpfile for
find_stata()
.On the line here should
#engine.path=stataexe,
be replaced with#engine.path = list(stata = stataexe)
(as per your code in the Basic Use vignette) for the code to run when not commented out?When I save the example Rmd code as a separate file and delete the 2
engine.path=stataexe
chunk options and click theKnit
button in RStudio the current code fails with an error messagebut with the edit it runs.
i.e. edited version is
Then mark Stata code chunks with
A later chunk that depends on the first.
'
To run this example, remove tempdir().
fmd <- file.path(tempdir(), "test.md") fhtml <- file.path(tempdir(), "test.html")
knitr::knit(text=indoc, output=fmd) markdown::markdownToHTML(fmd, fhtml)