Hi, On Monday, February 23, 2015, Alexandra Catena <amc5...@gmail.com> wrote:
> The command, data[data ==9999] <- NA, worked! Thank you! > > But just in case you wanted to know, I'm downloading the data and > unzipping it through readLines. I then concatenate two columns ( wind > speed and direction) from the unzipped data through cbind but I make > it into a data frame. > > wind = data.frame(cbind(windSpeed,windDirec)) It's better (shorter, more efficient, avoids coercion problems) to omit the cbind(): Wind <- data.frame(windSpeed, windDirec) Sarah > > > Thanks, > Alexandra > > On Sat, Feb 21, 2015 at 10:38 PM, Frederic Ntirenganya > <ntfr...@gmail.com <javascript:;>> wrote: > > If you are reading the data frame using for instance read.csv, you can > put > > in the argument na.string ="9999". > > Another way to do that is data[data ==9999] <- NA. > > > > It should be good to tell us how you are reading your dataset. > > > > On Feb 21, 2015 6:49 AM, "Jeff Newmiller" <jdnew...@dcn.davis.ca.us > <javascript:;>> wrote: > >> > >> You did not say how you imported the data, but if you used one of the > >> read.table variants (including read.csv) then you can use the na.strings > >> argument as documented in the help file for read.table. > >> > >> Next time please read the posting guide, as there are some useful tips > in > >> there, such as posting using plain text (a setting in your email > program) so > >> we don't get garbled info from you, and providing a reproducible > example. > >> > >> > --------------------------------------------------------------------------- > >> Jeff Newmiller The ..... ..... Go > >> Live... > >> DCN:<jdnew...@dcn.davis.ca.us <javascript:;>> Basics: ##.#. > ##.#. Live > >> Go... > >> Live: OO#.. Dead: OO#.. Playing > >> Research Engineer (Solar/Batteries O.O#. #.O#. with > >> /Software/Embedded Controllers) .OO#. .OO#. > >> rocks...1k > >> > >> > --------------------------------------------------------------------------- > >> Sent from my phone. Please excuse my brevity. > >> > >> On February 20, 2015 10:55:30 AM PST, Alexandra Catena < > amc5...@gmail.com <javascript:;>> > >> wrote: > >> >Hello All, > >> > > >> >I have a data frame of two columns for wind. The first column is for > >> >wind > >> >speed and the second wind direction. I'm trying to replace the 9999 > >> >values > >> >in the first column and the 999 values in the second column with NA. I > >> >tried to use the function ltdl.fix.df but it doesn't seem to do > >> >anything. > >> > > >> >> ltdl.fix.df(windMV, zero2na = FALSE, coded = 999) > >> > > >> > n = 9432 by p = 4 matrix checked, 0 NA(s) present > >> > > >> > 0 factor variable(s) present > >> > > >> > 5675 value(s) coded 999 set to NA > >> > > >> > 0 -ve value(s) set to +ve half the negative value > >> > > >> > > >> >I have R version 3.1.1 > >> > > >> >Thanks, > >> >Alexandra > >> > > -- Sarah Goslee http://www.stringpage.com http://www.sarahgoslee.com http://www.functionaldiversity.org [[alternative HTML version deleted]] ______________________________________________ R-help@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.