I am using the following code but I do not know the debug and run for correct errors
library (tcltk) file <-tclvalue (tkgetOpenFile ()) if (nchar (file)) { tkmessageBox ("Select the file") } else { tkmessageBox (message = paste ("Was select file", file)) Dataset <- read.table (file, header = FALSE, sep = "", na.strings = "NA", dec =".", strip.white = TRUE) Dataset } input <- readLine (Dataset) input close (Dataset) input <- gsub ('*','', input) in.s <- strsplit (input, '') id <- sort (unique (unlist (in.s))) # Create the output matrix output <- matrix (0, ncol = length (id), nrow = length (in.s)) colNames (output) <- id for (i in seq_along (in.s)) { output [i, unlist (in.s [[i]])] <- 1 } write.csv (output, file = res.csv) Thanks -- View this message in context: http://r.789695.n4.nabble.com/strsplit-convert-data-tp3932704p3932704.html Sent from the R devel mailing list archive at Nabble.com. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel