{"id":1156,"date":"2023-07-27T11:30:10","date_gmt":"2023-07-27T11:30:10","guid":{"rendered":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/"},"modified":"2023-07-27T11:30:10","modified_gmt":"2023-07-27T11:30:10","slug":"importar-excel-para-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/","title":{"rendered":"Como importar arquivos excel para r (passo a passo)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">A maneira mais f\u00e1cil de importar um arquivo Excel para R \u00e9 usar a fun\u00e7\u00e3o <strong>read_excel()<\/strong> do <a href=\"https:\/\/readxl.tidyverse.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">pacote readxl<\/a> .<\/span><\/p>\n<p> <span style=\"color: #000000;\">Esta fun\u00e7\u00e3o usa a seguinte sintaxe:<\/span><\/p>\n<p> <strong><span style=\"color: #000000;\">read_excel(caminho, planilha = NULL)<\/span><\/strong><\/p>\n<p> <span style=\"color: #000000;\">Ouro:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>caminho:<\/strong> caminho para o arquivo xls\/xlsx<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>folha:<\/strong> A folha a ser lida. Este pode ser o nome da folha ou a posi\u00e7\u00e3o da folha. Se isto n\u00e3o for especificado, a primeira folha ser\u00e1 lida.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Este tutorial fornece um exemplo de uso desta fun\u00e7\u00e3o para importar um arquivo Excel para R.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo: importar um arquivo Excel para R<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Digamos que eu tenha um arquivo Excel salvo no seguinte local:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>C:\\Usu\u00e1rios\\Bob\\Desktop\\data.xlsx<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">O arquivo cont\u00e9m os seguintes dados:<\/span> <\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-11600 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/importerexcel1.png\" alt=\"Importar Excel para R\" width=\"403\" height=\"343\" srcset=\"\" sizes=\"auto, \"><\/p>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como importar este arquivo Excel para R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#install and load readxl package<\/span>\n<span style=\"color: #993300;\">install.packages<\/span> (' <span style=\"color: #008000;\">readxl<\/span> ')\n<span style=\"color: #993300;\">library<\/span> (readxl)\n\n<span style=\"color: #008080;\">#import Excel file into R\n<\/span>data &lt;- read_excel(' <span style=\"color: #008000;\">C:\\\\Users\\\\Bob\\\\Desktop\\\\data.xlsx<\/span> ')\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Observe que usamos barras invertidas duplas (\\\\) no caminho do arquivo para evitar o seguinte erro comum:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #993300;\">Error: '\\U' used without hex digits in character string starting \"\"C:\\U\"<\/span>\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Podemos usar o seguinte c\u00f3digo para visualizar rapidamente os dados:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <span style=\"color: #000000;\"><strong><span style=\"color: #008080;\">#view entire dataset\n<span style=\"color: #000000;\">data\n\n#A tibble: 5 x 3\n team points assists\n &lt;chr&gt; &lt;dbl&gt; &lt;dbl&gt;\n1 A 78 12\n2 B 85 20\n3 C 93 23\n4 D 90 8\n5 E 91 14<\/span><\/span>\n<\/strong><\/span><\/pre>\n<p> <span style=\"color: #000000;\">Podemos ver que R importou o arquivo Excel e determinou automaticamente que <em>equipe<\/em> era uma vari\u00e1vel de string, enquanto <em>pontos<\/em> e <em>assist\u00eancias<\/em> eram vari\u00e1veis num\u00e9ricas.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Os tutoriais a seguir explicam como importar outros tipos de arquivo para R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/pt\/importar-csv-para-r\/\" target=\"_blank\" rel=\"noopener\">Como importar arquivos CSV para R<\/a><br \/> <span style=\"color: #000000;\"><a href=\"https:\/\/statorials.org\/pt\/importar-sas-para-r\/\" target=\"_blank\" rel=\"noopener\">Como importar arquivos SAS para R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/inserir-dados-em-r\/\" target=\"_blank\" rel=\"noopener\">Como inserir manualmente dados brutos em R<\/a><br \/><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A maneira mais f\u00e1cil de importar um arquivo Excel para R \u00e9 usar a fun\u00e7\u00e3o read_excel() do pacote readxl . Esta fun\u00e7\u00e3o usa a seguinte sintaxe: read_excel(caminho, planilha = NULL) Ouro: caminho: caminho para o arquivo xls\/xlsx folha: A folha a ser lida. Este pode ser o nome da folha ou a posi\u00e7\u00e3o da folha. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1156","post","type-post","status-publish","format-standard","hentry","category-guia"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Como importar arquivos Excel para R (passo a passo) - Estatologia<\/title>\n<meta name=\"description\" content=\"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como importar arquivos Excel para R (passo a passo) - Estatologia\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-27T11:30:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/importerexcel1.png\" \/>\n<meta name=\"author\" content=\"Dr. benjamim anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr. benjamim anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/\",\"url\":\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/\",\"name\":\"Como importar arquivos Excel para R (passo a passo) - Estatologia\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-27T11:30:10+00:00\",\"dateModified\":\"2023-07-27T11:30:10+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/importar-excel-para-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como importar arquivos excel para r (passo a passo)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/pt\/#website\",\"url\":\"https:\/\/statorials.org\/pt\/\",\"name\":\"Statorials\",\"description\":\"O seu guia para a literacia estat\u00edstica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/pt\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\",\"name\":\"Dr. benjamim anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. benjamim anderson\"},\"description\":\"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais\",\"sameAs\":[\"https:\/\/statorials.org\/pt\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como importar arquivos Excel para R (passo a passo) - Estatologia","description":"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/","og_locale":"pt_PT","og_type":"article","og_title":"Como importar arquivos Excel para R (passo a passo) - Estatologia","og_description":"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.","og_url":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/","og_site_name":"Statorials","article_published_time":"2023-07-27T11:30:10+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/importerexcel1.png"}],"author":"Dr. benjamim anderson","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Dr. benjamim anderson","Tempo estimado de leitura":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/","url":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/","name":"Como importar arquivos Excel para R (passo a passo) - Estatologia","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-27T11:30:10+00:00","dateModified":"2023-07-27T11:30:10+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica como importar rapidamente arquivos Excel para R, com exemplos passo a passo.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/importar-excel-para-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/importar-excel-para-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"Como importar arquivos excel para r (passo a passo)"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/pt\/#website","url":"https:\/\/statorials.org\/pt\/","name":"Statorials","description":"O seu guia para a literacia estat\u00edstica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/pt\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-PT"},{"@type":"Person","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666","name":"Dr. benjamim anderson","image":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/pt\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr. benjamim anderson"},"description":"Ol\u00e1, sou Benjamin, um professor aposentado de estat\u00edstica que se tornou professor dedicado na Statorials. Com vasta experi\u00eancia e conhecimento na \u00e1rea de estat\u00edstica, estou empenhado em compartilhar meu conhecimento para capacitar os alunos por meio de Statorials. Saber mais","sameAs":["https:\/\/statorials.org\/pt"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/comments?post=1156"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1156\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=1156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=1156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=1156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}