Code:

```
x <- rnorm(1000, 5, 1.75)
sum(x > 0)/length(x) #gives the proportion using binary operator
mean(x > 0) #Dason way that also gives the proportion using binary operator
test replications elapsed relative user.self sys.self user.child sys.child
2 dason 100000 3.46 1.362205 3.13 0.00 NA NA
1 trinker 100000 2.54 1.000000 2.11 0.07 NA NA
```

This is so simple and how dummy coding works but I never thought about using mean to find proportions of something. Today Dason added to a post I gave to an R user about find proportions of a value and his code was much simpler and faster.

http://www.rstudio.org/docs/advanced/manipulate

Anyway, just needed to tell someone about the small steps made today!

I stand firm and tall; after all a velociraptor's gotta stand for something.

I'm calling out the TE.

Code:

```
library(data.table)
begin.time <- Sys.time()
require(ggplot2)
p <- ggplot(mtcars, aes(hp, mpg))
p + geom_point(aes(colour=as.factor(gear))) + facet_grid(cyl~gear, margins=T)
timetaken(begin.time)
```

Code:

```
> timetaken(begin.time)
[1] "00:01:55"
```

Jake said:

I have spent longer than 1:55 looking at the plot and I'm still not completely sure what is going on. Maybe this is not such a good challenge.

Jake I think a better way to understand the graph is to study the code:

Code:

```
require(ggplot2)
p <- ggplot(mtcars, aes(hp, mpg))
p + geom_point() #just a plot of hp and mpg
p + geom_point(aes(colour=as.factor(carb))) # a plot colored by carb (I meant to do this in my plot above but used gear instead
p + geom_point(aes(colour=as.factor(carb))) + facet_grid(cyl~gear) #facet plot of both cyl and gear
p + geom_point(aes(colour=as.factor(carb))) + facet_grid(cyl~gear, margins=T) #same as before but with the margins
```

The plot is a facet plot that works similarly to reshape. The graph is not publishable, but for me, allows me to quickly look at plots of data by group (and includes margins) and look for trends. If you're familiar with ggplot's faceting then the graph is pretty understandable, but again the plot is one I use frequently for initial data exploration. It's not polished but to do the same thing in base would take an exorbitant amount of time. As a researcher this tool has been invaluable.

Code:

```
someList[2:] # Python
someVector[2:length(someVector)] # R
```

What I learned today is that

Code:

`head(x, 20) # Reveals 20 elements instead of default 5`

Code:

`head(x, -5) # All but last 5 elements`