title: Convert type of multiple columns of a dataframe at once
body: <p>I seem to spend a lot of time creating a dataframe from a file, database or something, and then converting each column into the type I wanted it in (numeric, factor, character etc).  Is there a way to do this in one step, possibly by giving a vector of types ?</p>
  
  <pre><code>foo&lt;-data.frame(x=c(1:10), 
                  y=c("red", "red", "red", "blue", "blue", 
                      "blue", "yellow", "yellow", "yellow", 
                      "green"),
                  z=Sys.Date()+c(1:10))
  
  foo$x&lt;-as.character(foo$x)
  foo$y&lt;-as.character(foo$y)
  foo$z&lt;-as.numeric(foo$z)
  </code></pre>
  
  <p>instead of the last three commands, I'd like to do something like</p>
  
  <pre><code>foo&lt;-convert.magic(foo, c(character, character, numeric))
  </code></pre>