flatten {RMassBank} | R Documentation

## Flatten, or re-read, MassBank header blocks

### Description

`flatten` converts a list of MassBank compound information sets (as retrieved by `gatherData`) to a flat table, to be exported into an infolist. `readMbdata` reads a single record from an infolist flat table back into a MassBank (half-)entry.

### Usage

    flatten(mbdata)

    readMbdata(row)

### Arguments

`mbdata` | A list of MassBank compound information sets as returned from `gatherData`.
`row` | One row of MassBank compound information retrieved from an infolist.

### Details

Neither the flattening system itself nor the implementation are particularly fantastic, but since hand-checking of records is a necessary evil, there is currently no alternative (short of coding a complete GUI for this and working directly on the records.)

### Value

`flatten` returns a matrix (not a data frame) to be written to CSV.

`readMbdata` returns a list of type `list(id= compoundID, ..., 'ACCESSION' = '', 'RECORD_TITLE' = '', )` etc.

### Author(s)

Michael Stravs

### References

MassBank record format: http://www.massbank.jp/manuals/MassBankRecord_en.pdf

### See Also

`gatherData`,`loadInfolist`

### Examples

    ## Not run:
    	# Collect some data to flatten
    	ids <- c(40,50,60,70)
     data <- lapply(ids, gatherData)
     # Flatten the data trees to a table
     flat.table <- flatten(data)
     # reimport the table into a tree
     data.reimported <- apply(flat.table, 1, readMbdata)

    ## End(Not run)

[Package RMassBank version 2.8.0 Index]