nn_dist_perc_table: Plot and Save Histograms of nndist function

View source: R/nndist_analysis_functions.R

nn_dist_perc_tableR Documentation

Plot and Save Histograms of nndist function

Description

calculate percent of each nearest neighbor (NN) in 'nn_vec' that are less than x 'unit' in 'rads_vec' apart if 'value' = "percent" or calculate the distance at which each percentage in 'perc_vec' has each NN in 'nn_vec' if 'value' = "distance."

Usage

nn_dist_perc_table(
  pattern,
  pattern2 = NULL,
  window = NULL,
  drop_isolated = FALSE,
  value = "percent",
  rads_vec = 1:25,
  nn_vec = 1:5,
  perc_vec = seq(0, 1, 0.1),
  output = "plot",
  location = getwd(),
  image_name = "pattern",
  from_name = "Molecule1",
  to_name = NA,
  unit = "nm",
  round_to = 2,
  ...
)

Arguments

value

determines the output. If = "percent", then rows are NN number, columns are distance, and value is percent. If = "distance", rows are NN number, columns are percent, and 'value' is distance

rads_vec

vector of distances to calculate percents at. Only used if 'value' = "percent"

nn_vec

vector of integers values to determine which nearest neighbors to calculate

perc_vec

vector of percent values between 0 and 1 (inclusive) to calculate distances for. Only used if 'value' = "distance"

output

set to "plot" (default) if only plotting. Set to "save" if plotting and saving

location

location to save image to if 'output = save'. default is working directory.

image_name

Name to save image as. Will have '_NN_dist_perc.png' added to it if 'value' = "percent" or '_NN_perc_dist.png' if 'value' = "distance"

unit

distance unit name to be added to plot name

round_to

number of decimal places to round values to

image

Image of type ppp or pp3 to calculate distances from

image2

will be NULL (default) if using nndist function on 'image'. Otherwise, set as same class as 'image' (ppp or pp3) to calculate distances to using (nncross)

Details

add details

Value

returns at matrix. If 'value' = "percent", then rows are NN number, columns are distance, and value is percent. If 'value' = "distance", rows are NN number, columns are percent, and 'value' is distance. If 'output' = "save" then it will also save the image at location 'location'


rolandrolandroland/rTEM documentation built on March 29, 2025, 2:17 p.m.