4

I'm new to R with a background using Stata.

I am wondering if there is a real-time browser to see how data changes after executing codes, much like the Data Browser in Stata.

I've consulted previous threads (e.g. https://stats.stackexchange.com/questions/11551/is-there-a-good-browser-viewer-to-see-an-r-dataset-rda-file) but have not found an answer to this.

Thanks.

Community
  • 1
  • 1
kquach
  • 161
  • 1
  • 10
  • Do you mean View in RStudio at any step of your code? That is a simple way to see what has changed. – lawyeR Feb 02 '15 at 20:34
  • The problem I find with View() is that I have to repeatedly run View(df) to see an updated version of my dataset. Am I doing something wrong or is this how View() works? Also, the View() occupies the same window as my .R file which is a bit annoying. – kquach Feb 02 '15 at 20:47
  • Are you using RStudio? You can click on the object in the upper right pane and it will display. Then you return to the console (Ctrl2) or to the scripting pane (Ctrl1). – lawyeR Feb 02 '15 at 20:49

2 Answers2

3

RStudio

RStudio Desktop version 0.99.441 now has robust data viewing and filtering options on par with Stata. If you download that version, you will now have the capabilities to filter and sort variables in ascending or descending order (either click on the object in the Environment to open up the Viewer or use the View() command on the console). From there, click on Filter to filter the variables, click on column names to sort, or click on the Pop-Out button immediately to the right of the Filter button to view the data in a separate windows, which can remain open while you manipulate the data in the console.

Base R

Unfortunately, R doesn't have the Stata equivalent to browse, which, allows you to view your data in a separate window and updates in real time, as you note. You will have to use RStudio to do this. Your options in base R are to use the edit() or fix() commands (with the name of your data frame placed inside the parentheses), which will bring up a browser of your data (that you can edit, if you'd like, or just look at) similar to the edit command in Stata, with the one caveat that you cannot input any commands in the R Console while the browser is open. If you'd like to have open a browser of your data while you simultaneously input commands in the console, you can use the View() command, but it is static: it will not update in real-time along with inputted commands.

coip
  • 1,312
  • 16
  • 30
  • Latest RStudio preview has a very robust data viewer. Your last sentence is in error. – hrbrmstr Feb 03 '15 at 00:52
  • Sorry for the confusion: the last sentence was in reference to RStudio, not base R. I've corrected the information. As for the latest RStudio preview having a more robust data viewer, I cannot comment on that as I don't use preview versions. I have the latest release version of RStudio and the `View()` command is limited to 1000 rows (which is not the case in R, so I've clarified that in my answer). – coip Feb 04 '15 at 01:23
3

A recent addition to the CRAN library that accommodates the OP's request is vtable.

More specifically, dftoHTML(DF) will bring the desired DF to the viewer window (live).

not2qubit
  • 14,531
  • 8
  • 95
  • 135
bpar
  • 383
  • 1
  • 15