knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  warning = FALSE,
  message = TRUE,
  out.width = "100%"
)

Data preparation

library(massdataset)
library(tidyverse)

data("expression_data")
data("sample_info")
data("sample_info_note")
data("variable_info")
data("variable_info_note")

object =
  create_mass_dataset(
    expression_data = expression_data,
    sample_info = sample_info,
    variable_info = variable_info,
    sample_info_note = sample_info_note,
    variable_info_note = variable_info_note
  )

object

Base function

object[1:5,]
object[,1:5]
object[1:10,1:5]
colnames(object)
object[,"Blank_3"]

rownames(object) %>% head()
object["M136T55_2_POS",]

object["M136T55_2_POS","Blank_3"]

If set drop = TRUE, then it will return a numeric vector, not a mass_dataset.

head(object[,"Blank_3", drop = TRUE])

unlist(object["M136T55_2_POS",,drop = TRUE] )

object["M136T55_2_POS","Blank_3",drop = TRUE]

We can also get the values from one mass_dataset class use $ like a data.frame.

head(object$Blank_3, 20)

Session information

sessionInfo()


tidymass/massdataset documentation built on Jan. 30, 2024, 2:55 p.m.