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

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

2020-07-03 Thread Kathan Desai
I have been trying to run a forloop for a function that compares dataframe n with dataframe n-1, across a list of dataframes. It does this by checking each midpoint of dataframe n with each midpoint of dataframe n-1. This is done to make up for an disparity in row length. The idea of this code is t

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

[R] Help with looping

2015-02-17 Thread Alexandra Catena
Hi, I need help with a for loop and printing data. I want to loop through a few years and print the data from each year stacked on top of each other. For example, for (i in 2000:2003){ #script for downloading each year Data = readLines(sprintf('file/%4i,i)) } It only prints out the data from th

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
, January 07, 2015 4:30 PM > To: 'r-help@r-project.org' > Subject: [R] help with looping a specific code > > 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). >

[R] help with looping a specific code

2015-01-07 Thread Haznadar, Majda (NIH/NCI) [E]
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 I would like to loop: > xr<-xcmsRaw("mh141210xg2_sccs_00101.CDF", profstep=0) > w