View source: R/remove_points.R
remove_points | R Documentation |
Removes all points from an exdf
object that satisfy a set of
conditions.
remove_points(exdf_obj, ..., method = 'remove')
exdf_obj |
An |
... |
Each optional argument should be a list of named elements that specify
points to be removed from |
method |
Specify whether to remove points ( |
This function returns an exdf
object formed from exdf_obj
, where
the result depends on the value of method
.
When method
is 'remove'
, the returned object is a modified copy
of exdf_obj
where all rows that meet the conditions specified by the
optional arguments have been removed.
When method
is 'exclude'
, the returned object is a modified copy
of exdf_obj
with a new column called include_when_fitting
. The
value of this column is FALSE
for all rows that meet the conditions
specified by the optional arguments, and TRUE
otherwise. Points where
this column is FALSE
will not be used for fitting by
fit_c3_aci
or other fitting functions.
exdf
# Create an exdf object by reading a Licor Excel file
licor_file <- read_gasex_file(
PhotoGEA_example_file_path('ball_berry_1.xlsx')
)
# Print the number of points in the data set
nrow(licor_file)
# Remove the following:
# - All points where `obs` is 28 (1 point)
# - All points where `species` is `soybean` and `plot` is `1a` or `1b` (14 points)
licor_file_2 <- remove_points(
licor_file,
list(obs = 28),
list(species = 'soybean', plot = c('1a', '1b')),
method = 'remove'
)
# There should now be 15 fewer points remaining in the data set
nrow(licor_file_2)
# We can also specify the same points for exclusion rather than removal:
licor_file_3 <- remove_points(
licor_file,
list(obs = 28),
list(species = 'soybean', plot = c('1a', '1b')),
method = 'exclude'
)
print(licor_file_3[, c('species', 'plot', 'include_when_fitting')])
# The number of points where `include_when_fitting` is TRUE should be the same
# as the number of remaining rows when using the `remove` method
sum(licor_file_3[, 'include_when_fitting'])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.