Hi, how are you? My name is Irucka Embry and I would like assistance on properly subsetting some data obtained from a .csv file.
> file <-"info_n.csv" > INFO<- getMetaDataFromFile(file) INFO is 92 observations of 14 variables > INFO<- subset(INFO,site.no==02169570) INFO is 0 observations of 14 variables When the site.no is used I should have 1 observation of 14 variables instead of 0. Can you assist me? Thank-you. Irucka Embry This is the function that is called: getMetaDataFromFile <- function(file, hasHeader = TRUE, separator = ",") { totalPath <- paste(file, sep = "") tmp <- read.csv(totalPath, header = hasHeader, sep = separator, fill = TRUE, comment.char = "#", as.is = TRUE, stringsAsFactors = FALSE, na.strings = "NA") retval <- as.data.frame(tmp, stringsAsFactors = FALSE) return(retval) } This is an example of the data that is stored in the "info_n.csv" file. There are 92 total sites in this file. site.no flowstation.no shortName dec.lat.va dec.long.va drainSqKm areaUnits drainSqKmFlow areaUnits staAbbrev param.nm paramShortName constitAbbrev param.units 2169570 2169570 Gills Creek at Columbia, SC 33.98960016 -80.97425727 152.7543752904 2 152.7543752904 2 GillsColumSC Total nitrogen, water, unfiltered, milligrams per liter Nitrate as N TN mg/L <span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!</font></font></span> [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.