{"id":2270,"date":"2023-07-23T00:14:53","date_gmt":"2023-07-23T00:14:53","guid":{"rendered":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/"},"modified":"2023-07-23T00:14:53","modified_gmt":"2023-07-23T00:14:53","slug":"la-mappatura-degli-errori-deve-essere-creata-da-aes","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/","title":{"rendered":"Come risolvere l&#39;errore in r:: `mapping` deve essere creato da `aes()`"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Un errore che potresti riscontrare quando usi R \u00e8:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>Error: `mapping` must be created by `aes()`\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Questo errore si verifica quando provi a utilizzare l&#8217;argomento <strong>aes()<\/strong> durante la creazione di un grafico in ggplot2 e lo usi nel posto sbagliato o lo usi senza la sintassi &#8220;mappatura&#8221;.<\/span><\/p>\n<p> <span style=\"color: #000000;\">L&#8217;esempio seguente mostra come correggere questo errore nella pratica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Come riprodurre l&#8217;errore<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Supponiamo di provare a creare un boxplot utilizzando ggplot2:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n<span style=\"color: #008080;\">\n#createdata\n<span style=\"color: #000000;\">df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (y=c(2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 16, 19, 28),\n                 x1=c(1, 2, 2, 3, 5, 6, 8, 8, 9, 9, 10, 11, 12, 15, 15),\n                 x2=c(8, 7, 7, 6, 6, 4, 3, 5, 4, 6, 5, 4, 3, 2, 2))\n\n<span style=\"color: #008080;\">#attempt to create boxplot for 'x1' variable\n<\/span>ggplot() +\n  geom_boxplot(df, aes(x=x1))\n\nError: `mapping` must be created by `aes()`\n<\/span><\/span><\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Riceviamo un errore perch\u00e9 l&#8217;argomento <strong>aes()<\/strong> viene utilizzato nella funzione <strong>geom_boxplot()<\/strong> senza utilizzare la sintassi &#8216;mapping&#8217;.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Come correggere l&#8217;errore<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Esistono due modi per correggere questo errore.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 1: utilizzare la sintassi \u201cmapping\u201d.<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Un modo per correggere l&#8217;errore \u00e8 utilizzare specificamente la sintassi &#8216;mapping&#8217; davanti all&#8217;argomento <strong>aes()<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n<span style=\"color: #008080;\">\n#create data\n<span style=\"color: #000000;\">df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (y=c(2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 16, 19, 28),\n                 x1=c(1, 2, 2, 3, 5, 6, 8, 8, 9, 9, 10, 11, 12, 15, 15),\n                 x2=c(8, 7, 7, 6, 6, 4, 3, 5, 4, 6, 5, 4, 3, 2, 2))\n\n<span style=\"color: #008080;\">#create boxplot for 'x1' variable\n<\/span>ggplot() +\n  geom_boxplot(df, mapping=aes(x=x1))<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-20686 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/aes11.png\" alt=\"\" width=\"633\" height=\"303\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Poich\u00e9 abbiamo utilizzato esplicitamente la sintassi <strong>della mappatura<\/strong> , abbiamo evitato qualsiasi errore.<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>Metodo 2: utilizzare &#8216;aes&#8217; nella funzione ggplot<\/strong><\/span><\/p>\n<p> <span style=\"color: #000000;\">Un altro modo per correggere questo errore \u00e8 utilizzare l&#8217;argomento <strong>aes()<\/strong> nella funzione <strong>ggplot()<\/strong> :<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">library<\/span> (ggplot2)\n<span style=\"color: #008080;\">\n#createdata\n<span style=\"color: #000000;\">df &lt;- data. <span style=\"color: #3366ff;\">frame<\/span> (y=c(2, 3, 3, 4, 5, 5, 6, 7, 8, 8, 9, 10, 16, 19, 28),\n                 x1=c(1, 2, 2, 3, 5, 6, 8, 8, 9, 9, 10, 11, 12, 15, 15),\n                 x2=c(8, 7, 7, 6, 6, 4, 3, 5, 4, 6, 5, 4, 3, 2, 2))\n\n<span style=\"color: #008080;\">#create boxplot for 'x1' variable<\/span>\nggplot(df, aes(x=x1)) +\n  geom_boxplot()\n<\/span><\/span><\/strong><\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-20686 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/aes11.png\" alt=\"\" width=\"635\" height=\"304\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Siamo in grado di creare con successo il boxplot ed evitare eventuali errori perch\u00e9 abbiamo utilizzato l&#8217;argomento <strong>aes()<\/strong> nella funzione <strong>ggplot()<\/strong> .<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">I seguenti tutorial spiegano come correggere altri errori comuni in R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/r-plot-new-non-e-stato-ancora-chiamato\/\" target=\"_blank\" rel=\"noopener\">Come risolvere in R: plot.new non \u00e8 stato ancora chiamato<\/a><br \/> Come risolvere il problema in R: formula modello non valida in ExtractVars<br \/><a href=\"https:\/\/statorials.org\/it\/r-sostituzione-a-lunghezza-zero\/\" target=\"_blank\" rel=\"noopener\">Come riparare in R: la sostituzione ha lunghezza zero<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un errore che potresti riscontrare quando usi R \u00e8: Error: `mapping` must be created by `aes()` Questo errore si verifica quando provi a utilizzare l&#8217;argomento aes() durante la creazione di un grafico in ggplot2 e lo usi nel posto sbagliato o lo usi senza la sintassi &#8220;mappatura&#8221;. L&#8217;esempio seguente mostra come correggere questo errore nella [&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>Come risolvere l&#039;errore in R:: `mapping` deve essere creato da `aes()` - Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.\" \/>\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\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come risolvere l&#039;errore in R:: `mapping` deve essere creato da `aes()` - Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-23T00:14:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/aes11.png\" \/>\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=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/\",\"url\":\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/\",\"name\":\"Come risolvere l&#39;errore in R:: `mapping` deve essere creato da `aes()` - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-23T00:14:53+00:00\",\"dateModified\":\"2023-07-23T00:14:53+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come risolvere l&#39;errore in r:: `mapping` deve essere creato da `aes()`\"}]},{\"@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":"Come risolvere l&#39;errore in R:: `mapping` deve essere creato da `aes()` - Statorials","description":"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.","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\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/","og_locale":"it_IT","og_type":"article","og_title":"Come risolvere l&#39;errore in R:: `mapping` deve essere creato da `aes()` - Statorials","og_description":"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.","og_url":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/","og_site_name":"Statorials","article_published_time":"2023-07-23T00:14:53+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/aes11.png"}],"author":"Benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Benjamin anderson","Est. reading time":"1 minuto"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/","url":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/","name":"Come risolvere l&#39;errore in R:: `mapping` deve essere creato da `aes()` - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-23T00:14:53+00:00","dateModified":"2023-07-23T00:14:53+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come correggere il seguente errore in R: errore: `mapping` deve essere creato da `aes()`.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/la-mappatura-degli-errori-deve-essere-creata-da-aes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come risolvere l&#39;errore in r:: `mapping` deve essere creato da `aes()`"}]},{"@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\/2270"}],"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=2270"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/2270\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=2270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=2270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=2270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}