Skip to contents

Generic function to convert the data stored in the object x into a new object of class dmdScheme...

Usage

as_dmdScheme(x, keepData = FALSE, ..., verbose = FALSE)

# S3 method for dmdSchemeData_raw
as_dmdScheme(
  x,
  keepData = TRUE,
  convertTypes = TRUE,
  warnToError = TRUE,
  checkVersion = TRUE,
  ...,
  verbose = FALSE
)

# S3 method for dmdSchemeSet_raw
as_dmdScheme(
  x,
  keepData = FALSE,
  warnToError = TRUE,
  convertTypes = TRUE,
  checkVersion = TRUE,
  ...,
  verbose = FALSE
)

# S3 method for xml_document
as_dmdScheme(x, keepData = TRUE, useSchemeInXml = NULL, ..., verbose = FALSE)

Arguments

x

object to be converted

keepData

if the data should be kept or replaced with one row with NAs

...

additional arguments for methods

verbose

give verbose progress info. Useful for debugging.

convertTypes

if TRUE, the types specified in the types column are used for the data type. Otherwise, they are left at type character

warnToError

if TRUE, warnings generated during the conversion will raise an error

checkVersion

if TRUE, a version mismatch between the package and the data x will result in an error. If FALSE, the check will be skipped.

useSchemeInXml

if TRUE, use scheme definition in xml and raise an error if the xml does not contain a scheme definition. If False, use the scheme definition from the corresponding installed package, even if the xml contains a scheme definition. if NULL (the default), use the definition in the xml if it contains a definition, if not use the corresponding definition from the installed package.

Value

dmdScheme as object of class dmdScheme_set

Examples

as_dmdScheme(dmdScheme_raw(), keepData = TRUE)
#>  dmdScheme - dmdSchemeSet
#>      MdBibliometric - dmdSchemeData
#> A       Names : uploadType | doi | publicationDate | title | description | version | language | keywords | additionalNotes | accessRights | accessRightsInfo | license
#> A       Units : 
#> A       Type  : character | character | character | character | character | character | character | character | character | character | character | character
#> 
#>           uploadType               doi publicationDate                   title
#> D       1    Dataset 110.1234/ffoo.bar      2020-05-26 Microbes under Pressure
#>                                                                                                                                                 description
#> D       1 The dataset was generated by putting microbes under pressure through temperatue and oxygen changes and their changes ion abundance were observed.
#>           version language
#> D       1    <NA>      eng
#>                                                         keywords
#> D       1 microbes, temperatur change, oxygen changes, abundance
#>           additionalNotes accessRights accessRightsInfo
#> D       1            <NA>         Open             <NA>
#>                                                  license
#> D       1 Creative Commons Attribution 4.0 International
#> 
#>      MdAuthors - dmdSchemeData
#> A       Names : authorID | familyName | givenName | affiliation | orcid | role
#> A       Units : NA | NA | NA | NA | NA | NA
#> A       Type  : character | character | character | character | character | character
#> 
#>           authorID familyName givenName                       affiliation orcid
#> D       1        1    Petchey   Owen L. University of Zurich, Switzerland  <NA>
#> D       2        2       Krug Rainer M. University of Zurich, Switzerland  <NA>
#>                                       role
#> D       1 Conceptualization, Investigation
#> D       2                    Data curation
#> 
#>      Experiment - dmdSchemeData
#> A       Names : name | temperature | light | humidity | incubator | container | microcosmVolume | mediaType | mediaConcentration | cultureConditions | comunityType | mediaAdditions | duration | comment
#> A       Units : NA | NA | NA | NA | NA | NA | ml | NA | g/l | NA | NA | NA | days | NA
#> A       Type  : character | character | character | character | character | character | numeric | character | numeric | character | character | character | integer | character
#> 
#>                name temperature        light humidity      incubator
#> D       1 ASR-expt1          20 semi-ambient  ambient not given here
#>                                    container microcosmVolume mediaType
#> D       1 Duran type bottle, red lids, 250ml             100       PPM
#>           mediaConcentration cultureConditions      comunityType
#> D       1               0.55             dirty initially unknown
#>                                                                   mediaAdditions
#> D       1 Wheat seeds added on specific dates, see file wheat_seed_additions.csv
#>           duration comment
#> D       1      100    <NA>
#> 
#>      Genus - dmdSchemeData
#> A       Names : speciesID | colour | density | functionalGroup | comment
#> A       Units : NA | NA | cells / ml | NA | NA
#> A       Type  : character | character | character | character | character
#> 
#>           speciesID  colour density functionalGroup
#> D       1      tt_1    ATCC       1     bacterivore
#> D       2   unknown unknown    <NA>         unknown
#>                                                            comment
#> D       1 http://www.lgcstandards-atcc.org/products/all/30007.aspx
#> D       2                                                     <NA>
#> 
#>      Treatments - dmdSchemeData
#> A       Names : treatmentID | treatmentLevelHeight | comment
#> A       Units : NA | NA | NA
#> A       Type  : character | character | character
#> 
#>             treatmentID treatmentLevelHeight comment
#> D       1 Lid_treatment                Loose    <NA>
#> D       2 Lid_treatment                Tight    <NA>
#> D       3     species_1        tt_1, unknown    <NA>
#> D       4     species_2              unknown    <NA>
#> D       5     species_3                 tt_1    <NA>
#> 
#>      Measurement - dmdSchemeData
#> A       Names : measurementID | variable | method | unit | object | noOfSamplesInTimeSeries | samplingVolume | dataExtractionID | measuredFrom | comment
#> A       Units : NA | NA | NA | NA | NA | NA | ml | NA | NA | NA
#> A       Type  : character | character | character | character | character | integer | numeric | character | character | character
#> 
#>                  measurementID  variable         method               unit
#> D       1 oxygen concentration        DO presens Optode                  %
#> D       2            abundance abundance      molecular              count
#> D       3                smell     smell           nose rotten eggs or not
#> D       4         sequenceData       DNA            NGS         Nucleotide
#>                 object noOfSamplesInTimeSeries samplingVolume
#> D       1    community                      50            0.0
#> D       2      species                       6            0.5
#> D       3    community                       6            0.0
#> D       4 DNA fragment                       6            0.0
#>              dataExtractionID measuredFrom comment
#> D       1                none          raw    <NA>
#> D       2 Mol_Analy_pipeline1 sequenceData    <NA>
#> D       3                none          raw    <NA>
#> D       4                none          raw    <NA>
#> 
#>      DataExtraction - dmdSchemeData
#> A       Names : dataExtractionID | method | parameter | value | comment
#> A       Units : NA | NA | NA | NA | NA
#> A       Type  : character | character | character | character | character
#> 
#>              dataExtractionID method parameter value
#> D       1 Mol_Analy_pipeline1   <NA>      <NA>  <NA>
#>                                   comment
#> D       1 See description in file xxx.yyy
#> 
#>      DataFileMetaData - dmdSchemeData
#> A       Names : dataFileName | columnName | columnData | mappingColumn | type | description | comment
#> A       Units : NA | NA | NA | NA | NA | NA | NA
#> A       Type  : character | character | character | character | character | character | character
#> 
#>                             dataFileName    columnName  columnData
#> D       1  dissolved_oxygen_measures.csv        Jar_ID          ID
#> D       2  dissolved_oxygen_measures.csv            DO Measurement
#> D       3  dissolved_oxygen_measures.csv        Unit_1       other
#> D       4  dissolved_oxygen_measures.csv          Mode       other
#> D       5  dissolved_oxygen_measures.csv      Location       other
#> D       6  dissolved_oxygen_measures.csv     Date_time       other
#> D       7  dissolved_oxygen_measures.csv Lid_treatment   Treatment
#> D       8  dissolved_oxygen_measures.csv      Jar_type       other
#> D       9  dissolved_oxygen_measures.csv        Jar_ID          ID
#> D       10                     smell.csv          <NA>     Species
#> D       11                     smell.csv         smell Measurement
#> D       12                     smell.csv          Date       other
#> D       13                     smell.csv Lid_treatment   Treatment
#> D       14                     smell.csv      Jar_type       other
#> D       15                abundances.csv          <NA>     Species
#> D       16                abundances.csv        Jar_ID          ID
#> D       17                abundances.csv     Date_time       other
#> D       18                abundances.csv Lid_treatment   Treatment
#> D       19                abundances.csv      Jar_type       other
#> D       20                abundances.csv  count_number Measurement
#>                   mappingColumn      type description comment
#> D       1                  <NA> character        <NA>    <NA>
#> D       2  oxygen concentration   numeric        <NA>    <NA>
#> D       3                  <NA> character        <NA>    <NA>
#> D       4                  <NA> character        <NA>    <NA>
#> D       5                  <NA> character        <NA>    <NA>
#> D       6                  <NA>  datetime      ymdhms    <NA>
#> D       7         Lid_treatment character        <NA>    <NA>
#> D       8                  <NA> character        <NA>    <NA>
#> D       9                  <NA> character        <NA>    <NA>
#> D       10            species_1 character        <NA>    <NA>
#> D       11                smell character        <NA>    <NA>
#> D       12                 <NA>  datetime      ymdhms    <NA>
#> D       13        Lid_treatment character        <NA>    <NA>
#> D       14                 <NA> character        <NA>    <NA>
#> D       15            species_3 character        <NA>    <NA>
#> D       16                 <NA> character        <NA>    <NA>
#> D       17                 <NA>  datetime      ymdhms    <NA>
#> D       18        Lid_treatment character        <NA>    <NA>
#> D       19                 <NA> character        <NA>    <NA>
#> D       20            abundance   numeric        <NA>    <NA>
#> 
as_dmdScheme(dmdScheme_raw()$Experiment)
#>  NA - dmdSchemeData
#> A   Names : name | temperature | light | humidity | incubator | container | microcosmVolume | mediaType | mediaConcentration | cultureConditions | comunityType | mediaAdditions | duration | comment
#> A   Units : NA | NA | NA | NA | NA | NA | ml | NA | g/l | NA | NA | NA | days | NA
#> A   Type  : character | character | character | character | character | character | numeric | character | numeric | character | character | character | integer | character
#> 
#>            name temperature        light humidity      incubator
#> D   1 ASR-expt1          20 semi-ambient  ambient not given here
#>                                container microcosmVolume mediaType
#> D   1 Duran type bottle, red lids, 250ml             100       PPM
#>       mediaConcentration cultureConditions      comunityType
#> D   1               0.55             dirty initially unknown
#>                                                               mediaAdditions
#> D   1 Wheat seeds added on specific dates, see file wheat_seed_additions.csv
#>       duration comment
#> D   1      100    <NA>
#> 

xml <- as_xml(dmdScheme_example())
x <- as_dmdScheme(xml)
all.equal(dmdScheme_example(), x)
#> [1] TRUE