Copyright © 2011-2014 airxc.com, airxcell.com
Table of Contents
The Data Frame Editor module is used to manipulate data frames, view their content and edit their values. Unlike the Calculation Sheet module, the Data Frame Editor doesn't create the underlying data structure in the R environment. Instead it can be used to manipulate an existing Data Frame, created by other means. Data Frames form one of the most important data structure in R. Almost every high end and evolved R packages manipulated data as data frames.
The Data Frame Editor addresses one severe weakness of most R GUI by providing an intuitive and rich environment for viewing and editing data frames an adding on top of it the styling and formatting abilities usually found in spreadsheet software. The user can visualize and arrange the format (color, font, etc.) of the data frame values exactly the way she can on the Calculation Sheet module (5).
What should not than the Data Frame Editor module also allows the viewing and editing of timeseries of various classes (ts, zoo, xts, etc.)
A new Data Frame Editor can be added to the workspace by using Workspace → New Module → New Data Frame ()
A newly created Data Frame Editor looks as shown on Figure 8.1, “New Data Frame Editor”.
Data Frames are very powerful data structure in R. They are widely used for a board range of various cases. AirXcell doesn't intend to implement support for creating all the various types of data frames. Instead, AirXCell leaves to the user the responsibility to create the Data Frame using either the R Console (4.2.4), the R Code Editor (6) or whatever.
Once created, the Data Frame editor comes in help to manipulate the Data Frame and provides the user with a user friendly way for viewing and editing its values. It can be edited by using the menu Workspace → New Module → New DataFrame with the help of the Choose Data Frame Dialog shown on Figure 8.2, “Choose Data Frame”
One can for instance create a Data Frame of factor using the expand.grid
R command:
> plan <- expand.grid(Cat = c("A","B"), Conc = factor(c(20,40)), Temp = factor(c(160,180))) > plan$Val <- c(1.23, 1,98, 1.45, 1.2, 1.19, 1.05, 1.02) > plan Cat Conc Temp Val 1 A 20 160 1.23 2 B 20 160 1.00 3 A 40 160 98.00 4 B 40 160 1.45 5 A 20 180 1.20 6 B 20 180 1.19 7 A 40 180 1.05 8 B 40 180 1.02 >
Once created, the plan
Data Frame can be edited with the help of the AirXCell
Data Frame Editor module.
A timeseries can also be considered as a Data Frame by the Data Frame Editor module:
> require('quantmod') > getSymbols('IBM') # or better within Airxcell : getSymbols.fd('IBM') [1] "IBM" >
Once created, the IBM
timeseries can be edited with the help of the AirXCell
Data Frame Editor module.
Most functionalities aside from browsing the data or editing values are available from the toolbar:
Import File : import a CSV file inside the data frame.
Export File : export the Data Frame values to a CSV file.
Cut the cell(s) content :
cut the content of the current cell of the selected cells and put in the clipboard.
(Ctrl + X)
Copy the cell(s) content :
copy the content of the current cell of the selected cells and put in the clipboard.
(Ctrl + C)
Paste content into cell(s) :
paste the clipboard content into the current cell of the selected cells.
(Ctrl + V)
Select all :
select all cells on the Data Frame Editor.
(Ctrl + A)
Delete selected values :
delete the value of the current cell or the selected cells.
(Del)
Find :
find a text pattern in the data frame values. Replace is also available from here.
(Ctrl + F)
Sheet manipulation : entry point to rows or columns manipulation (add / remove row / column).
Refresh full data frame from R : refresh the Data Frame Content with the values from the Data Frame instance within the R environment.
As of version 0.5.10-SNAPSHOT of AirXCell, the Data Frame Editor is only partially implemented and some features available from the toolbar do not work yet.
When working with R timeseries, one can use the usual data frame syntax to extract portion of it.
For instance, if one has loaded the historical quotes of IBM, it can use the following
syntax to extract a subset - from 2012-01-03 to 2012-02-05 - of the Adjusted value:
IBM["2012-01-03::2012-02-05"]$IBM.Adjusted
Extracting a specific value from the timeseries is however somwhat tricky since every extracted portion, even
only one single value, is always typed as a timeseries. Whenever one wants to convert this single value to
a number, the simpliest way is to convert the single value timeseries to a single position vector, hence
a simple number: as.vector(IBM["2012-01-03"]$IBM.Adjusted)