Dear R listers,

I'm trying use Huber's m-estimator on a dataset, which works fine so  
far.

In the next step I would like to assign a (frequency) weight to the  
observations.
It seemed straight forward to me to replicate the rows according to  
their count variable.

Unfortunately,  a solution provided by jim holtman on Wed 19 Oct 2005  
in this list doesn't work for me:

 > y <- unlist(lapply(seq(nrow(x)), function(.row)rep(.row, x$count 
[.row])))
# replicate the row numbers
 > y
 > result <- x[y,] # pick out the rows
 > result$count <- 1 # set the count to 1
 > result

R keeps crashing. I presume because of 800,000 rows, which should be  
produced.

Does a smarter solution exist for weighting the observations  
according to their frequency than manually replicating rows when  
using the huber function?

Thanks for any help!

Daniel Metzler

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to