# Calculating correlation between monthly precipitation and tree ring data using the dcc function

Hello @Obby , welcome in the community.

If you are new to R I can imagine that you meet some problems on your way.
From your post I see that somewhere (?) a list is passed where a vector is expected.
See the example below that gives a similar error.

So how to solve this?

Check at which point the error occurs.
See if there are any warnings before that point: these could point to the actual problem.
You use two input files: do they look alright (similar to previous ones if the code was run before) ?

Because we don't have your data, we can not reproduce your error.
Maybe it is possible to provide a small example of the two files so that we can have a look?
See e.g. How to do a minimal reproducible example .

In saying this I assume that the packages `dplR`, `treeclim` and `TRADER` (that are unknown to me) are publicly available. If they are not needed in this part of the code remove them in your post to create 'minimal reproducible examples'.

``````# this will work
from = c('1',"2")
if (is.character(from)) from <- as.numeric(from) else from
print(from)
#> [1] 1 2
is.finite(from)
#> [1] TRUE TRUE

#this will work
from = c(1,2)
if (is.character(from)) from <- as.numeric(from) else from
#> [1] 1 2
print(from)
#> [1] 1 2
is.finite(from)
#> [1] TRUE TRUE

#this will not work
from = list('1',"2")
if (is.character(from)) from <- as.numeric(from) else from
#> [[1]]
#> [1] "1"
#>
#> [[2]]
#> [1] "2"
print(from)
#> [[1]]
#> [1] "1"
#>
#> [[2]]
#> [1] "2"
is.finite(from)
#> Error in is.finite(from): default method not implemented for type 'list'

#this will not work
from = list(1,1)
if (is.character(from)) from <- as.numeric(from) else from
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 1
print(from)
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] 1
is.finite(from)
#> Error in is.finite(from): default method not implemented for type 'list'
Created on 2021-11-29 by the reprex package (v2.0.0)
``````