## Not run:
# --------------------------------------------------------------------------------------------------
#
# These examples require Essentia to be installed:
#
# fullexec <- essQuery("ess exec", "echo -e '11,12,13\n4,5,6\n7,8,9' ","#-notitle")
# print(fullexec)
# defaultexec <- essQuery("echo -e '11,12,13\n4,5,6\n7,8,9' ","#-notitle")
# print(defaultexec)
# essQuery("echo -e '11,12,13\n4,5,6\n7,8,9' ","#Rignore")
# print("This last statement is ignored by R and just executed on the command line.")
#
# --------------------------------------------------------------------------------------------------
#
# This example requires Essentia to have selected a datastore containing purchase log data:
#
# command1 <- essQuery("ess query","select count(refID) from purchase:2014-09-01:2014-09-15 \
# where articleID>=46 group by price","#Rinclude")
# command2 <- essQuery("ess query", "select count(distinct userID) from \
# purchase:2014-09-01:2014-09-15 where articleID>=46", "#Rinclude")
# command3 <- essQuery("ess query", "select count(refID) from \
# purchase:2014-09-01:2014-09-15 where articleID>=46 group by userID", "#Rinclude")
# querystream <- essQuery("ess query", "select * from purchase:*:* where articleID <= 20", "\
# #Rinclude #-notitle")
#
# Then run these commands to view the saved dataframes:
#
# print(command1)
# print(command2)
# print(command3)
# print(querystream)
#
# --------------------------------------------------------------------------------------------------
#
# The following example requires Essentia to be installed with apache log data stored in it:
#
# # Query the Essentia database logsapache3 and return the contents of vector3 into R.
# command1 <- essQuery("aq_udb -exp logsapache3:vector3", "--debug")
#
# # Query the Essentia database logsapache1 and return the sorted contents of vector1 into R.
# command2 <- essQuery("ess exec", "aq_udb -exp logsapache1:vector1 -sort pagecount -dec", "\
# --debug")
#
# # Stream the last five lines of the file in category 125accesslogs between dates 2014-12-07 and
# # 2014-12-07, convert them to csv, return them to R, and store them into an R dataframe singlefile.
# singlefile <- essQuery("ess stream 125accesslogs '2014-12-07' '2014-12-07'","tail -5 \
# | logcnv -f,eok - -d ip:ip sep:' ' s:rlog sep:' ' s:rusr sep:' [' i,tim:time sep:'] \\"' \
# s,clf:req_line1 sep:' ' s,clf:req_line2 sep:' ' s,clf:req_line3 sep:'\\" ' i:res_status sep:' ' \
# i:res_size sep:' \\"' s,clf:referrer sep:'\\" \\"' \
# s,clf:user_agent sep:'\\"' X | cat -","#Rinclude")
#
# # Stream the last five lines of the files in category 125accesslogs between dates 2014-11-30 and
# # 2014-12-07, convert them to csv, and save them into R dataframes apachefiles1 and apachefiles2.
# essQuery("ess stream 125accesslogs '2014-11-30' '2014-12-07'","tail -5 \
# | logcnv -f,eok - -d ip:ip sep:' ' s:rlog sep:' ' s:rusr sep:' [' i,tim:time sep:'] \\"' \
# s,clf:req_line1 sep:' ' s,clf:req_line2 sep:' ' s,clf:req_line3 sep:'\\" ' i:res_status sep:' ' \
# i:res_size sep:' \\"' s,clf:referrer sep:'\\" \\"' \
# s,clf:user_agent sep:'\\"' X -notitle | cat -","\
# #Rinclude #R#apachefiles#R# #Rseparate")
#
# print(command1)
# print(command2)
# print(singlefile)
# print(apachefiles1)
# print(apachefiles2)
#
# The references contain more extensive examples that
# fully walkthrough how to load and query the Essentia Database.
# ## End(Not run)
Run the code above in your browser using DataLab