as.data.frame.SegmentedCells: as.data.frame

View source: R/segmentedCells-class.R

as.data.frame.SegmentedCellsR Documentation

as.data.frame

Description

Function to coerce a SegmentedCells object to a data frame.

Usage

## S3 method for class 'SegmentedCells'
as.data.frame(x, ...)

Arguments

x

A SegmentedCells object.

...

Other arguments.

Value

A data.frame

## Generate toy data set.seed(51773) x <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3, runif(200)+3,runif(200)+2,runif(200)+1,runif(200)),4) y <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3, runif(200),runif(200)+1,runif(200)+2,runif(200)+3),4) cellType <- factor(paste('c',rep(rep(c(1:2),rep(200,2)),4),sep = ”)) imageID <- rep(c('s1', 's2'),c(800,800)) cells <- data.frame(x, y, cellType, imageID)

## Store data in SegmentedCells object cellExp <- SegmentedCells(cells, cellTypeString = 'cellType')

## Generate LISA cellsDF <- as.data.frame(cellExp)

NULL


ellispatrick/spicyR documentation built on April 22, 2024, 12:24 p.m.