0

Hi I have several RData files with the same file name and object name. For example one of the file names is int.5.RData where the dataframe int.5 is saved. I have several similar files with names int.5.RData, int.10.RData, and so on. Now I have to load them and assign a same variable name (say new.int) to the data frames( int.5, int.10, etc) in a for loop. I can load them by using load(paste0("int",i,".RData")) in the for loop where i is c(5,10,...), But I am stuck with the next step where I have to assign the data frames (int.5, int.10,etc) the same name, int.new in the same loop as I can't use pastecommand for that operation. Can anybody help me here?

2
  • 1
    Better to read the data into a list. See gregor's answer here. Commented Jul 6, 2017 at 12:10
  • can you post what you've done already in full in addition to describing it? Commented Jul 6, 2017 at 12:42

1 Answer 1

1

Look at assign..

Edit:

In that case look at get function:

> a <- 5
> get("a")
[1] 5
Sign up to request clarification or add additional context in comments.

1 Comment

I had a look at assign already. But in my case nam is always same (i.e. new.int) and the objects this name be assigned to is different everytime (i.e. int.5, int.10, etc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.