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 8591061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:26:22+00:00 2026-06-11T23:26:22+00:00

I have 2 datasets: Data1: Var1 Var2 Var3 Var4 10 10 2 3 9

  • 0

I have 2 datasets:

Data1:

Var1 Var2   Var3    Var4
10    10      2   3
9      2      8   3
6      4      4   8
7      3     10   8

Data2:

Var1 Var5   Var3    Var6
  3    6      6   4
  1    2      5   1
  9    2      2   9
  2    6      3   2

Now I want to append this 2 datasets

Final Data:

Var1  Var2    Var3  Var4  Var5 Var6
10      10       2     3        
9        2       8     3        
6        4       4     8        
7        3      10     8        
3                      4     6    6
1                      1     2    5
9                      9     2    2
2                      2     6    3

I can’t use rbind to create this dataset. Can anybody please tell me the method to create this dataset? Also, suppose I want to append multiple (more than 2) datasets. What’s the procedure?

  • 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-11T23:26:23+00:00Added an answer on June 11, 2026 at 11:26 pm
    # Open a new directory and keep only the data files to be combined
    combinedfiles <- function(){
      # nullVar: Creating a Null Variable using as.null function
        nullVar <- function(x){ 
        x <- getwd(); 
        x <- as.null(x); 
        }
    
      # readTab: Read file using read.table function
        readTab <- function(y) { 
        read.table(y, header=TRUE, sep = " ") 
        }
    
        objectcontent <- nullVar(x);    
    
        for (i in 1:length(list.files(getwd()))) {
        y <- list.files(getwd())[i];
        objectcontent <- rbind(objectcontent, readTab(y));
        i <- i + 1
        }
      return(objectcontent)
    }
    
    #Then type the following in the console
      combinedfiles()
    

    a version using apply loops (which do not suffer from the rbind slowdown):

    combined_files = function(file_path, extension = "csv") {
       require(plyr)
       file_list = list.files(file_path, pattern = extension)
       data_list = lapply(file_list, read.table, header = TRUE, sep = " ")
       combined_data = do.call("rbind.fill", data_list)
       return(combined_data)
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an asp.net application, and now I am using datasets for data manipulation.
I have a DataSet similar to the one below: ID Name Data1 Data2 1
I have multiple datasets I want to plot in a single figure: plot data1a.txt,
Interpolating Large Datasets I have a large data set of about 0.5million records representing
I have been given 2 data sets and want to perform cluster analysis for
I have multiple datasets that I would like to combine into one. There is
I have a DataSet with multiple tables (distinct schema). I want to generate table
One thing I have in mind is, that datasets in Core Data (or lets
What is the best way for me to have several datasets ? i've thought
I'm using Python 2.6, and I have two datasets, each being a list of

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.