Hi all:
Non-Stata user here trying to work through translating some Stata code that as left behind by a former team member into R code. For the most part, the syntax makes intuitive sense to me, but I wanted to double-check my interpretation of a short variable renaming piece where renvars was used.
Here's an example that parallels the actual statements and the variable names and other arguments.
frame new_frame {
keep if event=="event_1"
keep pid language event date///
p_sc_site ///
p_xvar1 p_xvar2 p_xvar3
rename p_sc_site site
renvars p_*, presub(p_ )
}
After a few Google searches and searching here, my best guess about this renvars statement is that the presub(p_ ) [(p underscore space)] specification is telling renvars to remove the p_ [p underscore] prefix from the beginning of the p_xvar variable names.
Am I on the right track, or is something else going on here?
Thanks so much!
Non-Stata user here trying to work through translating some Stata code that as left behind by a former team member into R code. For the most part, the syntax makes intuitive sense to me, but I wanted to double-check my interpretation of a short variable renaming piece where renvars was used.
Here's an example that parallels the actual statements and the variable names and other arguments.
frame new_frame {
keep if event=="event_1"
keep pid language event date///
p_sc_site ///
p_xvar1 p_xvar2 p_xvar3
rename p_sc_site site
renvars p_*, presub(p_ )
}
After a few Google searches and searching here, my best guess about this renvars statement is that the presub(p_ ) [(p underscore space)] specification is telling renvars to remove the p_ [p underscore] prefix from the beginning of the p_xvar variable names.
Am I on the right track, or is something else going on here?
Thanks so much!
Comment