Skip to content

Error in as.peakData with NA's and check_rows = T #11

@clabornd

Description

@clabornd

The below fails

library(ftmsRanalysis)
data("ftms12T_edata")
data("ftms12T_fdata")
data("ftms12T_emeta")

edata <- ftms12T_edata
edata[edata == 0] <- NA
peakObj <- as.peakData(edata, ftms12T_fdata, ftms12T_emeta, 
                       edata_cname="Mass", fdata_cname="SampleID", 
                       mass_cname="Mass", c_cname="C", h_cname="H", 
                       o_cname="O", n_cname="N", s_cname="S", 
                       p_cname="P", isotopic_cname = "C13", 
                       isotopic_notation = "1", check_rows = T)

Error in if (any(molfilt$Num_Observations == 0)) res <- applyFilt(molfilt,  : 
  missing value where TRUE/FALSE needed

The error appears to begin with the molecule_filter() call:

molfilt <- molecule_filter(res)

which then calls n_present(), which calls rowSums() on an object with NA's producing NA's in the output:

res <- as.integer(rowSums(x>0))

Then the any() call in the error message returns an NA since molfilt$Num_Observations contains NA's.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions