Originally posted by Joseph Coveney
View Post

mata: if (cond) { // do something } (any other code) end
mata { if (cond) { // do something } }
mata: if (cond) { // do something } end
unexpected end of line
(# lines skipped)
mata: if (cond) { // do something } (any other code) end
mata: if (cond) { // do something } end
unexpected end of line
(# lines skipped)
. display strofreal(0.1254, "$5.1p") 12.5 . display strofreal(0.1254, "$5.1ps") 12.5%
mata: real scalar myfunction(real scalar input) { // Stuff here } end generate double b = myfunction(a)
> df <- data.frame("Serial_number" = 1:5, "Age" = c(20, 21, NA, 18, 19), "Name" = c("Johnny","Dorian","Linda", "Cathy", "Rick")) > df Serial_number Age Name 1 1 20 Johnny 2 2 21 Dorian 3 3 NA Linda 4 4 18 Cathy 5 5 19 Rick > > # Sort by age ascending order > newdf <- df[order(df$Age),] > newdf Serial_number Age Name 4 4 18 Cathy 5 5 19 Rick 1 1 20 Johnny 2 2 21 Dorian 3 3 NA Linda >
if a > 2 // Stata
if (a > 2) # R
na.rm = TRUE
capture log close
Leave a comment: