Title: | Simplified Fitting and Use of Standard Curves |
---|---|
Description: | {standard} provices a more simplified interface to the linear models system in R for the fitting of standard curves and their usage in biochemistry and molecular biology. |
Authors: | Brady Johnston [aut, cre] |
Maintainer: | Brady Johnston <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2025-03-17 04:19:22 UTC |
Source: | https://github.com/bradyajohnston/standard |
std_curve_fit()
Generic function for subsetting output of std_curve_fit()
## S3 method for class 'std_calc' x[i, j]
## S3 method for class 'std_calc' x[i, j]
x |
object of class |
i |
row index |
j |
column index |
column of tibble
std_calc
to data frameConvert std_calc
to data frame
## S3 method for class 'std_calc' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
## S3 method for class 'std_calc' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
object of class |
row.names |
Optional vector of rownames. |
optional |
logical. If TRUE, setting row names and converting column names (to syntactic names: see make.names) is optional. Note that all of R's base package as.data.frame() methods use optional only for column names treatment, basically with the meaning of data.frame(*, check.names = !optional). See also the make.names argument of the matrix method. |
... |
additional arguments to be passed to or from methods. |
data.frame
Title
lerp(x, y, z = 0.5)
lerp(x, y, z = 0.5)
x |
Value to lerp from. |
y |
Value to lerp to. |
z |
Proportion to lerp by (0-1). |
Finds the minium value of a vector and the maximum value of a vector, and
then lerps between the two by the factor z
.
lerp_vec(vec, z = 0.5)
lerp_vec(vec, z = 0.5)
vec |
numeric vector of values. |
z |
proportion to lerp by (0-1). |
Finds Minimum Number of Decimal Places
n_decimal(x)
n_decimal(x)
x |
Number to calculate decimal places. |
Generic Function for Plotting Standard Curve Calculations
## S3 method for class 'std_calc' plot(x, ...)
## S3 method for class 'std_calc' plot(x, ...)
x |
output of |
... |
Additional arguments to be passed to |
ggplot2 plot
Generic Function for Plotting Fitted Standard Curves
## S3 method for class 'std_curve' plot(x, ...)
## S3 method for class 'std_curve' plot(x, ...)
x |
output of |
... |
Additional arguments to be passed to |
ggplot2 plot
std_curve_calc()
Printing Results of std_curve_calc()
## S3 method for class 'std_calc' print(x, ...)
## S3 method for class 'std_calc' print(x, ...)
x |
object of class |
... |
additional arguments to be passed to or from methods. |
Use a Standard Curve to Calculate Unknown Values
std_curve_calc(std_curve, unknowns, digits = 3)
std_curve_calc(std_curve, unknowns, digits = 3)
std_curve |
A linear model, created with either |
unknowns |
A numeric vector of unknown values, which the standard curve will be used to predict their values. |
digits |
Number of decimal places for calculations. |
a tibble with a column for the unknown
values, and a column .fitted
for the predicted values, based on the
standard curve.
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_curve_calc(unk) |> plot()
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_curve_calc(unk) |> plot()
Create a Standard Curve From Known Data
std_curve_fit(data, conc, resp)
std_curve_fit(data, conc, resp)
data |
A |
conc |
Name of the column that contains the concentration for the standard curve. |
resp |
Name of the column that contains the response values for the standard curve. |
A linear model ( lm() ) object to be used as a standard
curve, for use with standard::std_curve_calc()
broom::augment()
or
stats::predict()
.
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readings from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> plot()
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readings from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> plot()
Plot a Standard Curve
std_curve_plot(data)
std_curve_plot(data)
data |
Result of |
a ggplot2 plot with the standard curve and unkowns
plotted, whch can be further customised using ggplot
options.
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_curve_calc(unk) |> plot()
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_curve_calc(unk) |> plot()
Extract and Paste Formula From Standard Curve
std_paste_formula(std_curve, digits = 3)
std_paste_formula(std_curve, digits = 3)
std_curve |
object of class std_curve, the output of |
digits |
Number of decimal places to round numbers in the formula to. |
a string of the extracted formula from the standard curve
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_paste_formula()
library(standard) # Protein concentrations of the standards used in the assay prot <- c( 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000, 0.000, 0.016, 0.031, 0.063, 0.125, 0.250, 0.500, 1.000 ) # absorbance readins from the standards used in the assay abs <- c( 0.329, 0.352, 0.349, 0.379, 0.417, 0.491, 0.668, 0.956, 0.327, 0.341, 0.355, 0.383, 0.417, 0.446, 0.655, 0.905 ) assay_data <- data.frame( Protein = prot, Absorbance = abs ) # unknown concentrations unk <- c(0.554, 0.568, 0.705) assay_data |> std_curve_fit(Protein, Absorbance) |> std_paste_formula()