Re: [R] Help with looping a function over a list of dataframes:

2020-07-04 Thread Jim Lemon
Hi Kathan, This is a very lazy answer as I haven't tested it. I think you will need to wrap your loop in a function and return the modified list_df to assign it like this: add_IDs<-function(xdf) { for(i in seq_along(xdf)) { xdf$position_tab_[[i]]$ID <- unlist(lapply(xdf$position_tab_[[i]]$mi

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
Alexandra, According to the documentation (?readLines), readLines returns a character vector with one line from the file being read in each element of the vector. You can put the character vector from each file (as represented by a year designation in your example) in a separate list element. Y

Re: [R] Help with looping

2015-02-17 Thread Rui Barradas
Hello, Try the following. Data <- lapply(sprintf('file/%4i', 2000:2003), readLines) This will give you a list with 4 elements, each of which is the contents of each file. Hope this helps, Rui Barradas Em 17-02-2015 18:15, Alexandra Catena escreveu: Hi, I need help with a for loop and pr

Re: [R] Help with looping

2015-02-17 Thread Mark Sharp
Alexandra, According to the documentation (?readLines), readLines returns a character vector with one line from the file being read in each element of the vector. You can put the character vector from each file (as represented by a year designation in your example) in a separate list element. Y

Re: [R] help with looping a specific code

2015-01-07 Thread Franklin Bretschneider
On 2015-01-07 , at 16:29, Haznadar, Majda (NIH/NCI) [E] wrote: > Hi, > > I would like to loop a specific code through multiple files ending in .CDF in > the same directory, but I am unsure of how to do that (new to R). > > Can someone please help me with this-thank you. > > This is the code

Re: [R] help with looping a specific code

2015-01-07 Thread PIKAL Petr
See ?list.files You can use it to populate object with files in working directory. Then you can use tis object in loop. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > Haznadar, Majda (NIH/NCI) [E] > Sent: Wednesday, January 07, 2015