Hi, I have a csv file with empty values, when I apply the different functions (mean, std, etc.) I create a new data frame, the empty values generate Inf and -Inf values. How can I remove those Inf and -Inf values from the new data frame? I already specified na.rm in the mean and std functions, but the values are still there. Thank you, Judith
Henrique Dallazuanna
2007-Jun-13 18:50 UTC
[R] Removing Inf and Inf values from a fata frame
Hi, try with df[!is.infinite(your_column_in_d.f.),] -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O<http://maps.google.com/maps?f=q&hl=en&q=Curitiba,+Brazil&layer=&ie=UTF8&z=18&ll=-25.448315,-49.276916&spn=0.002054,0.005407&t=k&om=1> On 13/06/07, Judith Flores <juryef@yahoo.com> wrote:> > Hi, > > I have a csv file with empty values, when I apply > the different functions (mean, std, etc.) I create a > new data frame, the empty values generate Inf and -Inf > values. How can I remove those Inf and -Inf values > from the new data frame? I already specified na.rm in > the mean and std functions, but the values are still > there. > > Thank you, > > Judith > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
?is.finite for removing the Infs *from the dataframe*, this does not aviod creating them by mean() or std(). Petr Judith Flores napsal(a):> Hi, > > I have a csv file with empty values, when I apply > the different functions (mean, std, etc.) I create a > new data frame, the empty values generate Inf and -Inf > values. How can I remove those Inf and -Inf values > from the new data frame? I already specified na.rm in > the mean and std functions, but the values are still > there. > > Thank you, > > Judith > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, reproducible code. >-- Petr Klasterecky Dept. of Probability and Statistics Charles University in Prague Czech Republic