{"id":1859,"date":"2023-07-24T17:13:02","date_gmt":"2023-07-24T17:13:02","guid":{"rendered":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/"},"modified":"2023-07-24T17:13:02","modified_gmt":"2023-07-24T17:13:02","slug":"r-numero-incorreto-de-dimensoes","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/","title":{"rendered":"Como corrigir erro em r: n\u00famero incorreto de dimens\u00f5es"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Um erro que voc\u00ea pode encontrar no R \u00e9:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>Error in x[, 3]: incorrect number of dimensions\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Este erro ocorre quando voc\u00ea tenta criar um subconjunto de um objeto em R com mais dimens\u00f5es do que o objeto possui.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Este tutorial explica exatamente como corrigir esse erro.<\/span><\/p>\n<h3> <strong>Como reproduzir o erro<\/strong><\/h3>\n<p> <span style=\"color: #000000;\">Suponha que temos o seguinte vetor em R com 10 valores:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#definevector\n<\/span>x &lt;- c(3, 4, 7, 7, 14, 19, 22, 28, 29, 30)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">O vetor \u00e9 unidimensional, mas suponha que tentemos subconjunto em duas dimens\u00f5es:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#attempt to access value in first row and third column\n<\/span>x[, 3]\n\nError in x[, 3]: incorrect number of dimensions\n\n<span style=\"color: #008080;\">#attempt to access value in third row and first column\n<\/span>x[3, ]\n\nError in x[3, ]: incorrect number of dimensions\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Recebemos um erro porque tentamos subconjunto em duas dimens\u00f5es quando o vetor tem apenas uma dimens\u00e3o.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Como corrigir o erro<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">A maneira mais f\u00e1cil de corrigir esse erro \u00e9 simplesmente subdividir em uma \u00fanica dimens\u00e3o. Por exemplo, veja como acessar o terceiro valor do vetor:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#access third value in vector\n<span style=\"color: #000000;\">x[3]\n<\/span>\n<span style=\"color: #000000;\">[1] 7<\/span>\n<\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Tamb\u00e9m podemos acessar v\u00e1rios valores do vetor de uma s\u00f3 vez. Por exemplo, veja como acessar os valores das posi\u00e7\u00f5es 2 a 5 no vetor:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#access values in positions 2 through 5\n<span style=\"color: #000000;\">x[2:5]\n<\/span>\n<span style=\"color: #000000;\">[1] 4 7 7 14\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Como subdefinimos apenas uma dimens\u00e3o, evitamos o erro <strong>do n\u00famero incorreto de dimens\u00f5es<\/strong> <span style=\"color: #000000;\">.<\/span><\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/pt\/nas-introduzido-por-coercao-em-r\/\" target=\"_blank\" rel=\"noopener\">Como corrigir em R: NAs introduzidos por coer\u00e7\u00e3o<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/r-indice-de-erro-fora-do-intervalo\/\" target=\"_blank\" rel=\"noopener\">Como reparar em R: \u00edndice fora dos limites<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\" target=\"_blank\" rel=\"noopener\">Como corrigir em R: o comprimento de um objeto mais longo n\u00e3o \u00e9 m\u00faltiplo do comprimento de um objeto mais curto<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/r-numero-de-itens-a-serem-substituidos-nao-multiplo-do-comprimento-de-substituicao\/\" target=\"_blank\" rel=\"noopener\">Como reparar em R: o n\u00famero de elementos a serem substitu\u00eddos n\u00e3o \u00e9 um m\u00faltiplo do comprimento de substitui\u00e7\u00e3o<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Um erro que voc\u00ea pode encontrar no R \u00e9: Error in x[, 3]: incorrect number of dimensions Este erro ocorre quando voc\u00ea tenta criar um subconjunto de um objeto em R com mais dimens\u00f5es do que o objeto possui. Este tutorial explica exatamente como corrigir esse erro. Como reproduzir o erro Suponha que temos o [&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-1859","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 corrigir erro em R: n\u00famero incorreto de dimens\u00f5es<\/title>\n<meta name=\"description\" content=\"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.\" \/>\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\/r-numero-incorreto-de-dimensoes\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como corrigir erro em R: n\u00famero incorreto de dimens\u00f5es\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T17:13:02+00:00\" \/>\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\/r-numero-incorreto-de-dimensoes\/\",\"url\":\"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/\",\"name\":\"Como corrigir erro em R: n\u00famero incorreto de dimens\u00f5es\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-24T17:13:02+00:00\",\"dateModified\":\"2023-07-24T17:13:02+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como corrigir erro em r: n\u00famero incorreto de dimens\u00f5es\"}]},{\"@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 corrigir erro em R: n\u00famero incorreto de dimens\u00f5es","description":"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.","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\/r-numero-incorreto-de-dimensoes\/","og_locale":"pt_PT","og_type":"article","og_title":"Como corrigir erro em R: n\u00famero incorreto de dimens\u00f5es","og_description":"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.","og_url":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/","og_site_name":"Statorials","article_published_time":"2023-07-24T17:13:02+00:00","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\/r-numero-incorreto-de-dimensoes\/","url":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/","name":"Como corrigir erro em R: n\u00famero incorreto de dimens\u00f5es","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-24T17:13:02+00:00","dateModified":"2023-07-24T17:13:02+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica como corrigir o seguinte erro em R: N\u00famero incorreto de dimens\u00f5es.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/r-numero-incorreto-de-dimensoes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"Como corrigir erro em r: n\u00famero incorreto de dimens\u00f5es"}]},{"@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\/1859","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=1859"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1859\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}