Dataframe package: Difference between revisions

1,561 bytes added ,  1 May 2015
more access modes
(Example based on the 'data_test.csv')
(more access modes)
Line 12: Line 12:


To get a first taste, let's load the test csv file coming with the package:
To get a first taste, let's load the test csv file coming with the package:
   >> dataframe('data_test.csv')
   >> experiment = dataframe('data_test.csv')
   warning: load: '/home/padupuis/matlab/dataframe/inst/data_test.csv' found by searching load path
   warning: load: '/home/padupuis/matlab/dataframe/inst/data_test.csv' found by searching load path
   warning: fopen: '/home/padupuis/matlab/dataframe/inst/data_test.csv' found by searching load path
   warning: fopen: '/home/padupuis/matlab/dataframe/inst/data_test.csv' found by searching load path
Line 45: Line 45:
some code telling if the result makes senses or not.
some code telling if the result makes senses or not.


Let us now select the control values:
  cv = experiment(1:3, ["Vbias"; "Freq"])
  cv = dataframe with 3 rows and 1 columns
  Src: data_test.csv
  Comment: #notice there is a extra separator
  Comment: # a comment line and an empty one
  Comment: # the next lines use \r\n \r and \f as linefeed
  Comment: # one empty input field
  _1  Freq
  Nr double
  1 300000
  2 300000
  3 300000
The selection occurred on a range for the lines, by names on the column. The search criteria is here a
string array. All columns whose name match are returned.
The result is returned as a dataframe. This can be changed:
>> experiment.array(6, "OK_")
ans = B
>> class(ans)
ans = char
When selecting vectors, this transformation in array is automatic. The DC current is contained in elements
31 to 40 (fourth column):
  >> experiment31:40)
ans =
Columns 1 through 9:
  1.6272e-11  1.5990e-11  1.3790e-11  1.4420e-11  1.2930e-11  1.2610e-11  1.4390e-11  1.0890e-11          NA
Column 10:
  1.0610e-11
Note that the access 'experiment("x_IBIAS")' is illegal: does it refer to row or column names ?


;Accessing in this pseudo-structure way is valid in the following cases:
;choosing the output format: array, cell, dataframe (may be abbreviated as 'df')
;attribute selection: rownames, colnames, rowcnt, colcnt, rowidx, types, source, header, comment
;constructor call: new (no other deferencing may occur
;column selection: just provide one valid column name
To be similar to R implementation, constructs such as x.as.array are also allowed.


A simple example:
A simple example:
75

edits