How to Use Quantile Plots to Check Data Normality in R
How to Reduce the Number of Lines in R
How to Install and Configure RStudio

How to Enter Data into the R Text Editor

Although R is primarily a programming language, R has a very basic data editor that allows you to enter data directly using the edit() function.

The edit() function is only available in some R code editors, so depending on which software you’re using to edit your R code, this approach may not work. As of this writing, this option is not yet supported by RStudio.

To use the R text editor, first you need to initiate a variable. For example, to create a data frame and manually enter some of the periodic table data, enter the following:

elements <- data.frame()
elements <- edit(elements)

This displays an interactive editor where you can enter data. Notice that because the data frame is empty, you can scroll left and right, or up and down, to extend the editing range. Notice also that the editor doesn’t allow you to modify column or row names.


Enter some data. Then to save your work, click the X in the top-right corner.

To view the details that you’ve just entered, use the print() function:

> print(elements)
 var1   var2 var3
1  1 Hydrogen  H
2  2  Helium  He
3  3 Lithium  Li
  • Add a Comment
  • Print
  • Share
blog comments powered by Disqus
How to Dispatch to a Method in R
How to Test Data Normality Graphically in R
How to Split Strings in R
How to Save Graphics to an Image File in R
How to Substitute Text in R