Enter Manually

R uses vectors and data frames to store data. A data frame is two dimensional matrix that can contain all different types of data (categorical, ordinal, discrete numeral, continuous numeral, binary and free text). Each column (vertical) contains a variable and each row (horizontal) a case or patient.

To enter data manually, make sure the Data Viewer in JGR is open. If the Data Viewer is not visible, make the Console the active window and select from the menu bar: Packages & Data and then Data Viewer.

If no data are loaded, the Data Viewer looks like this:


Select the New Data Frame icon and give it a name (for example heights):input

(If a data frame is open, the data viewer will show that data frame. To create a new data frame, make sure the Data Viewer window is active and select File and then New Data from the menu bar).
This will create a new Data Set called heights:

datainputThere are two tabs: Data View and Variable View.
(The layout differs between Mac and Window distributions).

Select Variable View:


Change the default name Var1 to an appropriate name for the variable (for example height). Also define the type of data. The default of Logical can be changed to the following data types:

  1. Character (text)
  2. Factor (different groups, categorical variable)
  3. Double (double precision floating point, for decimal numbers)
  4. Integer (for integer numbers, discrete numeral data)
  5. Logical (a binary variable, true / false, yes / no etc)
  6. Date
  7. Time
  8. Other

For height data, the type should be ‘Double':datainput3

Select the Data View tab and the data can be entered. For example enter the following heights:


The Data Viewer should look like this:datainput4

You can now use the data for analysis. Selecting the Console will change the menu bar to perform statistical analysis, create plots etc.

To save the data frame, select the save data frame icon:saveand save the file with an appropriate name in an appropriate location. Select *.RDA (R DAta file) as the file format.

The data frame can also be saved by selecting File and then Save Data from the menu bar when the Data Viewer is the active window.

Data frames can be opened by selecting the open data frame icon:open dataframeManoeuvre to the appropriate file location, select the file and load the data.

A previously saved data frame can also be loaded by selecting File and then Save Data from the menu bar when the Data Viewer is the active window.


Advanced Users

Data can be entered directly as a vector in the console using the c command  and then create a data frame: