Problems with dcc function of the treeclim package

Hello, I'm having problems trying to truncate the timespan of the correlation analysis when I'm using dcc function on treeclim package.

rpb.dcc<dcc(rpb.crn,precip,selection=.range("precip",-6:12),method="correlation",dynamic="moving",win_size=25,win_offset=5,start_last=TRUE,timespan=NULL,var_names="precip",ci=0.05,boot="stationary",sb=TRUE)

Both of my data start in 1902-2016 but I would like to truncate both in 1939-2016. When I type ...,timespan=(1939:2016)... R doesn't recognize the time interval. Can anyone help me with that?

Thanks for including some code. Next time it would help to have some data and the code in the form of FAQ: What's a reproducible example (`reprex`) and how do I do one?

Here's a solution, assuming your data set is in the form of norw015

> library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> library(tibble)
> library(treeclim)
Loading required package: Rcpp
> data(norw015)
> head(norw015)
        xxxstd samp.depth
1600 0.6317956          1
1601 0.3966429          1
1602 0.3718675          1
1603 0.4002325          1
1604 0.3752488          1
1605 0.5385194          1
> norw <- rownames_to_column(norw015, var = "year")
> head(norw)
  year    xxxstd samp.depth
1 1600 0.6317956          1
2 1601 0.3966429          1
3 1602 0.3718675          1
4 1603 0.4002325          1
5 1604 0.3752488          1
6 1605 0.5385194          1
> norw_years <- norw %>% filter(year > 1935)
> head(norw_years)
  year    xxxstd samp.depth
1 1936 0.9608494         34
2 1937 1.0050585         34
3 1938 0.9518574         34
4 1939 0.9265154         34
5 1940 0.8521800         34
6 1941 1.2747496         34
> norw_36 <- column_to_rownames(norw_years, var = 'year')
> head(norw_36)
        xxxstd samp.depth
1936 0.9608494         34
1937 1.0050585         34
1938 0.9518574         34
1939 0.9265154         34
1940 0.8521800         34
1941 1.2747496         34

Thank you very much, yes, my data is in the form of norw015. I'm going to apply it.

All the best

Daniela

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.