[R] Fill in empty spaces modified

David Winsemius dwinsemius at comcast.net
Thu Aug 10 01:01:39 CEST 2017


> On Aug 9, 2017, at 3:39 PM, Ek Esawi <esawiek at gmail.com> wrote:
> 
> Thank you so much Jim. I forgot to state that i was hoping to get it
> without loops if possible.
> 

> library(zoo)

> is.na(eedf$nam) <- eedf$nam == ""
> eedf$nam <- na.locf(eedf$nam)
> eedf
    nam val
1 mandy   1
2 mandy   2
3  John   3
4  John   4
5  John   5
6  John   6
7  Zara   7
8  Zara   8

> Thanks again,
> 
> EK
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   -Gehm's Corollary to Clarke's Third Law



More information about the R-help mailing list