Presentation describing the rbind function in R
Ashu Guru
Author
03/13/2019
Added
129
Plays
Description
Presentation describing the rbind function in R , by Ashu Guru, Univ of Nebraska Raikes School (2 mins)
Searchable Transcript
Toggle between list and paragraph view.
- [00:00:00.200]Say we have two tables which have same columns but they have two different data
- [00:00:07.390]sets.
- [00:00:07.840]So I have a table in a file called rbind dot CSV dot TXT.
- [00:00:13.120]It has columns filter on attribute 1, attribute 2 and it has four rows of data
- [00:00:21.382]separated by and.
- [00:00:23.400]I have another file which is storing the table and the file is called rbind 2 dot
- [00:00:30.652]CSV dot TXT and the column names are same as the table one.
- [00:00:36.520]However it has two different data set rows and.
- [00:00:40.320]My goal is to join these rows together or I want to bind them together.
- [00:00:45.360]So I am going to use a function called rbind to do that and I would like my
- [00:00:50.955]output to look something like this where I have 4 rows from the first table and
- [00:00:56.845]the last two rows from the table that I'm binding.
- [00:01:01.240]I have my data in table one from R bind TSV dot TXT and in Table 2 from R bind to
- [00:01:15.022]CSV dot TXT.
- [00:01:24.000]Let's run the instruction that changes the directory.
- [00:01:27.280]So set the working directory to the folder where I have the files.
- [00:01:32.160]Next I load the tables from these files.
- [00:01:36.080]So I have defined A variable called tabdata 1,
- [00:01:39.621]read it using command read dot table and the file name is R bind dot CSV dot TXT.
- [00:01:45.800]It has headers and it has a comma.
- [00:01:48.560]I define another variable tab data 2 which reads the table R bind 2 CSV TXT
- [00:01:54.523]header is true and separator is, So let's run first instruction,
- [00:01:59.624]second instruction and now I define a new variable which I'm calling it as combined
- [00:02:06.215]rows data.
- [00:02:07.400]And I'm using the command rbind which takes a parameter first table and 2nd
- [00:02:13.739]table.
- [00:02:14.240]So if I run this instruction and now print it,
- [00:02:18.379]I see that the 2 tables have been combined by rows.
The screen size you are trying to search captions on is too small!
You can always jump over to MediaHub and check it out there.
Log in to post comments
Embed
Copy the following code into your page
HTML
<div style="padding-top: 56.25%; overflow: hidden; position:relative; -webkit-box-flex: 1; flex-grow: 1;"> <iframe style="bottom: 0; left: 0; position: absolute; right: 0; top: 0; border: 0; height: 100%; width: 100%;" src="https://mediahub.unl.edu/media/10780?format=iframe&autoplay=0" title="Video Player: Presentation describing the rbind function in R" allowfullscreen ></iframe> </div>
Comments
0 Comments