Presentation describing the transform function in R
Ashu Guru
Author
03/13/2019
Added
98
Plays
Description
Presentation describing the transform function in R , by Ashu Guru, Univ of Nebraska Raikes School (2 mins)
Searchable Transcript
Toggle between list and paragraph view.
- [00:00:00.040]Say we have a table which has columns called filter on attribute 1,
- [00:00:05.704]attribute 2 and we have a couple of data rows in it.
- [00:00:10.440]What I want to do is I want to add another column,
- [00:00:14.163]I'm calling it new column and the values in that column should be what is
- [00:00:19.565]attribute 1 divided by attribute 2.
- [00:00:22.120]So in this case 20 / 21. 30 / 10. 3.
- [00:00:29.200]So basically I would like my output to look like this.
- [00:00:36.720]A quick look at the data file.
- [00:00:39.200]So here is the input data file.
- [00:00:43.560]I have filter on attribute 1, attribute 2 and then couple of rows of
- [00:00:48.984]data separated by.
- [00:00:51.640]So I will set the working directory to the folder where I have the text file
- [00:00:57.679]which contains the table.
- [00:00:59.880]So I'm going to run that instruction.
- [00:01:03.960]Next I'm going to load the table in a variable called tabdata.
- [00:01:11.280]Now I am going to transform the same tabdata and add a new column to it with
- [00:01:17.667]the value attribute 1, attribute 2 and I'm using the transform
- [00:01:22.893]function.
- [00:01:24.040]What you will notice is that I'm actually reassigning the output from transform
- [00:01:28.611]function to the tab data.
- [00:01:30.040]So my new table will have the third column.
- [00:01:33.720]Let's just print the names of the column that now are in the table tab data.
- [00:01:40.560]We see that there is a new column that is called new column.
- [00:01:44.160]Let's print the table and here it is.
- [00:01:47.920]So we have filter on attribute 1, attribute 2, a new column.
- [00:01:52.758]And that has value 20 / 20 which is 1. 30 / 10 which is 3 based on the formula
- [00:01:59.024]attribute 1 divided by attribute 2.
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/10782?format=iframe&autoplay=0" title="Video Player: Presentation describing the transform function in R " allowfullscreen ></iframe> </div>
Comments
0 Comments