| as.data.frame {opm} | R Documentation | 
These as.data.frame methods create a data frame
from aggregated and discretised values in a manner
distinct from extract. flatten
converts into a ‘flat’ data frame, including all
measurements in a single column (suitable, e.g., for
lattice).
  ## S4 method for signature 'MOPMX'
as.data.frame(x, row.names = NULL,
    optional = FALSE, sep = "_", csv.data = TRUE, settings = TRUE,
    include = FALSE, ..., stringsAsFactors = default.stringsAsFactors()) 
  ## S4 method for signature 'OPM'
as.data.frame(x, row.names = NULL,
    optional = FALSE, sep = "_", csv.data = TRUE, settings = TRUE,
    include = FALSE, ..., stringsAsFactors = default.stringsAsFactors()) 
  ## S4 method for signature 'OPMA'
as.data.frame(x, row.names = NULL,
    optional = FALSE, sep = "_", csv.data = TRUE, settings = TRUE,
    include = FALSE, ..., stringsAsFactors = default.stringsAsFactors()) 
  ## S4 method for signature 'OPMD'
as.data.frame(x, row.names = NULL,
    optional = FALSE, sep = "_", csv.data = TRUE, settings = TRUE,
    include = FALSE, ..., stringsAsFactors = default.stringsAsFactors()) 
  ## S4 method for signature 'OPMS'
as.data.frame(x, row.names = NULL,
    optional = FALSE, sep = "_", csv.data = TRUE, settings = TRUE,
    include = FALSE, ..., stringsAsFactors = default.stringsAsFactors()) 
  ## S4 method for signature 'kegg_compound'
as.data.frame(x, row.names = NULL,
    optional = TRUE, ..., stringsAsFactors = FALSE) 
  ## S4 method for signature 'kegg_compounds'
as.data.frame(x, row.names = NULL,
    optional = TRUE, ..., stringsAsFactors = FALSE) 
  ## S4 method for signature 'MOPMX'
flatten(object, include = NULL, fixed = list(),
    factors = FALSE, ...) 
  ## S4 method for signature 'OPM'
flatten(object, include = NULL, fixed = list(),
    factors = TRUE, exact = TRUE, strict = TRUE, full = TRUE,
    numbers = FALSE, ...) 
  ## S4 method for signature 'OPMS'
flatten(object, include = NULL, fixed = list(), ...)
x | 
 Object of class  There are   | 
row.names | 
 Optional vector for use as row names of the resulting data frame. Here, it is not recommended to try to set row names explicitly.  | 
optional | 
 Logical scalar passed to the list and
matrix methods of   | 
sep | 
 Character scalar used as word separator in
column names. Set this to   | 
csv.data | 
 Logical scalar indicating whether the
  | 
settings | 
 Logical scalar indicating whether the
  | 
stringsAsFactors | 
 Logical scalar passed to the list
and matrix methods of   | 
object | 
|
include | 
 For  For   | 
fixed | 
 
  | 
factors | 
 Logical scalar. See the
  | 
exact | 
 Logical scalar. Passed to
  | 
strict | 
 Logical scalar. Passed to
  | 
full | 
 Logical scalar. Replace well coordinates by full names?  | 
numbers | 
 Logical scalar. Use numbers instead of well names? This is not recommended for must usages.  | 
... | 
 Optional other arguments passed to
  | 
The as.data.frame methods for OPMX
objects are mainly intended to produce objects that can
easily be written to CSV files, for instance
using write.table from the utils package.
There are no opm methods other than
batch_opm (which can write such files) that
make use of the created kind of objects. In particular,
they cannot be input again into opm.
The following entries are contained in the generated data frame:
 Optionally the csv_data entries that
identify the plate.
The names of the wells. Always included.
 For OPMA objects (and
OPMS objects that contain them as well as
MOPMX objects that contain such
OPMA or OPMS objects), always
the aggregated data (curve parameters), one column for
each point estimate, upper and lower confidence interval
of each parameter.
 For OPMA objects (and
OPMS objects that contain them as well as
MOPMX objects that contain such
OPMA or OPMS objects),
optionally the used aggregation settings, one column per
entry, except for the ‘options’ entry (which is
not a scalar). The column names are prefixed with
"Aggr" followed by sep. If sep is
empty, opm_opt("comb.key.join") is used.
 For OPMD objects (and
OPMS objects that contain them as well as
MOPMX objects that contain such
OPMD or OPMS objects), always
one column with the discretised data.
 For OPMD objects (and
OPMS objects that contain them as well as
MOPMX objects that contain such
OPMD or OPMS objects),
optionally the used discretisation settings, one column
per entry, except for the ‘options’ entry (which
is not a scalar). The column names are prefixed with
"Disc" followed by sep. If sep is
empty, opm_opt("comb.key.join") is used.  
The limits of using CSV as output format already show up in this list, and in general we recommend to generate YAML or JSON output instead.
For the as.data.frame methods of the other
classes, see substrate_info.
In the data frame returned by flatten, column
names are unchecked (not converted to variable names).
The three last columns are coding for time, well and
value, with the exact spelling of the column names given
by param_names.
The OPMS method yields an additional column
for the plate, the exact spelling of its name also being
available via param_names. This column
contains the position of each plate within object.
The MOPMX method yields a another
additional column for the plate type. There is currently
no safeguard against having several OPMX
objects of the same plate type within a
MOPMX object.
The as.data.frame methods create a data frame with
one row for each combination of well and plate.
The flatten methods create a data frame with one
row for each combination of time point, well and plate.
utils::write.table stats::reshape pkgutils::flatten
Other conversion-functions: extract,
extract_columns, merge,
oapply, opmx,
plates, rep,
rev, sort,
split, to_yaml,
unique
## OPMD method of as.data.frame()
summary(x <- as.data.frame(vaas_1))
##                                                               File   
##  ./E. coli DSM 30083T_vim10_7B__1_28_PMX_0_8#30#2010_F_ 7B_5.csv:96  
##                                                                      
##                                                                      
##                                                                      
##                                                                      
##                                                                      
##                                                                      
##    Plate_Type Position                 Setup_Time      Well   
##  Gen III:96    7-B:96   8/30/2010 1:53:08 PM:96   A01    : 1  
##                                                   A02    : 1  
##                                                   A03    : 1  
##                                                   A04    : 1  
##                                                   A05    : 1  
##                                                   A06    : 1  
##                                                   (Other):90  
##        mu              lambda              A               AUC       
##  Min.   :  1.287   Min.   :-18.834   Min.   : 50.72   Min.   : 3923  
##  1st Qu.:  5.912   1st Qu.:  2.005   1st Qu.:186.12   1st Qu.:12229  
##  Median : 15.978   Median :  4.810   Median :277.15   Median :20969  
##  Mean   : 20.263   Mean   :  5.935   Mean   :236.63   Mean   :18203  
##  3rd Qu.: 21.442   3rd Qu.:  7.547   3rd Qu.:293.50   3rd Qu.:23268  
##  Max.   :153.069   Max.   : 58.959   Max.   :356.72   Max.   :32335  
##                                                                      
##   mu_CI95_low     lambda_CI95_low      A_CI95_low      AUC_CI95_low  
##  Min.   :-43.14   Min.   :-40.1574   Min.   : 51.42   Min.   : 3886  
##  1st Qu.:  2.94   1st Qu.: -8.7412   1st Qu.:185.53   1st Qu.:12113  
##  Median :  8.88   Median : -2.6709   Median :276.99   Median :20828  
##  Mean   : 10.92   Mean   : -6.7823   Mean   :236.41   Mean   :18061  
##  3rd Qu.: 16.27   3rd Qu.: -0.4249   3rd Qu.:293.14   3rd Qu.:23091  
##  Max.   : 93.21   Max.   : 23.7262   Max.   :355.86   Max.   :32125  
##                                                                      
##   mu_CI95_high     lambda_CI95_high   A_CI95_high     AUC_CI95_high  
##  Min.   :  9.637   Min.   :  2.674   Min.   : 54.37   Min.   : 3941  
##  1st Qu.: 14.818   1st Qu.:  8.675   1st Qu.:188.50   1st Qu.:12290  
##  Median : 22.493   Median : 15.366   Median :278.62   Median :21028  
##  Mean   : 36.812   Mean   : 32.963   Mean   :238.40   Mean   :18273  
##  3rd Qu.: 47.074   3rd Qu.: 51.628   3rd Qu.:294.75   3rd Qu.:23347  
##  Max.   :245.128   Max.   :119.078   Max.   :357.18   Max.   :32436  
##                                                                      
##  Aggr_software Aggr_version Aggr_method Discretized     Disc_software
##  opm:96        0.1-0:96     grofit:96   Mode :logical   opm:96       
##                                         FALSE:16                     
##                                         TRUE :62                     
##                                         NA's :18                     
##                                                                      
##                                                                      
##                                                                      
##  Disc_version Disc_method
##  0.7-0:96     kmeans:96  
##                          
##                          
##                          
##                          
##                          
## 
stopifnot(is.data.frame(x), nrow(x) == 96)
## OPMS method of as.data.frame()
summary(x <- as.data.frame(vaas_4[, , 1:10]))
##                                                                    File   
##  ./E. coli DSM 18039_vim10_12B__1_28_PMX_0_8#30#2010_E_12B_5.csv     :10  
##  ./E. coli DSM 30083T_vim10_7B__1_28_PMX_0_8#30#2010_F_ 7B_5.csv     :10  
##  ./P. aeruginosa DSM 1707_vim10_17B__1_28_PMX_0_8#30#2010_D_17B_5.csv:10  
##  ./P. aeruginosa St. 429_vim10_22B__1_28_PMX_0_8#30#2010_C_22B_5.csv :10  
##                                                                           
##                                                                           
##                                                                           
##    Plate_Type Position                  Setup_Time      Well   
##  Gen III:40   12-B:10   8/30/2010 1:19:11 PM :10   A01    : 4  
##                7-B:10   8/30/2010 1:53:08 PM :10   A02    : 4  
##               17-B:10   8/30/2010 12:31:46 PM:10   A03    : 4  
##               22-B:10   8/30/2010 11:28:54 AM:10   A04    : 4  
##                                                    A05    : 4  
##                                                    A06    : 4  
##                                                    (Other):16  
##        mu              lambda                A               AUC       
##  Min.   : 0.1307   Min.   :-107.9099   Min.   : 22.37   Min.   : 1888  
##  1st Qu.: 1.3441   1st Qu.: -12.2332   1st Qu.: 32.88   1st Qu.: 2351  
##  Median : 3.6118   Median :  -0.9945   Median : 55.80   Median : 4721  
##  Mean   : 7.3197   Mean   : -11.0518   Mean   :110.73   Mean   : 8396  
##  3rd Qu.: 7.3213   3rd Qu.:   1.9040   3rd Qu.:164.78   3rd Qu.:11873  
##  Max.   :52.2623   Max.   :  27.0147   Max.   :331.92   Max.   :28651  
##                                                                        
##   mu_CI95_low       lambda_CI95_low     A_CI95_low      AUC_CI95_low  
##  Min.   :-57.6867   Min.   :-35.770   Min.   : 22.78   Min.   : 1852  
##  1st Qu.: -1.2904   1st Qu.:-22.161   1st Qu.: 29.67   1st Qu.: 2314  
##  Median :  0.7860   Median : -8.521   Median : 55.31   Median : 4678  
##  Mean   : -0.9155   Mean   :-10.686   Mean   :110.40   Mean   : 8324  
##  3rd Qu.:  4.9110   3rd Qu.: -1.257   3rd Qu.:165.34   3rd Qu.:11763  
##  Max.   : 40.1572   Max.   : 18.215   Max.   :331.78   Max.   :28387  
##                                                                       
##   mu_CI95_high     lambda_CI95_high   A_CI95_high     AUC_CI95_high  
##  Min.   :  9.628   Min.   :  2.674   Min.   : 25.86   Min.   : 1910  
##  1st Qu.: 11.560   1st Qu.: 35.142   1st Qu.: 39.40   1st Qu.: 2378  
##  Median : 15.892   Median : 75.167   Median : 59.26   Median : 4743  
##  Mean   : 29.953   Mean   : 65.580   Mean   :114.14   Mean   : 8432  
##  3rd Qu.: 34.949   3rd Qu.: 90.713   3rd Qu.:167.48   3rd Qu.:11928  
##  Max.   :127.385   Max.   :132.751   Max.   :332.76   Max.   :28793  
##                                                                      
##  Aggr_software Aggr_version Aggr_method Discretized     Disc_software
##  opm:40        0.1-0:40     grofit:40   Mode :logical   opm:40       
##                                         FALSE:26                     
##                                         TRUE :8                      
##                                         NA's :6                      
##                                                                      
##                                                                      
##                                                                      
##  Disc_version Disc_method
##  0.7-0:40     kmeans:40  
##                          
##                          
##                          
##                          
##                          
## 
stopifnot(is.data.frame(x), nrow(x) == 10 * 4)
## OPM method of flatten()
# distinct numbers of columns due to distinct selection settings
head(x <- flatten(vaas_1))
##   Time                   Well Value
## 1 0.00 A01 (Negative Control)    40
## 2 0.25 A01 (Negative Control)    40
## 3 0.50 A01 (Negative Control)    32
## 4 0.75 A01 (Negative Control)    34
## 5 1.00 A01 (Negative Control)    35
## 6 1.25 A01 (Negative Control)    35
stopifnot(is.data.frame(x), identical(dim(x), c(36864L, 3L)))
head(x <- flatten(vaas_1, fixed = "TEST", include = "Strain"))
##   metadata(object, include, exact = exact, strict = strict) "TEST" Time
## 1                                                 DSM30083T   TEST 0.00
## 2                                                 DSM30083T   TEST 0.25
## 3                                                 DSM30083T   TEST 0.50
## 4                                                 DSM30083T   TEST 0.75
## 5                                                 DSM30083T   TEST 1.00
## 6                                                 DSM30083T   TEST 1.25
##                     Well Value
## 1 A01 (Negative Control)    40
## 2 A01 (Negative Control)    40
## 3 A01 (Negative Control)    32
## 4 A01 (Negative Control)    34
## 5 A01 (Negative Control)    35
## 6 A01 (Negative Control)    35
stopifnot(is.data.frame(x), identical(dim(x), c(36864L, 5L)))
## OPMS method of flatten()
# distinct numbers of columns due to distinct selection settings
head(x <- flatten(vaas_4[, , 1:10]))
##     Plate Time                   Well Value
## 1 Plate 1 0.00 A01 (Negative Control)    35
## 2 Plate 1 0.25 A01 (Negative Control)    32
## 3 Plate 1 0.50 A01 (Negative Control)    30
## 4 Plate 1 0.75 A01 (Negative Control)    35
## 5 Plate 1 1.00 A01 (Negative Control)    33
## 6 Plate 1 1.25 A01 (Negative Control)    32
stopifnot(is.data.frame(x), identical(dim(x), c(15360L, 4L)))
head(x <- flatten(vaas_4[, , 1:10], fixed = "TEST", include = ~ Strain))
##   metadata(object, include, exact = exact, strict = strict)   Plate "TEST"
## 1                                                  DSM18039 Plate 1   TEST
## 2                                                  DSM18039 Plate 1   TEST
## 3                                                  DSM18039 Plate 1   TEST
## 4                                                  DSM18039 Plate 1   TEST
## 5                                                  DSM18039 Plate 1   TEST
## 6                                                  DSM18039 Plate 1   TEST
##   Time                   Well Value
## 1 0.00 A01 (Negative Control)    35
## 2 0.25 A01 (Negative Control)    32
## 3 0.50 A01 (Negative Control)    30
## 4 0.75 A01 (Negative Control)    35
## 5 1.00 A01 (Negative Control)    33
## 6 1.25 A01 (Negative Control)    32
stopifnot(is.data.frame(x), identical(dim(x), c(15360L, 6L)))