Grouping stock data by identifier and creating new columns with data.table

Hi @Pia! Welcome! I’m glad to see someone here was able to get you unstuck! I hope you’ll keep posting questions as you keep learning :smile:.

You might also want to take a look at our Tips for Writing R-related Questions to learn about how to prepare your questions to get the best help here. For example, while it’s pretty natural for people to start out posting screenshots of their data, that’s actually a fairly heavy lift for your helpers (they have to re-type all your data by hand just to get started poking at your problem). The tips page links to several resources for learning more helper-friendly ways of composing your questions. :grinning: