Tutorial on Importing Data in R Commander
Recommended by 13 users
R is a statistical software package that allows data manipulation and for statistical modelling and graphics. It has R Commander which is a graphical user interface with menus to use in R. R Commander was developed by John Fox, from McMaster University, to make it easier for students to comprehend how software can be used to perform data analysis without the complications of learning commands
The R software must be installed on your computer in order to use R Commander. In order to function properly in windows system, the R commander must be run as an SDI (Single Document Interface).
The easiest form of data to import into R is a simple text file, and this will often be acceptable for problems of small or medium scale. In this post, let’s discuss about the method to import test data in R commander. In R, data can be entered by 2 methods: Manually and Importing. Let’s first look at the steps involved in importing data.
Steps to Import Data in R Commander:
Start R program by clicking on the R icon or R in the programs.
Open the R commander program. At the prompt, type ‘Rcmdr’ and press return. The R commander window will open up as shown below:
In the R menu click on Data–> Import Data –> From text file. The above steps will lead to a dialogue box as shown below:
- Chose a name for the new dataset.
- Specify the location of the text file in a local file system, importing the text file from the clipboard or importing it from a URL through the web.
- Specify the character type: Comma or Period.
Other ways to Import Data:
- Importing data from a SPSS Dataset
- Importing the data from a SAS xport file
- Importing data from the MiniTab dataset
- Importing data from Excel, access, or other database.
R provides an option to import data in such variable formats. Once imported, you can start your analysis based on it.
Inputting Data Manually in Rcmdr:
- One way to input data is to do it manually. We need to remember that when naming, the name cannot have any spaces in it and also that it’s case sensitive.
- The data is manually inputted by entering the values column-wise, as shown below.
- The variables can be defined by clicking on the column label and then in the resulting dialog box, enter the name and type. Here, the type can be numeric or character. on the x in the right hand corner to close this dialog.
- Save the entered data by clicking on the ‘X’ on the right hand corner of the dialog box.
The column names can be changed as per the dataset. For example in the below pic, we have customized the column name as ‘custId.’
The column name is set on closing the ‘Variable editor’ window after entering the variable name. Once saved, this dataset becomes an ‘Active dataset.’ (Active dataset is the dataset which is being currently processed in R commander.)
It is not always possible to enter data manually and also the data might not be available in hand all the time. This is true in places where the data is present at an external location or is huge in volume. Considering the aspects of such data that needs to be analysed, the option to export data from another location is only practical and very necessary.