{"id":1869,"date":"2023-07-24T16:14:35","date_gmt":"2023-07-24T16:14:35","guid":{"rendered":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/"},"modified":"2023-07-24T16:14:35","modified_gmt":"2023-07-24T16:14:35","slug":"tabella-riassuntiva-a-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/","title":{"rendered":"Il modo pi\u00f9 semplice per creare tabelle di riepilogo in r"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Il modo pi\u00f9 semplice per creare tabelle di riepilogo in R \u00e8 utilizzare le funzioni <strong>descrive()<\/strong> e <strong>descriveBy()<\/strong> dalla libreria <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;\">I seguenti esempi mostrano come utilizzare queste funzioni nella pratica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Esempio 1: creare una tabella di riepilogo di base<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Supponiamo di avere il seguente frame di dati in 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;\">Possiamo usare la funzione <strong>description()<\/strong> per creare una tabella riepilogativa per ogni variabile nel frame di dati:<\/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;\">Ecco come interpretare ciascun valore nel risultato:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>vars<\/strong> : numero di colonna<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>n<\/strong> : numero di casi validi<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>media<\/strong> : il valore medio<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>mediana<\/strong> : il valore mediano<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>troncata<\/strong> : la media troncata (per impostazione predefinita, il 10% delle osservazioni viene rimosso a ciascuna estremit\u00e0)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>mad<\/strong> : la deviazione mediana assoluta (dalla mediana)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>min<\/strong> : il valore minimo<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>max<\/strong> : il valore massimo<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>range<\/strong> : L&#8217;intervallo di valori (max \u2013 min)<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>inclinazione<\/strong> : asimmetria<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>curtosi<\/strong> : appiattimento<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>se<\/strong> : l&#8217;errore standard<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">\u00c8 importante notare che qualsiasi variabile con un asterisco (*) \u00e8 una variabile categoriale o logica che \u00e8 stata convertita in una variabile numerica con valori che rappresentano l&#8217;ordine numerico dei valori.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Nel nostro esempio, la variabile &#8220;squadra&#8221; \u00e8 stata convertita in una variabile numerica, quindi non dobbiamo interpretare alla lettera le statistiche riassuntive corrispondenti.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Tieni inoltre presente che puoi utilizzare l&#8217;argomento <strong>fast=TRUE<\/strong> per calcolare solo le statistiche riassuntive pi\u00f9 comuni:<\/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;\">Possiamo anche scegliere di calcolare solo le statistiche riassuntive per determinate variabili nel data frame:<\/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>Esempio 2: creare una tabella riassuntiva, raggruppata per variabile specifica<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Il codice seguente mostra come utilizzare la funzione <strong>descriptionBy()<\/strong> per creare una tabella di riepilogo per il frame di dati, raggruppata in base alla variabile &#8220;team&#8221;:<\/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;\">L&#8217;output mostra le statistiche riepilogative per ciascuna delle tre squadre nel frame dati.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/it\/cinque-numeri-riassunti-in-r\/\">Come calcolare la sintesi di cinque numeri in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/r-media-per-gruppo\/\" target=\"_blank\" rel=\"noopener\">Come calcolare la media per gruppo in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/somma-per-gruppo-in-r\/\" target=\"_blank\" rel=\"noopener\">Come calcolare la somma per gruppo in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/varianza-in-r\/\" target=\"_blank\" rel=\"noopener\">Come calcolare la varianza in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/matrice-di-covarianza-r\/\" target=\"_blank\" rel=\"noopener\">Come creare una matrice di covarianza in R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Il modo pi\u00f9 semplice per creare tabelle di riepilogo in R \u00e8 utilizzare le funzioni descrive() e descriveBy() dalla libreria psych . library (psych) #create summary table describe(df) #create summary table, grouped by a specific variable describeBy(df, group=df$var_name) I seguenti esempi mostrano come utilizzare queste funzioni nella pratica. Esempio 1: creare una tabella di riepilogo [&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":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.\" \/>\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\/it\/tabella-riassuntiva-a-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-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=\"Benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minuti\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/\",\"url\":\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/\",\"name\":\"Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-24T16:14:35+00:00\",\"dateModified\":\"2023-07-24T16:14:35+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Il modo pi\u00f9 semplice per creare tabelle di riepilogo in r\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/it\/#website\",\"url\":\"https:\/\/statorials.org\/it\/\",\"name\":\"Statorials\",\"description\":\"La tua guida all&#039;alfabetizzazione statistica!\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/it\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"it-IT\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\",\"name\":\"Benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"it-IT\",\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Benjamin anderson\"},\"description\":\"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9\",\"sameAs\":[\"https:\/\/statorials.org\/it\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology","description":"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.","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\/it\/tabella-riassuntiva-a-r\/","og_locale":"it_IT","og_type":"article","og_title":"Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology","og_description":"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.","og_url":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/","og_site_name":"Statorials","article_published_time":"2023-07-24T16:14:35+00:00","author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"3 minuti"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/","url":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/","name":"Il modo pi\u00f9 semplice per creare tabelle riassuntive in R - Stology","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-24T16:14:35+00:00","dateModified":"2023-07-24T16:14:35+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega il modo pi\u00f9 semplice per creare tabelle di riepilogo in R, con diversi esempi.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/tabella-riassuntiva-a-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Il modo pi\u00f9 semplice per creare tabelle di riepilogo in r"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/it\/#website","url":"https:\/\/statorials.org\/it\/","name":"Statorials","description":"La tua guida all&#039;alfabetizzazione statistica!","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/it\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"it-IT"},{"@type":"Person","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae","name":"Benjamin anderson","image":{"@type":"ImageObject","inLanguage":"it-IT","@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/it\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Benjamin anderson"},"description":"Ciao, sono Benjamin, un professore di statistica in pensione diventato insegnante dedicato di Statorials. Con una vasta esperienza e competenza nel campo della statistica, sono ansioso di condividere le mie conoscenze per potenziare gli studenti attraverso Statorials. Scopri di pi\u00f9","sameAs":["https:\/\/statorials.org\/it"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/1869"}],"collection":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/comments?post=1869"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/1869\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=1869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=1869"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=1869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}