Posts Tagged ‘ Vectorize ’

Outer Product of Character Vectors in R

July 19, 2012
By
Outer Product of Character Vectors in R

What follows is like a kata to strengthen your R fundamentals. The lovely stats in the wild recently posted some hott data analysis of Olympians’ ages and sexes. Because I’m annoyingly picky about graphics, I asked for his code so I could ...

Read more »

Vectorize!

February 20, 2011
By
Vectorize!

Here is an email sent by one of my students a few days ago: Do you know how to integrate a function with an  “if”? For instance: >X=rnorm(100) >Femp=function(x){ +   return(sum(X<x)) +} >integrate(Femp,0,1)$value does not work. My reply was that the fundamental reason it does not work is that integrate (or curve for instance)

Read more »