Hi All, I have the data in the following format:
idkt saap lahto pidg 5266 19911111 19911114 3078A 5266 19921005 19921030 2968A 6666 19930208 19930209 3074A 6666 20020329 20020402 F322 6666 20020402 20020409 F322 6866 19810713 19810917 29800 6866 19811109 19811120 29550 6866 19820203 19820219 29550 I would like to parse the data and reformat into a single row for each unique idkt, something like: 5266 19911111 19911114 3078A 19921005 19921030 2968A I have tried with f <- read.table("file.txt", sep="\t", header=TRUE); attach(f); fac <- factor(f[,1]); id <- matrix(length(fac), 4); for(i in fac) id[i] <- f[idkt %in% fac[i], ]; I am not able make the list id into a single row. Could you please help how I can do this? Thanks in advance. Kind regards, Ezhil ______________________________________________ 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.