{"id":1868,"date":"2023-07-24T16:14:35","date_gmt":"2023-07-24T16:14:35","guid":{"rendered":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/"},"modified":"2023-07-24T16:14:35","modified_gmt":"2023-07-24T16:14:35","slug":"tabela-de-resumo-em-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/","title":{"rendered":"A maneira mais f\u00e1cil de criar tabelas de resumo em r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">A maneira mais f\u00e1cil de criar tabelas de resumo em R \u00e9 usar as fun\u00e7\u00f5es <strong>description()<\/strong> e <strong>descriptionBy()<\/strong> da biblioteca <strong>psych<\/strong> .<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #000000;\"><span style=\"color: #107d3f;\"><span style=\"color: #993300;\">library<\/span> <span style=\"color: #000000;\">(psych)<\/span>\n<\/span><\/span>\n<span style=\"color: #008080;\">#create summary table\n<\/span>describe(df)\n\n<span style=\"color: #008080;\">#create summary table, grouped by a specific variable<\/span>\ndescribeBy(df, group=df$var_name)\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Os exemplos a seguir mostram como usar essas fun\u00e7\u00f5es na pr\u00e1tica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 1: Crie uma tabela de resumo b\u00e1sica<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Suponha que temos o seguinte quadro de dados em R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create data frame\n<\/span>df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (team=c('A', 'A', 'B', 'B', 'C', 'C', 'C'),\n                 points=c(15, 22, 29, 41, 30, 11, 19),\n                 rebounds=c(7, 8, 6, 6, 7, 9, 13),\n                 steals=c(1, 1, 2, 3, 5, 7, 5))\n\n<span style=\"color: #008080;\">#view data frame\n<\/span>df\n\n  team points rebounds steals\n1 to 15 7 1\n2 A 22 8 1\n3 B 29 6 2\n4 B 41 6 3\n5 C 30 7 5\n6 C 11 9 7\n7 C 19 13 5<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Podemos usar a fun\u00e7\u00e3o <strong>description()<\/strong> para criar uma tabela de resumo para cada vari\u00e1vel no quadro de dados:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #000000;\"><span style=\"color: #107d3f;\"><span style=\"color: #993300;\">library<\/span> <span style=\"color: #000000;\">(psych)<\/span>\n\n<\/span><\/span><span style=\"color: #008080;\">#create summary table\n<\/span>describe(df)\n\n         vars n mean sd median trimmed mad min max range skew kurtosis\nteam* 1 7 2.14 0.90 2 2.14 1.48 1 3 2 -0.22 -1.90\npoints 2 7 23.86 10.24 22 23.86 10.38 11 41 30 0.33 -1.41\nrebounds 3 7 8.00 2.45 7 8.00 1.48 6 13 7 1.05 -0.38\nsteals 4 7 3.43 2.30 3 3.43 2.97 1 7 6 0.25 -1.73\n           se\nteam* 0.34\npoints 3.87\nrebounds 0.93\nsteals 0.87\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Veja como interpretar cada valor no resultado:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>vars<\/strong> : n\u00famero da coluna<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>n<\/strong> : N\u00famero de casos v\u00e1lidos<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>m\u00e9dia<\/strong> : O valor m\u00e9dio<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>mediana<\/strong> : o valor mediano<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>trimmed<\/strong> : a m\u00e9dia aparada (por padr\u00e3o, 10% das observa\u00e7\u00f5es s\u00e3o removidas em cada extremidade)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>mad<\/strong> : O desvio mediano absoluto (da mediana)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>min<\/strong> : O valor m\u00ednimo<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>m\u00e1x<\/strong> : O valor m\u00e1ximo<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>intervalo<\/strong> : o intervalo de valores (m\u00e1x \u2013 min)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>inclina\u00e7\u00e3o<\/strong> : assimetria<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>curtose<\/strong> : achatamento<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>se<\/strong> : O erro padr\u00e3o<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">\u00c9 importante observar que qualquer vari\u00e1vel com asterisco (*) \u00e9 uma vari\u00e1vel categ\u00f3rica ou l\u00f3gica que foi convertida em uma vari\u00e1vel num\u00e9rica com valores que representam a ordem num\u00e9rica dos valores.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Em nosso exemplo, a vari\u00e1vel &#8220;equipe&#8221; foi convertida em uma vari\u00e1vel num\u00e9rica, portanto n\u00e3o devemos interpretar literalmente as estat\u00edsticas de resumo correspondentes.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Observe tamb\u00e9m que voc\u00ea pode usar o argumento <strong>fast=TRUE<\/strong> para calcular apenas as estat\u00edsticas de resumo mais comuns:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create smaller summary table\n<\/span>describe(df, fast= <span style=\"color: #008000;\">TRUE<\/span> )\n\n         vars n mean sd min max range se\nteam 1 7 NaN NA Inf -Inf -Inf NA\npoints 2 7 23.86 10.24 11 41 30 3.87\nrebounds 3 7 8.00 2.45 6 13 7 0.93\nsteals 4 7 3.43 2.30 1 7 6 0.87<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Tamb\u00e9m podemos optar por calcular apenas estat\u00edsticas resumidas para determinadas vari\u00e1veis no quadro de dados:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create summary table for just 'points' and 'rebounds' columns\n<\/span>describe(df[, c(' <span style=\"color: #ff0000;\">points<\/span> ', ' <span style=\"color: #ff0000;\">rebounds<\/span> ')], fast= <span style=\"color: #008000;\">TRUE<\/span> )\n\n         vars n mean sd min max range se\npoints 1 7 23.86 10.24 11 41 30 3.87\nrebounds 2 7 8.00 2.45 6 13 7 0.93<\/strong><\/pre>\n<h3> <span style=\"color: #000000;\"><strong>Exemplo 2: crie uma tabela de resumo, agrupada por vari\u00e1vel espec\u00edfica<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">O c\u00f3digo a seguir mostra como usar a fun\u00e7\u00e3o <strong>descriptionBy()<\/strong> para criar uma tabela de resumo para o quadro de dados, agrupado pela vari\u00e1vel \u201cteam\u201d:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create summary table, grouped by 'team' variable\n<\/span>describeBy(df, group=df$team, fast= <span style=\"color: #008000;\">TRUE<\/span> )\n\n Descriptive statistics by group \ngroup: A\n         vars n mean sd min max range se\nteam 1 2 NaN NA Inf -Inf -Inf NA\npoints 2 2 18.5 4.95 15 22 7 3.5\nrebounds 3 2 7.5 0.71 7 8 1 0.5\nsteals 4 2 1.0 0.00 1 1 0 0.0\n-------------------------------------------------- ---------- \ngroup: B\n         vars n mean sd min max range se\nteam 1 2 NaN NA Inf -Inf -Inf NA\npoints 2 2 35.0 8.49 29 41 12 6.0\nrebounds 3 2 6.0 0.00 6 6 0 0.0\nsteals 4 2 2.5 0.71 2 3 1 0.5\n-------------------------------------------------- ---------- \ngroup: C\n         vars n mean sd min max range se\nteam 1 3 NaN NA Inf -Inf -Inf NA\npoints 2 3 20.00 9.54 11 30 19 5.51\nrebounds 3 3 9.67 3.06 7 13 6 1.76\nsteals 4 3 5.67 1.15 5 7 2 0.67\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">A sa\u00edda exibe estat\u00edsticas resumidas para cada uma das tr\u00eas equipes no quadro de dados.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Recursos adicionais<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/pt\/cinco-numeros-resumidos-em-r\/\">Como calcular o resumo de cinco n\u00fameros em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/r-media-por-grupo\/\" target=\"_blank\" rel=\"noopener\">Como calcular a m\u00e9dia por grupo em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/soma-por-grupo-em-r\/\" target=\"_blank\" rel=\"noopener\">Como calcular soma por grupo em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/variacao-em-r\/\" target=\"_blank\" rel=\"noopener\">Como calcular a vari\u00e2ncia em R<\/a><br \/> <a href=\"https:\/\/statorials.org\/pt\/matriz-de-covariancia-r\/\" target=\"_blank\" rel=\"noopener\">Como criar uma matriz de covari\u00e2ncia em R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A maneira mais f\u00e1cil de criar tabelas de resumo em R \u00e9 usar as fun\u00e7\u00f5es description() e descriptionBy() da biblioteca psych . library (psych) #create summary table describe(df) #create summary table, grouped by a specific variable describeBy(df, group=df$var_name) Os exemplos a seguir mostram como usar essas fun\u00e7\u00f5es na pr\u00e1tica. Exemplo 1: Crie uma tabela de [&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-1868","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>A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology<\/title>\n<meta name=\"description\" content=\"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.\" \/>\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\/tabela-de-resumo-em-r\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology\" \/>\n<meta property=\"og:description\" content=\"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T16:14:35+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=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/\",\"url\":\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/\",\"name\":\"A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/pt\/#website\"},\"datePublished\":\"2023-07-24T16:14:35+00:00\",\"dateModified\":\"2023-07-24T16:14:35+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666\"},\"description\":\"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Lar\",\"item\":\"https:\/\/statorials.org\/pt\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"A maneira mais f\u00e1cil de criar tabelas de resumo em r\"}]},{\"@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":"A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology","description":"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.","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\/tabela-de-resumo-em-r\/","og_locale":"pt_PT","og_type":"article","og_title":"A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology","og_description":"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.","og_url":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/","og_site_name":"Statorials","article_published_time":"2023-07-24T16:14:35+00:00","author":"Dr. benjamim anderson","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Dr. benjamim anderson","Tempo estimado de leitura":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/","url":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/","name":"A maneira mais f\u00e1cil de criar tabelas de resumo em R - Statology","isPartOf":{"@id":"https:\/\/statorials.org\/pt\/#website"},"datePublished":"2023-07-24T16:14:35+00:00","dateModified":"2023-07-24T16:14:35+00:00","author":{"@id":"https:\/\/statorials.org\/pt\/#\/schema\/person\/e08f98e8db95e0aa9c310e1b27c9c666"},"description":"Este tutorial explica a maneira mais f\u00e1cil de criar tabelas de resumo em R, com v\u00e1rios exemplos.","breadcrumb":{"@id":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/pt\/tabela-de-resumo-em-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Lar","item":"https:\/\/statorials.org\/pt\/"},{"@type":"ListItem","position":2,"name":"A maneira mais f\u00e1cil de criar tabelas de resumo em r"}]},{"@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\/1868","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=1868"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/posts\/1868\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/media?parent=1868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/categories?post=1868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/pt\/wp-json\/wp\/v2\/tags?post=1868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}