setzero.sp: Set values to '0' for sweetpotato data.

View source: R/setzero_sp.R

setzero.spR Documentation

Set values to 0 for sweetpotato data.

Description

Set values to 0 for harvested traits.

Usage

setzero.sp(dfr)

Arguments

dfr

The name of the data frame.

Details

This function sets values to 0 for all traits at harvest (noph, nopr, vw, nocr, nonc, crw, and ncrw) which are NA according to the following rules:

  • If noph == 0, then all traits are set to 0.

  • If all traits are 0, then noph is set to 0.

  • If nopr == 0, then all traits with exception of vw are set to 0.

  • If all traits with exception of vw are 0, then nopr is set to 0.

  • If nocr == 0, then crw is set to 0.

  • If crw == 0, then nocr is set to 0.

  • If nonc == 0, then ncrw is set to 0.

  • If ncrw == 0, then nonc is set to 0.

Value

It returns a data frame and a list of warnings with all the rows that have been modified.

Author(s)

Raul Eyzaguirre

Examples

dfr <- data.frame(noph = c(NA,  0,  3,  3,  3, 3, 3),
                  nopr = c(NA,  0,  0,  2,  3, 3, 3),
                  vw   = c(NA, NA,  3,  2,  3, 3, 6),
                  crw  = c(NA, NA, NA, NA,  8, 2, 0),
                  ncrw = c(NA, NA, NA,  2, NA, 2, 4),
                  nocr = c(NA, NA, NA,  0,  6, 2, 0),
                  nonc = c(NA, NA, NA,  4,  0, 3, 5))
setzero.sp(dfr)

reyzaguirre/st4gi documentation built on April 30, 2024, 5:45 a.m.