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

  • SEARCH
  • Home
  • 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 9131147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:05:47+00:00 2026-06-17T08:05:47+00:00

I have to load in many files and tansform their data. Each file contains

  • 0

I have to load in many files and tansform their data. Each file contains only one data.table, however the tables have various names.

I would like to run a single script over all of the files — to do so, i must assign the unknown data.table to a common name … say blob.

What is the R way of doing this? At present, my best guess (which seems like a hack, but works) is to load the data.table into a new environment, and then: assign('blob', get(objects(envir=newEnv)[1], env=newEnv).

In a reproducible context this is:

newEnv <- new.env()
assign('a', 1:10, envir = newEnv)
assign('blob', get(objects(envir=newEnv)[1], env=newEnv))

Is there a better way?

  • 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-06-17T08:05:48+00:00Added an answer on June 17, 2026 at 8:05 am

    I assume that you saved the data.tables using save() somewhat like this:

    d1 <- data.table(value=1:10)
    save(d1, file="data1.rdata")
    

    and your problem is that when you load the file you don’t know the name (here: d1) that you used when saving the file. Correct?

    I suggest you use instead saveRDS() and readRDS() for saving/loading single objects:

    d1 <- data.table(value=1:10)
    saveRDS(d1, file="data1.rds")
    blob <- readRDS("data1.rds")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my code extracts file icons(or even thumbs). however if i have many files it
i have some large SQL-Files with many INSERT INTO Statements. My Command: mysql> Load
When using snipmate + vim, is it possible to have many snippet files load
I have many, (15-20) different XML files that I need to load to VB.Net.
In our HTML page, we have a list of tags to load in many
i have many events such as $('.hidefile').click(function (event) { On page load and on
I have to load a kmz file in to the android application that i
I am facing long loading problem, otherwise keeping many swf(files) problem. I have decoration
I have a hierarchy of directories containing many text files. I would like to
I would like to combine many commits in to one. I have followed the

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.