Saturday, April 30, 2011

Welcome!

If you're here because you clicked my link at the Spandrel Shop, consider these three videos your welcome message.
The frog video has an awesome if sad sequel.

Statistics is a beautiful thing.

I will never forget Lady Gaga in a pant suit.

Friday, April 29, 2011

R farts: Get with it.

As a set up for some more complicated environmental manipulations, .GlobalEnv is a pre-defined reference to the global environment (in the R sense).

With is a function which constructs a local environment from a data argument, and lets you evaluate an expression within that environment.  It returns only the value of the evaluated expression. 

The combination of these two lets you construct data frames with derived objects without polluting the global environment with junk temporary variables.  For example:
df <- data.frame( x = runif(100) )
df <- with( data = df, expr = {
   y = 2*x+1
   z = 3*y^2+1
   df <- data.frame(x = x, y = y, z = z )
   return(df)
})
Even better, if you have some variables pre-calculated in the global environment, you can pull them in using the .GlobalEnv reference:

df <- data.frame( x = runif(100) )
df <- with( data = df, expr = {
   y = 2*x+1
   z =.GlobalEnv$oftenUsedFunction(y)
   df <- data.frame(x = x, y = y, z = z )
   return(df)
})
I probably have pages and pages of R scripts which are somewhat repetitive.  Just not repetitive enough to qualify for a function.  I'm still looking for how to organize them better, but this is a start.

Thursday, April 21, 2011

Crackpot Bumps Up NY Times Ratings

NY Times front page online:
Magazine Preview
The Crash and Burn of an Autism Guru
Andrew Wakefield, condemned by the press and the medical establishment, still believes in a link between autism and vaccines.
The man participated in a campaign to inflate the risk of vaccination which has resulted in outbreaks of measles and other preventable diseases around the world.  His conduct while participating in this campaign was outrageous by all of the standards that researchers are supposed to abide by.  The crazy man yelling on the street corner in Berkeley has a much more relevant opinion on autism and vaccines.  The CDC might be an even better place to ask.  You know, people with actual credibility and relevance.

NY Times, please be a little choosier about what gets front page coverage.  Thanks PZ for pointing out the crazy.

Saturday, April 16, 2011

Friday, April 1, 2011

You can't argue with a beautiful voice


"Anger", oh really?

This is a nytimes.com headline:

Afghan Mob Kills 10 Foreign United Nations Workers

KABUL, Afghanistan — The protesters, angered by a Koran burning in Florida on Mar. 20., attacked a U.N. office in Mazar-i-Sharif.
I'm sorry, but this is premeditated mob murder.  This has nothing to do with anger.  They were whipped up by irresponsible religious figures at the mosque and set loose on an poorly guarded compound.  The story states:
The attack began when hundreds of demonstrators, some of them armed, poured out of mosques after Friday Prayer and headed to the headquarters of the United Nations in the northern city of Mazar-i-Sharif.
To imagine that this was provoked by some cracked up Florida pastor's burning of a few Korans is giving these people far too little credit.  Somebody wanted the UN out and they found an excuse.  The ugly thing is that people are so easy to whip into a frenzy.  Maybe the NY Times consider writing headlines that don't just monkey the American prejudice towards Afghanistan as the land of religious insanity?  Pretty please?