Yolande, Attached files are usually deleted from the r-help list and I see no sign of your file.
You can use the function dput() to output the your file in a format that you can paste into your email and which other readers can paste into R and use. See ?dput for more information. John Kane Kingston ON Canada > -----Original Message----- > From: yolande....@gmail.com > Sent: Mon, 16 Jul 2012 11:17:43 -0400 > To: r-help@r-project.org > Subject: [R] as.xts > > Hello, > > Attached is the file created from as.xts. After submitting the following > code, I got an error. Please help. Thanks. > diveCond <- data.frame(matrix(0, nrow=61, ncol=17)) > names(diveCond) <- c("dive_id", "timestamp", "visability", "r_wvht", > "r_dpd", "r_apt", "r_mwd", "r_wtmp", "l_salinity", "l_o2", "l_hs", > "l_tp", > "l_wdir", "l_along", "l_cross", "l_mab", "l_depth") > dive_id <- 0 > for(i in unique(as.character(index(diveData_2008)))){ > dive_id <- dive_id+1 > diveCond$dive_id[dive_id] <- dive_id > diveCond$timestamp[dive_id] <- as.character(i) > diveCond$visability[dive_id] <- > as.numeric(diveData_2008[i][1,11]) > > } > Error in if (length(c(year, month, day, hour, min, sec)) == 6 && c(year, > : > missing value where TRUE/FALSE needed > In addition: Warning messages: > 1: In as_numeric(YYYY) : NAs introduced by coercion > 2: In as_numeric(YYYY) : NAs introduced by coercion > > Thanks, > Yolande > ______________________________________________ > 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. ____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! ______________________________________________ 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.