WorldHealthOrganization / anthro

Computation of the WHO Child Growth Standards
https://worldhealthorganization.github.io/anthro/
GNU General Public License v3.0
29 stars 9 forks source link

Not able to save the results in a data frame #33

Closed pranjaldhaka3005 closed 4 years ago

pranjaldhaka3005 commented 4 years ago

I'm trying to analyse stunting in a sample survey data using the anthro_zscore function and wish to store the results in the data frame for further analysis. How do I save the returning results in a dataframe. Please help!

df30 <- first_born

with(

  • df30,
  • anthro_zscores(
  • sex = b4_01_ed,age = hw1_1,
  • weight = hw2_1_ed, measure = hw15_1_ed , lenhei = hw3_1_ed
  • )
  • )
dirkschumacher commented 4 years ago

You can use cbind to bind together data.frames by columns. See #32 for more info.

In your case something like that should work:

cbind(
  df30,
  with(
    df30,
    anthro_zscores(
      sex = b4_01_ed, age = hw1_1,
      weight = hw2_1_ed, measure = hw15_1_ed, lenhei = hw3_1_ed
    )
  )
)