tidy_trace: Tidy up a trace_asco output nested list

Description Usage Arguments Value See Also Examples

View source: R/tidy_trace.R

Description

Creates a tidy data.table from the output of trace_asco().

Usage

1

Arguments

trace

a nested list output from trace_asco()

Value

A tidy data.table of trace_asco() output.

See Also

summarise_trace(), trace_asco()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Newmarracarra <-
   read.csv(system.file("extdata",
            "1998_Newmarracarra_weather_table.csv", package = "ascotraceR"))
station_data <-
   system.file("extdata", "stat_dat.csv", package = "ascotraceR")

weather_dat <- format_weather(
   x = Newmarracarra,
   POSIXct_time = "Local.Time",
   temp = "mean_daily_temp",
   ws = "ws",
   wd_sd = "wd_sd",
   rain = "rain_mm",
   wd = "wd",
   station = "Location",
   time_zone = "Australia/Perth",
   lonlat_file = station_data)

traced <- trace_asco(
  weather = weather_dat,
  paddock_length = 20,
  paddock_width = 20,
  initial_infection = "1998-06-10",
  sowing_date = as.POSIXct("1998-06-09"),
  harvest_date = as.POSIXct("1998-06-09") + lubridate::ddays(100),
  time_zone = "Australia/Perth",
  primary_infection_foci = "centre")

tidied <- tidy_trace(traced)

# take a look at the infectious growing points on day 102
library(ggplot2)
ggplot(data = subset(tidied, i_day == 102),
       aes(x = x, y = y, fill = infectious_gp)) +
  geom_tile()

ascotraceR documentation built on Dec. 20, 2021, 5:07 p.m.