SVGMethods: Methods for S4 class 'SVG'

SVGMethodsR Documentation

Methods for S4 class SVG

Description

These are methods for subsetting, getting, setting, or combining SVG objects.

Usage

## S4 method for signature 'SVG'
coordinate(x)

## S4 replacement method for signature 'SVG'
coordinate(x) <- value

## S4 method for signature 'SVG'
attribute(x)

## S4 replacement method for signature 'SVG'
attribute(x) <- value

## S4 method for signature 'SVG'
dimension(x)

## S4 replacement method for signature 'SVG'
dimension(x) <- value

## S4 method for signature 'SVG'
raster_pa(x)

## S4 replacement method for signature 'SVG'
raster_pa(x) <- value

## S4 method for signature 'SVG'
svg_obj(x)

## S4 replacement method for signature 'SVG'
svg_obj(x) <- value

## S4 method for signature 'SVG'
angle(x)

## S4 replacement method for signature 'SVG'
angle(x) <- value

## S4 method for signature 'SVG,ANY,ANY,ANY'
x[i, j]

## S4 replacement method for signature 'SVG,ANY,ANY,ANY'
x[i] <- value

## S4 method for signature 'SVG'
length(x)

## S4 method for signature 'SVG'
names(x)

## S4 replacement method for signature 'SVG'
names(x) <- value

## S4 method for signature 'SVG,SVG'
cmb(x, y)

## S4 method for signature 'SVG'
sub_sf(svg, show = NULL, hide = NULL)

Arguments

x, y

Two SVG objects.

value

A value for replacement.

i, j

Two integers specifying an aSVG instance and a slot of the same aSVG respectively.

svg

An SVG object.

show, hide

Two vectors of indexes in the attribute slot. aSVG features corresponding to these indexes will be shown or hidden in spatial heatmap plots respectively.

Value

An object of SVG, data.frame, or numeric.

Main methods

In the following code snippets, cordn is a SVG object.

cordn[i], cordn[i, ]

Subsetting the ith aSVG instance.

cordn[i] <- cordn.new

Replacing the ith aSVG instance in cordn with a new cordn object cordn.new.

cordn[, j]

Subsetting the jth slot of all aSVG instances.

cordn[, 'coordinate'], coordinate(cordn)

Subsetting the coordinate slot that contains coordinates of all aSVG instances.

length(cordn)

Number of all aSVG instances.

names(cordn), names(cordn)[1] <- 'newName'

Names of all aSVG instances, rename the first aSVG instance.

cbm(cordn1, cordn2)

Combining two aSVG instances.

Author(s)

Jianhai Zhang jzhan067@ucr.edu
Dr. Thomas Girke thomas.girke@ucr.edu

References

Wickham H, François R, Henry L, Müller K (2022). _dplyr: A Grammar of Data Manipulation_. R package version 1.0.9, <https:// CRAN.R-project.org/package=dplyr>

Wickham H, François R, Henry L, Müller K (2022). _dplyr: A Grammar of Data Manipulation_. R package version 1.0.9, <https://CRAN.R-project.org/package=dplyr>

See Also

SVG: creating SVG objects.

Examples


# Create the first aSVG instance. 
svg.pa1 <- system.file('extdata/shinyApp/data/maize_leaf_shm1.svg',
package='spatialHeatmap')
svg1 <- read_svg(svg.path=c(svg.pa1)); names(svg1); length(svg1); slotNames(svg1)
# Create the second aSVG instance. 
svg.pa2 <- system.file('extdata/shinyApp/data/maize_leaf_shm2.svg',
package='spatialHeatmap')
svg2 <- read_svg(svg.path=c(svg.pa2)); names(svg2); length(svg2)
# Combine these two instances.
svg3 <- cmb(svg1, svg2); names(svg3); length(svg3)
# The first aSVG instance
svg3[1]
# Coordinates of the first aSVG instance 
svg3[, 'coordinate'][1]; coordinate(svg3)[1]
# Extract slots from "svg3" into a list and create a new "SVG" object.
lis <- list(cordn=coordinate(svg3), attrb=attribute(svg3), svg=svg_obj(svg3))
new.svgs <- SVG(coordinate=lis$cordn, attribute=lis$attrb, svg=lis$svg)
# Change aSVG instance names.
names(new.svgs) <- c('aSVG1', 'aSVG2'); names(new.svgs)
# Replace the second instance in "svg3".
svg3[2] <- new.svgs[2]
# Replace a slot content.
coordinate(svg3)[[1]] <- coordinate(new.svgs)[[1]]

jianhaizhang/spatialHeatmap documentation built on July 31, 2024, 2:59 a.m.