View source: R/writeMetadata.R
writeMetadata | R Documentation |
This function is simply a wrapper to write the metadata associated with a collection of mass spectra into a file in either the R or csv format.
writeMetadata(x, filename = "Metadata", format = c("R", "csv"), ...)
x |
Metadata in any sensible data format, preferably |
filename |
A character string specifying a name for the destination file (filename extension not required). |
format |
One of R (default |
... |
Other arguments. |
It uses either save
or write.table
to store the metadata. Check these functions for adequate data formats.
No return value, file in selected format created on destination folder.
# Load example data
data(spectra) # list of MassSpectra class objects
data(type) # metadata
# Some pre-processing
sc.spectra <- screenSpectra(spectra, meta = type)
spectra <- sc.spectra$fspectra # filtered spectra
type <- sc.spectra$fmeta # filtered metadata
spectra <- transformIntensity(spectra, method = "sqrt")
spectra <- wavSmoothing(spectra)
spectra <- removeBaseline(spectra)
peaks <- detectPeaks(spectra)
peaks <- alignPeaks(peaks, minFreq = 0.8)
# Intensity matrix
int <- intensityMatrix(peaks)
# Save resulting data in R format (to a temporary location as an example)
writeIntensity(int, filename = file.path(tempdir(),"MyintMatrix"))
writeMetadata(type, filename = file.path(tempdir(),"MyMetadata"))
# Save resulting data in csv format (to a temporary location as an example)
writeIntensity(int, filename = file.path(tempdir(),"MyintMatrix"),
format = "csv")
writeMetadata(type, filename = file.path(tempdir(),"MyMetadata"),
format = "csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.