I want to take specific rows from a dataset(f.e. datasetA) and add them to a subset or a different dataset, lets say datasetB. The row numbers and only the numbers that i want to take from datasetA are stored into a different dataset(datasetROWS), that only contains the row numbers that i want. How can i do that?
            Asked
            
        
        
            Active
            
        
            Viewed 38 times
        
    0
            
            
        - 
                    1Please provide a reproducible example. Instructions can be found here https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Riley Finn Oct 07 '19 at 14:55
- 
                    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Oct 07 '19 at 15:43
2 Answers
0
            
            
        newdataset<-rbind(datasetB,datasetA[datasetROWS,])
This assumes datasetROWS is a vector and that both datasetA and datasetB have the same columns.
 
    
    
        iod
        
- 7,412
- 2
- 17
- 36
-1
            
            
         library(tidyverse)
 Data_A <- datasetROWS %>%
    left_join(datasetA,by="row_numbers") #this is the variable you are joining by
 Concatenated_table<-rbind(Data_a,datasetB)
 
    
    
        Schilker
        
- 505
- 2
- 11
