[R] saving rounded numbers as a new variable in a dataframe

Bob Green bgreen at dyson.brisnet.org.au
Mon Jun 19 14:11:57 CEST 2006



A basic question, but one that eludes me. I have created a new variable 
$numurder, which I have rounded off. I want to save the rounded off version 
of this variable to an existing datafile called 'ngri.csv' .

  numurder   <-c((murder*no.of.cases)/100)
[[1]]
  [1]  48.952 112.073 182.160 974.610 122.140 663.432 150.856  18.988 
137.925 198.045  68.930 203.148  30.056 100.955


round(numurder, 0)
  [1]  49 112 182 975 122 663 151  19 138 198  69 203  30 101


Advice regarding how to do this is appreciated,

Bob



More information about the R-help mailing list