Re: [R] zero fill empty cell in data.frame

2011-04-19 Thread Kenn Konstabel
On Tue, Apr 19, 2011 at 1:45 PM, Rolf Turner wrote: > On 19/04/11 21:39, Simone Gabbriellini wrote: >> >> Hello List, >> >> I have a data frame like: >> >>        V130    V131    V132    V133    V134    V135    V136 >> 1       0               0               0.9             0 >> 0.9             0

Re: [R] zero fill empty cell in data.frame

2011-04-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.04.2011 12:02:31: > On 04/19/2011 07:39 PM, Simone Gabbriellini wrote: > > Hello List, > > > > I have a data frame like: > > > >V130 V131 V132 V133 V134 V135 V136 > > 1 0 0 0.9 0 0.9 0 0 > > 2 0

Re: [R] zero fill empty cell in data.frame

2011-04-19 Thread Rolf Turner
On 19/04/11 21:39, Simone Gabbriellini wrote: Hello List, I have a data frame like: V130V131V132V133V134V135V136 1 0 0 0.9 0 0.9 0 0 2 0 0 0

Re: [R] zero fill empty cell in data.frame

2011-04-19 Thread Jim Lemon
On 04/19/2011 07:39 PM, Simone Gabbriellini wrote: Hello List, I have a data frame like: V130V131V132V133V134V135V136 1 0 0 0.9 0 0.9 0 0 2 0 0

Re: [R] zero fill empty cell in data.frame

2011-04-19 Thread Dimitris Rizopoulos
you could try something along these lines: DF <- data.frame(V1 = c(0, 0.9, " ", 0.8, 0.1, 0), V2 = c(0.9, " ", 0.8, 0.7, " ", 1)) DF sapply(DF, function (x) as.numeric(gsub("(^ +)|( +$)", "0", x))) I hope it helps. Best, Dimitris On 4/19/2011 11:39 AM, Simone Gabbriellini wrote: H