# EXAMPLE #1
rsp(text="A random number in [1,100]: <%=sample(1:100, size=1)%>
")
# EXAMPLE #2
rsp(text="A random number in [1,100] (assigned to 'x' in the workspace): <%= x <- sample(1:100, size=1); %>
")
printf("The random number generated by the RSP document was: %d
", x)
# EXAMPLE #3
path <- system.file("doc", package="R.rsp")
pathname <- rsp("Dynamic_LaTeX_reports_with_RSP.tex.rsp", path=path)
printf("Created document: %s
", pathname)
Run the code above in your browser using DataLab