{"id":22977,"date":"2016-07-09T10:59:38","date_gmt":"2016-07-09T10:59:38","guid":{"rendered":"http:\/\/www.inacreditavel.pt\/?p=22977"},"modified":"2016-07-09T11:04:35","modified_gmt":"2016-07-09T11:04:35","slug":"r-introducao","status":"publish","type":"post","link":"http:\/\/www.inacreditavel.pt\/?p=22977","title":{"rendered":"R &#8211; introdu\u00e7\u00e3o"},"content":{"rendered":"<p>No ano passado, escrevi um <a href=\"http:\/\/www.inacreditavel.pt\/?p=22333\">artigo sobre como fazer uma An\u00e1lise Fatorial<\/a> com o <a href=\"https:\/\/www.r-project.org\/\">R<\/a>. Hoje vou apresentar um exemplo mais simples.<\/p>\n<p>Com um editor de texto simples, crie um ficheiro com o conte\u00fado abaixo e grave-o com o nome <strong>dados.txt<\/strong>.<\/p>\n<pre style=\"border: 2px solid black; border-radius: 5px; box-shadow: 5px 5px 5px grey; background-color: lightyellow; margin: 10px; padding: 8px; font-family: monospace;\">valor\tregiao\r\n12\t2\r\n15\t2\r\n17\t2\r\n11\t2\r\n17\t1\r\n18\t1\r\n21\t1\r\n13\t1\r\n6\t3\r\n9\t3\r\n8\t3\r\n10\t3<\/pre>\n<p>Depois, abra o R e digite os comandos seguintes<\/p>\n<pre style=\"border: 2px solid black; border-radius: 5px; box-shadow: 5px 5px 5px grey; background-color: lightyellow; margin: 10px; padding: 8px; font-family: monospace;\">d&lt;-read.table(\"dados.txt\", sep=\"\\t\", header=TRUE)\r\nattach(d)\r\nnames(d)\r\nnames(data.frame(valor,regiao))\r\nsummary(data.frame(valor))\r\nsummary(data.frame(regiao))\r\ndetach(d)<\/pre>\n<p>O resultado \u00e9 um quadro com algumas estat\u00edsticas descritivas de ambas as vari\u00e1veis <strong>valor<\/strong> e <strong>regiao<\/strong>: m\u00ednimo, m\u00e1ximo, m\u00e9dia e quartis.<\/p>\n<pre style=\"border: 2px solid black; border-radius: 5px; box-shadow: 5px 5px 5px grey; background-color: lightyellow; margin: 10px; padding: 8px; font-family: monospace;\">     valor\r\n Min.   : 6.00\r\n 1st Qu.: 9.75\r\n Median :12.50\r\n Mean   :13.08\r\n 3rd Qu.:17.00\r\n Max.   :21.00\r\n\r\n     regiao\r\n Min.   :1\r\n 1st Qu.:1\r\n Median :2\r\n Mean   :2\r\n 3rd Qu.:3\r\n Max.   :3<\/pre>\n<p>Aplica\u00e7\u00f5es de R, com interpreta\u00e7\u00e3o autom\u00e1tica dos resultados em <a href=\"https:\/\/stat.cool\/base.php\">STAT.COOL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>No ano passado, escrevi um artigo sobre como fazer uma An\u00e1lise Fatorial com o R. Hoje vou apresentar um exemplo mais simples. Com um editor de texto simples, crie um ficheiro com o conte\u00fado abaixo e grave-o com o nome dados.txt. valor regiao 12 2 15 2 17 2 11 2 17 1 18 1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/posts\/22977"}],"collection":[{"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22977"}],"version-history":[{"count":3,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/posts\/22977\/revisions"}],"predecessor-version":[{"id":22981,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=\/wp\/v2\/posts\/22977\/revisions\/22981"}],"wp:attachment":[{"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22977"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.inacreditavel.pt\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}