1. Home
  2. Tools and Features
  3. Publishing to journal formats
  4. Generating reports from your research outputs

Generating reports from your research outputs

Workspaces offer users a simple way to generate output reports and documents as Latex or PDF formats.

A report script consists of LaTeX with optional embedded R code. To create a report script:

  • Navigate to the workspace where you want to create the script.
  • Click the ‘Add’ dropdown menu icon then select the 'New File' command, enter a filename and select 'R NoWeb file' (*.rnw) as the format.
  • You are taken to the editor page – enter the script content and save the file.
  • The new script is saved as a file in your workspace.

Editing a report script

When you navigate to the Files tab, you can see and filter all of the report scripts in the current workspace. To edit an existing report script:

  • Click the name of the report script you want to edit.
  • The content of the script is loaded into the text editor.
  • Make the required changes to the script.
  • Click the 'Save' button to save the changes to the script.

Alternatively you can save the altered script as a new version of the file; to do this, click the 'Save as' button.


Loading the ‘knitr’ library

To generate reports you must load the ‘knitr’ package. To do this:

  • Open an R console, if one is not already open.
  • Enter the command: ‘library(knitr)’
  • Press 'Return'

You can include this command in your ‘local.r‘ file, but note that changes to local.r apply only to subsequent sessions and do not affect an existing R console session.


Generating a report from a script

To generate a report from a script:

  • Navigate to the workspace containing the report script and go to the R Session tab.
  • Click 'Start console'.
  • In the right hand sidebar, under 'Files', hover over the report script you want to run.
  • Click the 'Run in console' button for the script. action button, grabbed on 19.01.17, using XAP version 1.19.1 2740-8759a, from https://analytixagility.aridhia.net/#/workspaces/58/rtools
  • Press the 'Return' key to process the script.

If the script runs successfully a new PDF report will be generated, with the name of the report (for example, Rreport000.pdf’) appearing in the Reports tab in the right-hand pane. NOTE: the xap.knit function will fail if the ‘knitr’ R package has not been loaded. See Loading the ‘knitr’ Library section above for details on how to load this package.


Viewing a generated report and optionally saving it to the workspace

After generating the report, its temporary name will appear in the Reports tab in the right-hand pane. Click on the name to:

  • view the report
  • rename the report
  • add a description of the report
  • save the report as a file


Making an image file available to a report script

xap.image, grabbed on 20.01.17, using XAP version 1.19.1 2740-8759a, from https://edcvaatest04.aridhiatest.net/#If you have an image file in your workspace, you can make it available when generating a report, for use in LaTeX, by using the function ‘xap.image’. You can do this in the R session at any time prior to generating the report, or within the .rnw file itself. This will automatically include the required image in the generated PDF report.

Updated on June 20, 2019

Was this article helpful?

Not the solution you were looking for?
Click the link below to submit a support ticket