Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending Rstudio view() content to different pane

Using Rstudio, I am attempting to display a dataFrame using the View() command. The command automatically sends the output to the 'Source' quadrant.

Is there any way to send it instead to either the "Workspace" quandrant or the "Files,Plots..." quadrant? Here is my code:

qRows <- data.frame( RowQuery = character(0), "BackTest P&L" = character(0), stringsAsFactors=FALSE)
qRows[nrow(qRows) + 1, ] <- c("@sp500(vwpc) | rsi(30) | qcume",  "12%")
View(qRows)
like image 401
PaeneInsula Avatar asked Jan 21 '16 06:01

PaeneInsula


1 Answers

to display a data frame in the "Files,Plots..." quadrant (Viewer) use the DT package:

if (!require("DT")) devtools::install_github("rstudio/DT")
datatable(qRows)

all those commands will open it in a separate window:

  1. new window where you can edit data; whet it open you can't code in console and run the code from code editor; after closing window all info from table will be displayed into console
edit(qRows)
  1. like in point 1, but without displaying info into console after closing the window
invisible(edit(qRows))

or

data.entry(qRows)
  1. like in point 2, but you can't edit info into this window and you can use the console
utils::View(qRows)

R Package googleVis can send your table to browser:

if (!require("googleVis")) devtools::install_github("rstudio/googleVis")
plot(gvisTable(qRows))

knitr/RMarkdown can send your dataframe to html/pdf/doc/slides etc; you will create a beautiful table in console or markdown issued file with:

if (!require("knitr")) devtools::install_github("rstudio/knitr")
knitr::kable(qRows) 
like image 147
Kathrine Makhnatch Avatar answered Sep 21 '22 17:09

Kathrine Makhnatch