title: R decode a column encoded with base64
body: <p>In R, I have a data frame with a column "content" encoded with base64. I can decode a single entry of "content" in the row 355 like below;</p>
  
  <pre><code>library(base64enc)
  rawToChar(base64decode(df[355,"content"]))
  </code></pre>
  
  <p>When I try to decode with</p>
  
  <pre><code>rawToChar(base64decode(df$content))
  </code></pre>
  
  <p>I get the error "embedded nul in string". How can I decode the whole column? </p>
  
  <p>Edit: I used a loop and it seems OK but I don't think that it is an elegant solution.</p>
  
  <pre><code>comments.decoded &lt;- data.frame(comments=character(),
                                 stringsAsFactors=FALSE)
  
  for(i in 1:nrow(df))
  {
      clean.row &lt;- iconv(rawToChar(base64decode(df[i,"content"])), "latin1", "UTF-8")
      clean.row &lt;- data.frame(trimws(clean.row), stringsAsFactors=FALSE)
      comments.decoded &lt;- rbind(comments.decoded, clean.row)
  }
  
  comments.decoded
  </code></pre>