How can I impute the values of a variable in an XDF file?

One way to accomplish this is to use 'rxDataStep' and the 'impute' function from the R package 'Hmisc'.


Here is some sample R code to impute the average cost per claim: <- data.frame(AgeLevel=factor(c(rep("17-20",4),      rep("21-24",4),rep("25-29",4),rep("30-34",4),      rep("35-39",4),rep("40-49",4),rep("50-59",4),      rep("60+",4))), = factor(rep(c("A","B","C","D"),8)),      Veh.Age=factor(rep(c(rep("0-3",4),rep("4-7",4),rep("8-9",4),      rep("10+",4)),2)),      AvgCost.claim = c(289,372,189,763,282,249,288,850,133,288,179,              NA,160,11,NA,NA,302,420,268,407,194,243,343,320,135,196,293,205,166,135,104,NA),   claims.weights = c(8,10,9,3,8,28,13,2,4,1,1,0,1,1,0,0,18,59,44,24,31,96,39,18,10,13,7,2,4,3,2,0)) rxDataFrameToXdf(data =, outFile = "")  install.packages("Hmisc") library(Hmisc)  rxDataStep(inData = "", outFile = "", transforms = list(AvgCost.claim.New = impute(AvgCost.claim)),  transformPackages = "Hmisc")  rxSummary( + AvgCost.claim, data = "", fweights ="claims.weights")
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Id. de artículo: 3104218 - Última revisión: 10/29/2015 06:28:00 - Revisión: 1.0

Revolution Analytics

  • KB3104218