Author
Updated
3/27/2019Released
1/10/2018The five minutes you spend each week will provide you with a building block you can use in the next two hours at work. Review language basics, discover methods to improve existing R code, explore new and interesting features, and learn about useful development tools and libraries that will make your time programming with R that much more productive.
All series code samples can be downloaded at https://github.com/mnr/five-minutes-of-R.Note: Because this is an ongoing series, viewers will not receive a certificate of completion.
Skill Level Intermediate
Duration
Views
- [Instructor] So you can see that I've created two vectors, one called x position, and one called y position. And this is an xy relationship. These are small vectors, but it's already pretty easy to get lost in how these vectors might relate to each other. And of course with that we should use some sort of a visual tool, like, let's try plots. So I type in P-L-O-T, and then I type x position and y POS, and I hit return.
And I get a graph that shows six points. Well, I can immediately see that there's more than six points in this graph. In fact, there are 13, x position and y position length is 13. But my graph is only showing six. I'm missing something. I'm not getting the full story. And to get a better picture of how these two relate I'm going to use something called a sunflower plot, which is a plot that's provided by r. To use sunflower plot the first thing I need to do is create an xy table.
So here's how I'll do that, xytabl, and into xytabl I'm going to place an xy table generated by using the xy table function against x position and y position. And I hit return, and I get a list of three, which by itself is not terribly revealing of any sort of relationships. But now when I use that information with sunflower plot, S-U-N-F-L-O-W-E-R P-L-O-T, and I call up xytabl, which is what I've just created.
And then I hit return. Now you can see that I have a new graph. And what's unique about this graph is we still have six points, but the first three points have veins against them, lines coming out of them. The first on has three lines, and the second has three lines, and the third one has four lines. Well, what that tells us is that at the 1,1 position there are three values. So if you look at xpos and ypos you'll see that the first set xpos is one, and ypos is one.
And then further on is another 1,1 combination. And I know there's three because the sunflower plot has indicated that there are three lines. The same thing for 2,1. If I look at 3,1 I should find four sets of that. And in fact, if you look at xpos vs ypos you'll find four combinations of three and one. So a sunflower plot is a really useful way to show how many combinations of values are in two compared vectors.
Related Courses
-
Learning R
with Barton Poulson2h 25m Beginner -
R Statistics Essential Training
with Barton Poulson5h 59m Intermediate -
Code Clinic: R (2015)
with Mark Niemann-Ross3h 24m Intermediate -
Integrating Tableau and R for Data Science
with Ben Sullins1h 10m Intermediate
-
New This Week
-
sunflower2m 57s
-
-
Introduction
-
Welcome50s
-
Exercise files36s
-
-
Lunchbreak Lessons
-
R built-in data sets5m 21s
-
Vector math5m 57s
-
Subsetting7m 17s
-
R data types: Basic types7m 34s
-
R data types: Vector5m 16s
-
R data types: List5m 27s
-
R data types: Factor5m 15s
-
R data types: Matrix8m 48s
-
R data types: Array3m 50s
-
R data types: Data frame6m 44s
-
Data frames: Order and merge8m 10s
-
Data frames: Read and update4m 44s
-
Data frames: rbind3m 4s
-
Dataframes: cbind3m 11s
-
apply and lapply3m 21s
-
mapply2m 21s
-
plot2m 45s
-
Brackets and double-brackets2m 50s
-
mean, rowMeans, and colMeans1m 49s
-
RSQLite3m 44s
-
sqldf2m 9s
-
Aggregate3m 17s
-
Random numbers4m 26s
-
Pipeline4m 42s
-
Working with clipboards2m 45s
-
Style guides3m
-
cut3m 17s
-
split3m 44s
-
askYesNo3m 48s
-
cdplot5m 32s
-
Fun3m 18s
-
boxplot2m 33s
-
Histogram3m 40s
-
Plot to file6m 2s
-
coplot4m 3s
-
cowsay2m 40s
-
table2m 48s
-
Look inside3m 21s
-
barplot2m 32s
-
Pie chart2m 11s
-
unlist3m 24s
-
Joins: Inner and full3m 3s
-
Joins: Left and right2m 13s
-
Sets: Equal and in2m 14s
-
colors2m 25s
-
ifelse3m 5s
-
spineplot2m 36s
-
browser3m 37s
-
debugonce2m 25s
-
Default mirror2m 31s
-
Dealing with NA6m 1s
-
Using with()2m 55s
-
Simple string matching4m 35s
-
grep2m 53s
-
dotchart3m 54s
-
fourfoldplot3m 34s
-
matplot New3m 50s
-
dimnames5m 4s
-
mosaicplot4m 23s
-
stemplot2m 57s
-
stripchart3m 10s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: sunflower