[R] User input(unknown name and number of files)
jwiley.psych at gmail.com
Fri Jul 22 21:26:53 CEST 2011
On Fri, Jul 22, 2011 at 12:15 PM, Bansal, Vikas <vikas.bansal at kcl.ac.uk> wrote:
> Dear all,
> I need your help as I was not able to find out the solution.I sent this message before but did not get any help.Please help me.
You only sent the message yesterday!!! (then again a few hours ago,
and *again* just now)
rather than hard code what you are doing, create a function that takes
a data file and outputs the type of data you want. Then just:
lapply(c("file1", "file2", etc.), yourfunction)
will create a list of all the output.
> The thing is-
> I am having a code which is reading file with this code-
> but as am making a tool so that user can use it and can do analysis on his file.But the name of the file will not be Case2.pileup and I want to use this code so that user can input as many files as he want.My code is like this-
> df$V9 <- apply(df, 1, function(x) gsub("\\:|\\$|\\^|!|\\-|1|2|3|4|5|6|7|8|10", "",x))
> df$V10 <- sapply(df$V10, function(a)
> paste(as.integer(charToRaw(a)), collapse = ' '))
> capture.output(print.data.frame(df,row.names=F), file = "end.txt", append = FALSE)
> I know it should do it with for loop and an array.I want that if user input 12 files,the dataframe name df should be different for all the 12 files.
> Can you please tell me how can I do this.
> Thanking you,
> Warm Regards
> Vikas Bansal
> Msc Bioinformatics
> Kings College London
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Ph.D. Student, Health Psychology
University of California, Los Angeles
More information about the R-help