R/datPBpnt2pct.R
datPBpnt2pct.Rd
Calculates percent point by plot and domain and transpose to plot level.
datPBpnt2pct(pnt, uniqueid, tvar, othervars = NULL)
DF/DT or comma-delimited file (*.csv). Point-level table with one record per point. If NULL, aggregated point counts must be in pntcnt.
String. Name of unique identifier of plot in pnt.
String. Name of variable to transpose.
String vector. Name(s) of plot-level variables to merge with transposed data.
Data frame with transposed data.
# Load necessary data from FIESTA
## Point data
icepntfn <- system.file("extdata",
"PB_data/icepnt_utco1135.csv",
package = "FIESTA")
icepnt <- read.csv(icepntfn)
# Convert to percent
percent <- datPBpnt2pct(pnt = icepnt,
uniqueid = "plot_id",
tvar = "cover_1")
head(percent)
#> plot_id 110 130 140 210 220 310 999
#> 1 11940039010690 0 0 0 0 0 100 0
#> 2 11940051010690 0 20 60 20 0 0 0
#> 3 11940063010690 0 0 0 0 0 100 0
#> 4 11940075010690 20 0 40 0 40 0 0
#> 5 11940087010690 20 0 80 0 0 0 0
#> 6 11940099010690 0 0 0 0 0 100 0