As we dig deeper into Stata or R debate, a few questions have come up.

We can rewrite it as-is using for loops in R, which is slow and not elegant. What's the elegant way to write this in R? I haven't used plyr yet... Time to learn it?

Link to question on StackOverflow

**Question 1**: One of the things Stata does well is the way it constructs new variables (see example below). How to do this in R?We can rewrite it as-is using for loops in R, which is slow and not elegant. What's the elegant way to write this in R? I haven't used plyr yet... Time to learn it?

Link to question on StackOverflow

Assuming popA1989, popB1989 ... already exist in data.frame dat.

ReplyDeleterequire(stringr)

pop <- LETTERS[1:4]

years <- 1990:2000

for(i in years){

dat[str_c(str_c("pop",pop),i)] <- dat[str_c(str_c("pop",pop),i-1)]*(1+dat[rep(str_c("trend",i-1),length(pop))])

}

Thank you for your attention in informing well to known facts. Nice review! Also turn your attention that it needs to search for mobile software development companies if you need .

ReplyDeleteNice code. Thanks for sharing

ReplyDeleteyour giving code very good now i solve my equation thanks for share it annotated bibliography generator .

ReplyDelete