Dear Arun and Jim, Thanks for your replies. I will be extremely careful next time.Anyway, here is the dput format of dat > dput(dat) structure(list(Date = c("1-Jan-61", "2-Jan-61", "3-Jan-61", "4-Jan-61", "5-Jan-61", "6-Jan-61", "7-Jan-61", "8-Jan-61", "9-Jan-61", "10-Jan-61"), A = c(0, 6.1, 0, 0, 0, 0, 0, 0, 0, 0), B = c(1.27, 9.144, 0.508, 0, 0, NA, 0, NA, NA, 4.064), C = c(8.128, 94.742, 1.27, NA, 0, 0, 0, 0, 0, 4.826), D = c(0.25, 15.49, 0, 0, 0, 0, 0, 0, NA, 0.76)), .Names = c("Date", "A", "B", "C", "D"), class = "data.frame", row.names = c(NA, -10L)) > dput(res) structure(list(A = c("", "", ""), B = c("6-Jan-61", "8-Jan-61", "9-Jan-61"), C = c("4-Jan-61", "", ""), D = c("9-Jan-61", "", "")), .Names = c("A", "B", "C", "D"), row.names = c(NA, -3L), class = "data.frame") Eliza
> Date: Wed, 19 Mar 2014 12:11:43 -0700 > From: smartpink...@yahoo.com > Subject: Re: [R] reading row title > To: eliza_bo...@hotmail.com > > BTW, if you had looked at your post, you would understand how HTML mangled > your post.á It is better to dput().á You are posting for sometime now, so I > hope you understand it... > > > > > On Wednesday, March 19, 2014 3:04 PM, arun <smartpink...@yahoo.com> wrote: > Hi, > > dat <- read.table(text="Dateáá Aááá Báá Cááá D > 1-Jan-61áá 0.00á 1.27áá 8.128á 0.25 > 2-Jan-61 6.10 9.144 94.742 15.49 > 3-Jan-61á 0.00 0.508á 1.27 0.00 > 4-Jan-61á 0.00á 0á NA 0.00 > 5-Jan-61á 0.00á 0á 0 0.00 > 6-Jan-61áá 0.00á NAá 0 0.00 > 7-Jan-61á 0.00á 0á 0 0.00 > 8-Jan-61á 0.00á NAá 0 0.00 > 9-Jan-61á 0.00á NAá 0 NA > 10-Jan-61 0.00 4.064 4.826 0.76",sep="",header=TRUE,stringsAsFactors=FALSE) > > res <-á as.data.frame(apply(dat[,-1],2,FUN=function(x) {x1 > <-dat[,1][is.na(x)]; x2 <- max(colSums(is.na(dat[,-1]))); if(length(x1) < x2) > c(x1, rep("",x2-length(x1))) else x1}),stringsAsFactors=FALSE) > > > A.K. > > > > On Wednesday, March 19, 2014 2:39 PM, eliza botto <eliza_bo...@hotmail.com> > wrote: > Dear R-Family, > I have a data-set of the following format. I am only presenting a part of it. > Dateá á á á á á á á Aá á á á á á á áá Bá á á á á á á á á á á á áá Cá á á á á > á á á á á á á á á á á áá D > > > > > > > > á 1-Jan-61 > á 0.00 > á 1.27 > á 8.128 > á > á 0.25 > > > á > 2-Jan-61 > á > 6.10 > á > 9.144 > á > 94.742 > á > á > > 15.49 > > > > > á 3-Jan-61 > á 0.00 > á 0.508 > á 1.27 > á > á > 0.00 > > > > > á 4-Jan-61 > á 0.00 > á 0 > á NA > á > á > 0.00 > > > > > á 5-Jan-61 > á 0.00 > á 0 > á 0 > á > á > 0.00 > > > > > á 6-Jan-61 > á 0.00 > á NA > á 0 > á > á > 0.00 > > > > > á 7-Jan-61 > á 0.00 > á 0 > á 0 > á > á > 0.00 > > > > > á 8-Jan-61 > á 0.00 > á NA > á 0 > á > á > 0.00 > > > > > á 9-Jan-61 > á 0.00 > á NA > á 0 > á > á > NA > > > > > á > 10-Jan-61 > á > 0.00 > á > 4.064 > á > 4.826 > á > > > á > 0.76 > > You can see that each column has some NAs in it, What i want to do is to > learn that which date has NA for each column. > Here it should be something like the following > > Aá á á á á á á á á á á á á áá Bá á á á á á á á á á á á á á á á Cá á á á á á á > á á á á á á á á á á á á á D > á á á á á á á á á á áá 6-Jan-61á á á á á á á á á á á á áá 4-Jan-61á á á á á á > á á á á á áá 9-Jan-61 > á á á á á á á á á á áá 8-Jan-61 > á á á á á á á á á á áá 9-Jan-61 > > Thankyou very much in advance > > Eliza ááá áááá ááá áá ááá ááá á > ááá [[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. > [[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.