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
as.xts
3 messages · Yolande Tra, John Kane, David Winsemius
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.tra at gmail.com
Sent: Mon, 16 Jul 2012 11:17:43 -0400
To: r-help at 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 at 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!
On Jul 16, 2012, at 1:26 PM, John Kane wrote:
Yolande, Attached files are usually deleted from the r-help list and I see no sign of your file.
If you said that most attached files are scrubbed because posters did not read the Posting guide to determine which file types were acceptable, then you would be correct. But you give the impression that files are always scrubbed. This is not true. Attached are two small files, a mime-text file and a pdf file. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: Small.txt URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120716/a3bc2a64/attachment.txt> -------------- next part -------------- -------------- next part -------------- A non-text attachment was scrubbed... Name: small2.pdf Type: application/pdf Size: 4466 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20120716/a3bc2a64/attachment.pdf> -------------- next part --------------
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.tra at gmail.com
Sent: Mon, 16 Jul 2012 11:17:43 -0400
To: r-help at 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
David Winsemius, MD no longer living in West Hartford, CT