Concerto Simple Demonstration Test v4.b
R-bloggers 2013-05-02
(This article was first published on Econometrics by Simulation, and kindly contributed to R-bloggers)
# This is my first attempt to post a example of a test using Concerto 4 beta. # See Simple Test # This is an extremely simple test. Too simple to be useful to most people yet I believe it is didactically helpful. The Following is the HTML code for Template 9. It is the form that the user first inputs answers to the three questions. <p>Please Answer:</p> <!--This displays each question. The important thing to notice is the name of each text box, txt_1, txt_2, and txt_3--> <p>1. 1+1=<input name="txt_1" type="text" /></p> <p>2. 2+2=<input name="txt_2" type="text" /></p> <p>3. 3+3=<input name="txt_3" type="text" /></p> <p><input name="done" type="button" value="done" /></p>
The Following is the HTML code for Template 10. It is the form that the user receives feedback from. <p>You got questions:</p> <!-- Notice the values in {{}}. These are the parameters passed to this template --> <p>1. {{score1}}</p> <p>2. {{score2}}</p> <p>3. {{score3}}</p>
# The Following is the R code that the test actually uses to run. # We can see how R controls the flow of the user interface. # Concerto Simple Test 1 # We call template 9 to be shown. items = concerto.template.show(9) # Check if the items results are correct. We can see that the responses to the items from the first template are saved within the list object item with the names txt_1, txt_2, and txt_3. TF1 = items$txt_1==2 TF2 = items$txt_2==4 TF3 = items$txt_3==6 # Show the results to the user by feeding our item values as parameters back into the second template. concerto.template.show(10, params=list(score1=TF1, score2=TF2, score3=TF3)) # I hope this gives you a feel for how easy it is to use Concerto to handle web based inputs. # A powerful feature of Concerto is that it has functions that and query and modify tables using My SQL. # More in future posts. # I used an HTML encoder to translate my html code to post into blogger.
To leave a comment for the author, please follow the link and comment on his blog: Econometrics by Simulation.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series,ecdf, trading) and more...