Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 626149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:23:13+00:00 2026-05-13T19:23:13+00:00

I have 30 runs of data, each stored in a separate CSV file, runi.csv,

  • 0

I have 30 runs of data, each stored in a separate CSV file, runi.csv, i = 0:29.

Let’s say I want to collect them all into a list. Best way I know how to do this is

runs = list()
for (i in 1:30) { runs[[i]] = read.csv(paste("run", i-1, ".csv")); }

Now let’s further say that each of these data frames stored in the list has the same column layouts and that I’m interested in the column identified by “x” and the column identified by “y”.

What is the easiest way to plot all 30 runs’ worth of (x, y) pairs? Here’s how I would currently do it (and I feel there must be a better way):

xList = list()
yList = list()
for (i in 1:30) { xList[[i]] = runs[[i]]$x; yList[[i]] = runs[[i]]$y; }
matplot(x=as.data.frame(xList), y=as.data.frame(yList))

This gets even more painful when I’m trying to do transformations to the data; I can’t figure out how to apply a function to a specific column of each data frame stored in a list.

Any help here would be extremely helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:23:14+00:00Added an answer on May 13, 2026 at 7:23 pm

    It is probably best to use an l*ply function (from plyr) or lapply when dealing with lists like this.

    The easiest way to do the import is probably like so:

    library(plyr)
    runs <- llply(paste("run",1:30,".csv",sep=""), read.csv)
    

    Here’s one way to plot them:

    # some dummy data
    runs <- list(a=data.frame(x=1:5, y=rnorm(5)), b=data.frame(x=1:5, y=rnorm(5)))
    par(mfrow=c((length(runs)/2),2));
    l_ply(1:length(runs), function(i) { plot(runs[[i]]$x, runs[[i]]$y) })
    

    Of course, you can also output this to another device (e.g. pdf) and not use par().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame consisting of results from multiple runs of an experiment,
I have a controller that runs some calculation on data, and then I need
I have created a data base that comes in an installer that runs as
For example I have a mysql query that gets some data. Then runs another
I have program that runs fast enough. I want to see the number of
I have some code that runs a model in a loop. Each iteration of
I have a Python program that runs a series of experiments, with no data
A text file holds information about a softball team. Each line has data arranged
I have a Resque job which pulls a csv list of data off of
I have a bunch of web servers(frontends) behind balancer. Each apache process runs with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.