[R] as.xts
Yolande Tra
yolande.tra at gmail.com
Mon Jul 16 17:17:43 CEST 2012
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
More information about the R-help
mailing list