{"id":911,"date":"2011-05-19T10:04:56","date_gmt":"2011-05-19T14:04:56","guid":{"rendered":"http:\/\/www.nomad.priv.at\/researchblog\/?p=911"},"modified":"2011-05-19T10:04:56","modified_gmt":"2011-05-19T14:04:56","slug":"converting-vectors-to-numeric-in-mixed-type-dataframe","status":"publish","type":"post","link":"http:\/\/www.nomad.priv.at\/researchblog\/?p=911","title":{"rendered":"Converting vectors to numeric in mixed-type dataframe"},"content":{"rendered":"<p>Coercing variables of character and numeric type into a single dataframe yields all vectors to be defined as factors<\/p>\n<p><code>all &lt;- data.frame(cbind(site, year, model, x, y, z))<\/code><\/p>\n<p>The following converts selected variables from &#8220;factor&#8221; back to &#8220;numeric&#8221;<br \/>\n<code>all$x &lt;- as.numeric(x)<br \/>\nall$y &lt;- as.numeric(y)<br \/>\nall$z &lt;- as.numeric(z)<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Coercing variables of character and numeric type into a single dataframe yields all vectors to be defined as factors all &lt;- data.frame(cbind(site, year, model, x, y, z)) The following converts selected variables from &#8220;factor&#8221; back to &#8220;numeric&#8221; all$x &lt;- as.numeric(x) all$y &lt;- as.numeric(y) all$z &lt;- as.numeric(z)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[93,102,103,511,378],"class_list":["post-911","post","type-post","status-publish","format-standard","hentry","category-r","category-research","tag-conversion","tag-data","tag-dataframe","tag-r","tag-vector"],"_links":{"self":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/911","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=911"}],"version-history":[{"count":0,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/911\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=911"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}