R Data Sets

From Q
Jump to: navigation, search

An R Data Set is a Data Set that is created using R. Refer to Data Sets for a discussion of other types of data that can be imported into Q.

How to use R to add data sets

  1. File > Data Sets > Add to Project > From R.
  2. Enter code for creating a Data Set into the R Code box. In the example below, an SPSS data file is being read in using the R function read.spss from the foreign package.
  3. Press F5. This will generate a preview of the Data Set's contents.
  4. Enter a Name (at the bottom of the screen).
  5. Press Add Data Set. Q will then take you through the normal process for setting up data, as if you had imported a data file.

RDataSet.PNG

When to use R Data Sets

In general, R Data Sets should not be used for importing data files that can be imported into Q via File > Data Sets > Add to Project > From File, as doing so will bypass a host of tools designed to check and correct problems in data.

The main use cases for R Data Sets are:

  1. Importing unusual types of data (e.g., web-scraping).
  2. Manipulating data prior to creating a data file (e.g., merging lots of data files).
  3. Having data sets that automatically update in dashboards (see Automatically Updating R DataSets, Variables, and Outputs).