Hi, I have this dataset where columns z1.3 and z1.4 are full of NA's. I want to perform some calculations in the remaining columns, but after doing this, I want to recontruct the original matrix. I can with:
out <- which( colMeans( is.na( z ) ) == 1 ) gd<-z[, - out] select the columns full of NA's and those without that pattern. Then after doing the calculus I need to reconstruct z as it was in its origin (z1.1,z1.2,...,z1.6) BTW:The z matrix is a zoo object Thanks, Antonio > dput(z,control="all") structure(c(16.7250003814697, 16.5, 16.6875, 15.8999996185303, 16.0500001907349, 16.2000007629395, 16.5, 16.2000007629395, 15.8999996185303, 16.3499984741211, 16.2749996185303, 16.875, 16.875, 15.8999996185303, 15.8999996185303, 16.9500007629395, 17.4375, 18.1124992370605, 19.0499992370605, 16.7250003814697, 16.5, 16.7249984741211, 15.8999996185303, 15.8999996185303, 15.8999996185303, 16.4249992370605, 16.0499992370605, 16.2000007629395, 16.3499984741211, 15.8625001907349, 17.0249996185303, 16.7999992370605, 16.2000007629395, 16.2000007629395, 16.875, 17.4750003814697, 18.2249984741211, 19.0499992370605, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 16.7250003814697, 16.5750007629395, 16.5, 15.6750001907349, 15.9749999046326, 16.2749996185303, 16.6499996185303, 16.2749996185303, 16.1625003814697, 16.2374992370605, 16.2749996185303, 17.0249996185303, 16.7250003814697, 16.5750007629395, 16.8500003814697, 16.7999992370605, 17.7374992370605, 18.2250003814697, 18.75, 16.6124992370605, 16.3875007629395, 16.59375, 15.6000003814697, 15.9000005722046, 16.2000007629395, 16.5750007629395, 16.1437511444092, 16.0125007629395, 16.2937507629395, 16.1999988555908, 16.875, 16.6312503814697, 16.7999992370605, 17.1749992370605, 16.9500007629395, 17.7999992370605, 18.1687507629395, 18.75, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), .Dim = as.integer(c(19, 6)), .Dimnames = list(NULL, c("z1.1", "z1.2", "z1.3", "z1.4", "z1.5", "z1.6")), index = structure(c(5491, 5499, 5507, 5515, 5523, 5531, 5539, 5547, 5555, 5563, 5571, 5579, 5587, 5595, 5603, 5611, 5619, 5627, 5635), class = "Date"), class = "zoo") -- ===== Por favor, si me mandas correos con copia a varias personas, pon mi dirección de correo en copia oculta (CCO), para evitar que acabe en montones de sitios, eliminando mi privacidad, favoreciendo la propagación de virus y la proliferación del SPAM. Gracias. ----- If you send me e-mail which has also been sent to several other people, kindly mark my address as blind-carbon-copy (or BCC), to avoid its distribution, which affects my privacy, increases the likelihood of spreading viruses, and leads to more SPAM. Thanks. ===== Antes de imprimir este e-mail piense bien si es necesario hacerlo: El medioambiente es cosa de todos. Before printing this email, assess if it is really needed. ______________________________________________ R-help@stat.math.ethz.ch 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.