# Split Vector and apply Mann Kendall test

#### Morten

##### New Member
I have a long vector of financial time series information, price and volume. I expand the price vector based on the volume vector so I essentially get a price per share traded, and so only one vector is analyzed.
I would like to split this vector into lengths of 17500 each, and apply the Mann-Kendall trend analysis on each of these new vectors.
Below is the code I have for this.

I am getting an error from the Mann Kendall test, as this split method is producing outputs as a list.

Is there a way to either create a new vector and run the Mann Kendall test on each vector, with the output from each test easily acessible?

Code:
library(Kendall)

priceexp <- rep(price, volume)

max <- 17500
xx <- seq_along(priceexp)
d1 <- split(priceexp, ceiling(xx/max))

for(i in (1:length(d1))) {
MannKendall(d1[i])
}
I have attached a txt file with the two vectors "price" and "volume".

Last edited:

#### trinker

##### ggplot2orBust
Your question isn't reproducible. Please supply a data source so that we can more easily view the problem.