[R] What is SAS options missing=0 equivalent in R?
peter dalgaard
pdalgd at gmail.com
Tue Apr 2 17:11:09 CEST 2013
On Apr 2, 2013, at 16:49 , ramoss wrote:
> I have a dataframe & wish to convert the NA (missing values) to zero . In SAS
> I would use options missing=0 to convert all my obs in a dataset. How can I
> accomplish the same thing in R? Can it be done? Thanks for any thoughts on
> this.
>
The straightforward way would be
d[is.na(d)] <- 0
---with some caveats if you have non-numeric data in some columns.
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/What-is-SAS-options-missing-0-equivalent-in-R-tp4663090.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help
mailing list