{"id":1971,"date":"2023-07-24T06:24:51","date_gmt":"2023-07-24T06:24:51","guid":{"rendered":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/"},"modified":"2023-07-24T06:24:51","modified_gmt":"2023-07-24T06:24:51","slug":"creare-una-matrice-vuota-in-r","status":"publish","type":"post","link":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/","title":{"rendered":"Come creare una matrice vuota in r (con esempi)"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">\u00c8 possibile utilizzare la seguente sintassi per creare una matrice vuota di una dimensione specifica in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create empty matrix with 10 rows and 3 columns<\/span>\nempty_matrix &lt;- matrix(, nrow= <span style=\"color: #008000;\">10<\/span> , ncol= <span style=\"color: #008000;\">3<\/span> )\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Gli esempi seguenti mostrano come utilizzare questa sintassi nella pratica.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Esempio 1: creare una matrice vuota di una dimensione specifica<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Il codice seguente mostra come creare una matrice vuota di una dimensione specifica in R:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create empty matrix with 10 rows and 3 columns\n<\/span>empty_matrix &lt;- matrix(, nrow= <span style=\"color: #008000;\">10<\/span> , ncol= <span style=\"color: #008000;\">3<\/span> )\n\n<span style=\"color: #008080;\">#view empty matrix\n<\/span>empty_matrix\n\n      [,1] [,2] [,3]\n [1,] NA NA NA\n [2,] NA NA NA\n [3,] NA NA NA\n [4,] NA NA NA\n [5,] NA NA NA\n [6,] NA NA NA\n [7,] NA NA NA\n [8,] NA NA NA\n [9,] NA NA NA\n[10,] NA NA NA\n\n<span style=\"color: #008080;\">#view class<\/span>\nclass(empty_matrix)\n\n[1] \"matrix\" \"array\" \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Il risultato \u00e8 una matrice di 10 righe e 3 colonne in cui ogni elemento della matrice \u00e8 vuoto.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Esempio 2: creare una matrice di dimensione sconosciuta<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\"><span style=\"color: #000000;\">Se non sai in anticipo quale sar\u00e0 la dimensione finale della matrice, puoi utilizzare il codice seguente per generare i dati per le colonne della matrice e unire ciascuna colonna insieme utilizzando la funzione <a href=\"https:\/\/statorials.org\/it\/clegare-a-r\/\" target=\"_blank\" rel=\"noopener\">cbind()<\/a> :<\/span><\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#create empty list\n<\/span>my_list &lt;-list()\n\n<span style=\"color: #008080;\">#add data using for loop\n<\/span><span style=\"color: #008000;\">for<\/span> (i <span style=\"color: #008000;\">in<\/span> 1:4) {\n    my_list[[i]] &lt;- rnorm(10)\n}\n\n<span style=\"color: #008080;\">#column bind values into a matrix\n<\/span>my_matrix = do. <span style=\"color: #3366ff;\">call<\/span> (cbind, my_list)\n\n<span style=\"color: #008080;\">#view final matrix\n<\/span>my_matrix\n\n            [,1] [,2] [,3] [,4]\n [1,] 1.3064332 1.18175760 2.1603867 1.2378847\n [2,] 0.8618439 0.66663694 0.1113606 0.2062029\n [3,] -0.4689356 -0.03200797 -1.3872632 1.6531437\n [4,] -0.4664767 -0.79285400 0.3972758 0.1632975\n [5,] 0.5880580 1.05795303 -0.5655543 -0.3557376\n [6,] 0.5412100 -0.32070294 -0.3687303 -1.1778959\n [7,] 0.5073627 -0.24925226 1.0031305 0.6336998\n [8,] 0.8047177 0.10968558 0.3225197 1.6776955\n [9,] 1.5755134 1.40435730 1.8360239 0.5612274\n[10,] -0.6430913 0.01173386 0.3181037 -0.8414270\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Il risultato \u00e8 una matrice di 10 righe e 4 colonne.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Risorse addizionali<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">I seguenti esempi mostrano come creare altri oggetti vuoti in R:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/it\/creare-un-dataframe-vuoto-in-r\/\" target=\"_blank\" rel=\"noopener\">Come creare un frame di dati vuoto in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/creare-una-lista-vuota-in-r\/\" target=\"_blank\" rel=\"noopener\">Come creare un elenco vuoto in R<\/a><br \/> <a href=\"https:\/\/statorials.org\/it\/crea-un-vettore-vuoto-in-r\/\" target=\"_blank\" rel=\"noopener\">Come creare un vettore vuoto in R<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00c8 possibile utilizzare la seguente sintassi per creare una matrice vuota di una dimensione specifica in R: #create empty matrix with 10 rows and 3 columns empty_matrix &lt;- matrix(, nrow= 10 , ncol= 3 ) Gli esempi seguenti mostrano come utilizzare questa sintassi nella pratica. Esempio 1: creare una matrice vuota di una dimensione specifica [&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 creare una matrice vuota in R (con esempi) \u2013 Statorials<\/title>\n<meta name=\"description\" content=\"Questo tutorial spiega come creare una matrice vuota 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\/creare-una-matrice-vuota-in-r\/\" \/>\n<meta property=\"og:locale\" content=\"it_IT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Come creare una matrice vuota in R (con esempi) \u2013 Statorials\" \/>\n<meta property=\"og:description\" content=\"Questo tutorial spiega come creare una matrice vuota in R, con diversi esempi.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-24T06:24:51+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=\"1 minuto\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/\",\"url\":\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/\",\"name\":\"Come creare una matrice vuota in R (con esempi) \u2013 Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/it\/#website\"},\"datePublished\":\"2023-07-24T06:24:51+00:00\",\"dateModified\":\"2023-07-24T06:24:51+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae\"},\"description\":\"Questo tutorial spiega come creare una matrice vuota in R, con diversi esempi.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/#breadcrumb\"},\"inLanguage\":\"it-IT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Casa\",\"item\":\"https:\/\/statorials.org\/it\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Come creare una matrice vuota in r (con esempi)\"}]},{\"@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 creare una matrice vuota in R (con esempi) \u2013 Statorials","description":"Questo tutorial spiega come creare una matrice vuota 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\/creare-una-matrice-vuota-in-r\/","og_locale":"it_IT","og_type":"article","og_title":"Come creare una matrice vuota in R (con esempi) \u2013 Statorials","og_description":"Questo tutorial spiega come creare una matrice vuota in R, con diversi esempi.","og_url":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/","og_site_name":"Statorials","article_published_time":"2023-07-24T06:24:51+00:00","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\/creare-una-matrice-vuota-in-r\/","url":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/","name":"Come creare una matrice vuota in R (con esempi) \u2013 Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/it\/#website"},"datePublished":"2023-07-24T06:24:51+00:00","dateModified":"2023-07-24T06:24:51+00:00","author":{"@id":"https:\/\/statorials.org\/it\/#\/schema\/person\/0896f191fb9fb019f2cd8623112cb3ae"},"description":"Questo tutorial spiega come creare una matrice vuota in R, con diversi esempi.","breadcrumb":{"@id":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/#breadcrumb"},"inLanguage":"it-IT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/it\/creare-una-matrice-vuota-in-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Casa","item":"https:\/\/statorials.org\/it\/"},{"@type":"ListItem","position":2,"name":"Come creare una matrice vuota in r (con esempi)"}]},{"@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\/1971"}],"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=1971"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/posts\/1971\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/media?parent=1971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/categories?post=1971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/it\/wp-json\/wp\/v2\/tags?post=1971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}