{"id":10430,"date":"2024-03-14T12:07:16","date_gmt":"2024-03-14T12:07:16","guid":{"rendered":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/"},"modified":"2025-08-03T23:25:43","modified_gmt":"2025-08-03T23:25:43","slug":"what-is-the-usage-of-the-update-function-in-the-r-language","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/","title":{"rendered":"R Update Function: Modify Models"},"content":{"rendered":"<p>In R language, the update function is used to modify or update existing model objects. This function takes two parameters: the first parameter is the original model object, and the second parameter is a formula object used to specify the new model structure.<\/p>\n<p>Here is an example of how to use the update function:<\/p>\n<pre class=\"post-pre\"><code><span class=\"hljs-comment\"># \u521b\u5efa\u4e00\u4e2a\u7ebf\u6027\u56de\u5f52\u6a21\u578b<\/span>\r\nmodel <span class=\"hljs-operator\">&lt;-<\/span> lm<span class=\"hljs-punctuation\">(<\/span>Sepal.Length <span class=\"hljs-operator\">~<\/span> Sepal.Width <span class=\"hljs-operator\">+<\/span> Petal.Length<span class=\"hljs-punctuation\">,<\/span> data <span class=\"hljs-operator\">=<\/span> iris<span class=\"hljs-punctuation\">)<\/span>\r\n\r\n<span class=\"hljs-comment\"># \u66f4\u65b0\u6a21\u578b\u7ed3\u6784\uff0c\u6dfb\u52a0Petal.Width\u4f5c\u4e3a\u65b0\u7684\u81ea\u53d8\u91cf<\/span>\r\nnew_model <span class=\"hljs-operator\">&lt;-<\/span> update<span class=\"hljs-punctuation\">(<\/span>model<span class=\"hljs-punctuation\">,<\/span> . <span class=\"hljs-operator\">~<\/span> . <span class=\"hljs-operator\">+<\/span> Petal.Width<span class=\"hljs-punctuation\">)<\/span>\r\n\r\n<span class=\"hljs-comment\"># \u6253\u5370\u65b0\u7684\u6a21\u578b\u7ed3\u6784<\/span>\r\nsummary<span class=\"hljs-punctuation\">(<\/span>new_model<span class=\"hljs-punctuation\">)<\/span>\r\n<\/code><\/pre>\n<p>In the example above, we initially created a linear regression model with Sepal.Width and Petal.Length as independent variables. Next, we used the update function to add Petal.Width as a new independent variable, thus updating the model structure. Finally, we viewed the new model structure using the summary function.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In R language, the update function is used to modify or update existing model objects. This function takes two parameters: the first parameter is the original model object, and the second parameter is a formula object used to specify the new model structure. Here is an example of how to use the update function: # [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[1],"tags":[337,13010,521,65,13009],"class_list":["post-10430","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-data-analysis","tag-model-objects","tag-r-language","tag-r-programming","tag-update-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R Update Function: Modify Models - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R Update Function: Modify Models\" \/>\n<meta property=\"og:description\" content=\"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-14T12:07:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-03T23:25:43+00:00\" \/>\n<meta name=\"author\" content=\"Ava Mitchell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:site\" content=\"@SiliCloudGlobal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ava Mitchell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\"},\"author\":{\"name\":\"Ava Mitchell\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64\"},\"headline\":\"R Update Function: Modify Models\",\"datePublished\":\"2024-03-14T12:07:16+00:00\",\"dateModified\":\"2025-08-03T23:25:43+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\"},\"wordCount\":110,\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"keywords\":[\"Data Analysis\",\"model objects\",\"R language\",\"R programming\",\"update function\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\",\"name\":\"R Update Function: Modify Models - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\"},\"datePublished\":\"2024-03-14T12:07:16+00:00\",\"dateModified\":\"2025-08-03T23:25:43+00:00\",\"description\":\"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.silicloud.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R Update Function: Modify Models\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"name\":\"Silicon Cloud Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\"},\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#organization\",\"name\":\"Silicon Cloud Blog\",\"url\":\"https:\/\/www.silicloud.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"contentUrl\":\"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png\",\"width\":1024,\"height\":1024,\"caption\":\"Silicon Cloud Blog\"},\"image\":{\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/SiliCloudGlobal\/\",\"https:\/\/twitter.com\/SiliCloudGlobal\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64\",\"name\":\"Ava Mitchell\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g\",\"caption\":\"Ava Mitchell\"},\"url\":\"https:\/\/www.silicloud.com\/blog\/author\/avamitchell\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"R Update Function: Modify Models - Blog - Silicon Cloud","description":"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.","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:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/","og_locale":"en_US","og_type":"article","og_title":"R Update Function: Modify Models","og_description":"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.","og_url":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/","og_site_name":"Blog - Silicon Cloud","article_publisher":"https:\/\/www.facebook.com\/SiliCloudGlobal\/","article_published_time":"2024-03-14T12:07:16+00:00","article_modified_time":"2025-08-03T23:25:43+00:00","author":"Ava Mitchell","twitter_card":"summary_large_image","twitter_creator":"@SiliCloudGlobal","twitter_site":"@SiliCloudGlobal","twitter_misc":{"Written by":"Ava Mitchell","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#article","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/"},"author":{"name":"Ava Mitchell","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64"},"headline":"R Update Function: Modify Models","datePublished":"2024-03-14T12:07:16+00:00","dateModified":"2025-08-03T23:25:43+00:00","mainEntityOfPage":{"@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/"},"wordCount":110,"publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"keywords":["Data Analysis","model objects","R language","R programming","update function"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/","url":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/","name":"R Update Function: Modify Models - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/blog\/#website"},"datePublished":"2024-03-14T12:07:16+00:00","dateModified":"2025-08-03T23:25:43+00:00","description":"The update function in R modifies existing model objects. Learn how to use update() to change model structure with this practical R programming guide.","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/blog\/what-is-the-usage-of-the-update-function-in-the-r-language\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.silicloud.com\/blog\/"},{"@type":"ListItem","position":2,"name":"R Update Function: Modify Models"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/blog\/#website","url":"https:\/\/www.silicloud.com\/blog\/","name":"Silicon Cloud Blog","description":"","publisher":{"@id":"https:\/\/www.silicloud.com\/blog\/#organization"},"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.silicloud.com\/blog\/#organization","name":"Silicon Cloud Blog","url":"https:\/\/www.silicloud.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","contentUrl":"https:\/\/www.silicloud.com\/blog\/wp-content\/uploads\/2023\/11\/EN-SILICON-Full.png","width":1024,"height":1024,"caption":"Silicon Cloud Blog"},"image":{"@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/SiliCloudGlobal\/","https:\/\/twitter.com\/SiliCloudGlobal"]},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/a3e2658c2cb9fb2be95ae0a8861f4a64","name":"Ava Mitchell","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.silicloud.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/15c63cd0564b4a2e07d611bcdffa296f6ea80e8db07c3091f43a84010514899d?s=96&d=mm&r=g","caption":"Ava Mitchell"},"url":"https:\/\/www.silicloud.com\/blog\/author\/avamitchell\/"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/10430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/comments?post=10430"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/10430\/revisions"}],"predecessor-version":[{"id":154189,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/posts\/10430\/revisions\/154189"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/media?parent=10430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/categories?post=10430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/blog\/wp-json\/wp\/v2\/tags?post=10430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}