Simulate AR(1) with a matrix of returns in R

I downloaded the closing prices of stocks. Then I computed the returns and saved in a matrix. Now i want to simulate an AR(1) with the value of the returns. How can i do it?

P.S - in R studio

• Welcome to Stats.SE. Take the opportunity to take the tour( stats.stackexchange.com/tour), if you haven't done it already. See also some tips on how to ask and on formatting help and write down equations using LaTeX / MathJax. If your question is clear and focused on your specific difficulty and you show your effort in solving the problem, it's more likely to get good and helping answers. – Ertxiem - reinstate Monica Jul 15 at 15:36
• You can use arima.sim() for this. – user2974951 Jul 17 at 7:01