TeX - LaTeX Asked by Pawel on August 20, 2020
I am using latex to automate reports. In R, I create a data frame that contains all of the metrics and then using Sexpr
I filter that data frame for a specific metric. Currently, I have this:
Sexpr{df$var1[df$var2 == 'metric1']}
Is it possible to save “metric1” as a variable so that in each section I can just call it once?
For example:
foo1 = metric1
Sexpr{df$var1[df$var2 == foo1]}
I think you simply need to quote what you're doing. You can do something like:
<<mycodechunk>>=
foo1 = "metric1"
@
Then somewhere in the Sweave document:
Sexpr{df$var1[df$var2 == foo1]}
or probably:
Sexpr{df$var1[df$var2 == foo1,]}
Answered by John M on August 20, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP