isistDf.Rd function

checkRdistDf - Check RdistDf data frames

checkRdistDf - Check RdistDf data frames

Checks the validity of Rdistance nested data frames. Rdistance data frames are a particular implementation of rowwise tibbles

that contain detections in a list column, and extra attributes specifying types.

is.RdistDf(df, verbose = FALSE)

Arguments

  • df: A data frame to check
  • verbose: If TRUE, an explanation of the check that fails is printed. Otherwise, no information on checks is provided.

Returns

TRUE or FALSE invisibly. TRUE means all checks passed. FALSE implies at least one check failed. Use verbose = TRUE to see which.

Details

The following checks are performed (in this order):

  • attr(df, "detectionColumn") exists and points to a valid list-based column in the data frame.

  • attr(df, "obsType") exists and is one of the valid values.

  • attr(df, "transType") exists and is one of the valid values.

  • The data frame is either a 'rowwise_df' or 'grouped_df' tibble.

  • The data frame has only one row per group. One row per group is implied by 'rowwise_df', but not a 'grouped_df', and both are allowed in Rdistance. One row per group ensures rows are uniquely identified and hence represents one transect.

  • No column names in the list-column are duplicated in the non-list columns of the data frame. This check ensures that tidyr::unnest

    executes.

Other data checks, e.g., for measurement units, are performed later in dfuncEstim, after the model is specified.

Examples

data(sparrowDf) is.RdistDf(sparrowDf) # Data frame okay, but no attributes data(sparrowDetectionData) data(sparrowSiteData) sparrowDf <- sparrowDetectionData |> dplyr::nest_by( siteID , .key = "distances") |> dplyr::right_join(sparrowSiteData, by = "siteID") is.RdistDf(sparrowDf, verbose = TRUE)
  • Maintainer: Trent McDonald
  • License: GNU General Public License
  • Last published: 2025-04-10