 # Split in two periods

Hi everyone, I need help to split in two periods a data set of price of equities. So from A1 to An i have the price for each equity (A1 first company, A2 second company etc), from 1 to n, I have the periods. How can I split this sample in two periods?

Thanks & Regards

What do you mean with "from A1 to An" and "from 1 to n"? Rows and columns?
Can you describe it better, or share a (snippet) of your dataset for a better understanding?
See: FAQ: How to do a minimal reproducible example ( reprex ) for beginners

elements = diff(as.matrix(log(elements)),1)

mu = apply(elements, 2, mean)

sigma = cov(elements)
sigma_inv = solve(sigma)

gamma = 3

w = (1/gamma)sigma_inv%%mu

daily_returns = elements%*%w
compound = c()
compound = c(compound, daily_returns)

for (i in 2:nrow(daily_returns)) {
compound = c(compound, compound[i-1] + daily_returns[i])
}
plot(compound, type = "l",main="Let’s give it a try",xlab="# Days",ylab="# Coumpounded performance")

This is not reproducible since we don't have access to your local files, could you please turn this into a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

I am trying to update the csv file, but I can't.
So basically I have a table in which each column is a company and each line is the return, the table has 1950 lines and 452 column and this is the sample. I have to split in two periods this sample. How can I do it?

Thanks

There is no need to upload the file, if you want to increase your chances of getting help, read the link I gave you to learn how to include sample data on a copy/paste friendly format.

With data you might receive a complete solution, however even without the data we might give you a hint.