Subsetting airdas_dfr
or airdas_df
objects
Usage
# S3 method for class 'airdas_dfr'
x[i, j, ..., drop = TRUE]
# S3 method for class 'airdas_dfr'
x$name <- value
# S3 method for class 'airdas_dfr'
x[i, j, ...] <- value
# S3 method for class 'airdas_dfr'
x[[i]] <- value
# S3 method for class 'airdas_df'
x[i, j, ..., drop = TRUE]
# S3 method for class 'airdas_df'
x$name <- value
# S3 method for class 'airdas_df'
x[i, j, ...] <- value
# S3 method for class 'airdas_df'
x[[i]] <- value
Arguments
- x
object of class
airdas_dfr
orairdas_df
- i, j, ...
elements to extract or replace, see
[.data.frame
- drop
logical, see
[.data.frame
- name
A literal character string or ..., see
[.data.frame
- value
A suitable replacement value, see
[.data.frame
Details
When subsetting a airdas_dfr
or airdas_df
object,
henceforth a airdas_
object,
using any of the functions described in [.data.frame
,
then then the airdas_
class is simply dropped and the object is of class data.frame
.
This is because of the strict format requirements of airdas_
objects;
it is likely that a subsetted airdas_
object will not have
the format required by subsequent swfscAirDAS functions,
and thus it is safest to drop the airdas_
class.
If a data frame is passed to downstream swfscAirDAS
functions
that require a airdas_
object,
then they will attempt to coerce the object to the necessary airdas_
class
See as_airdas_dfr
and as_airdas_df
for more details.
Examples
y <- system.file("airdas_sample.das", package = "swfscAirDAS")
y.read <- airdas_read(y)
# All return a data frame:
class(y.read[1:10, ])
#> [1] "data.frame"
class(y.read[, 1:10])
#> [1] "data.frame"
y.df <- y.read
y.df[, 1] <- "a"
class(y.df)
#> [1] "data.frame"
y.df <- y.read
y.df$Event <- "a"
class(y.df)
#> [1] "data.frame"
y.df <- y.read
y.df[["Event"]] <- "a"
class(y.df)
#> [1] "data.frame"