{"id":854,"date":"2022-12-04T01:04:21","date_gmt":"2022-12-04T01:04:21","guid":{"rendered":"https:\/\/s-oneill.com\/sov02\/?p=854"},"modified":"2022-12-04T01:04:21","modified_gmt":"2022-12-04T01:04:21","slug":"r-programming","status":"publish","type":"post","link":"https:\/\/s-oneill.com\/sov02\/r-programming\/","title":{"rendered":"R Programming"},"content":{"rendered":"<h3>This area discusses popular functions used in RStudio <\/h3>\n<p>(sum(!is.na(x))) &#8211; count of non-missing values<br \/>\nggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = class))<br \/>\nas.character() changes type to be character<br \/>\nas.integer()  changes type to be integer<br \/>\nas.numeric()<br \/>\nc() creates a vector<br \/>\nc() creates a vector (concatenate, combine)<br \/>\nclass()  returns objects type    > class(1)     [1] &#8220;numeric&#8221;<br \/>\ndata() view available datasets<br \/>\nexp() computes the exponential function<br \/>\nfilter()  subset observations based on values<br \/>\nggplot()  ggplot(data = <DATA>) +   <GEOM_FUNCTION>(mapping = aes(<MAPPINGS>))<br \/>\nhead() first 6 lines<br \/>\nhelp()<br \/>\ninstall.packages<br \/>\nis.vector(x) returns TRUE if x is a vector<br \/>\nlength() &#8211; how many entries are in the vector<br \/>\nlibrary() loads library into workspace (must be installed first)<br \/>\nlog(x, base)<br \/>\nls() list variables assigned in workspace<br \/>\nmatch() tells which indexes of vector B match each of the entries of vector A:<br \/>\nmax() largest value<br \/>\nmean() calculates the average of all vector elements<br \/>\nmin()<br \/>\nmutate(),<br \/>\nnames() gives names to values in a vector so they can be referenced by name<br \/>\nnrow(), number of rows<br \/>\norder() returns the vector of indexes (helpful w\/ a sorted vector)<br \/>\nrank() returns a vector with the rank of the entries (1st, 2nd, etc)<br \/>\nrm() remove from workspace<br \/>\nseq(1,10,2) creates vector from 1 to 10 jump by 2 > [1] 1 3 5 7 9<br \/>\nsort() sorts from least to  most<br \/>\nsqrt() square root of a value<br \/>\nstr() &#8211; displays structure of object<br \/>\nsum(x, y, z) adds llist of numbers<br \/>\ntable() takes a vector and returns the frequency of each element.<br \/>\ntail(x, 1), last element of a vector<br \/>\nView() displays object as a spreadsheethttps:\/\/rstudio-education.github.io\/hopr\/preface.html#acknowledgments<br \/>\nwhich.max() for the index of the largest value<br \/>\nwhich.min()<br \/>\nwhich() convert vectors of logicals into indexes &#8211; tells which entries are TRUE.<br \/>\nwith(data, expr, &#8230;) Evaluate  data with an expression<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This area discusses popular functions used in RStudio (sum(!is.na(x))) &#8211; count of non-missing values ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = class)) as.character() changes type to be character as.integer() changes type to be integer as.numeric() c() creates a vector c() creates a vector (concatenate, combine) class() returns objects [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-854","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>R Programming - s-oneill.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/s-oneill.com\/sov02\/r-programming\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R Programming - s-oneill.com\" \/>\n<meta property=\"og:description\" content=\"This area discusses popular functions used in RStudio (sum(!is.na(x))) &#8211; count of non-missing values ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = class)) as.character() changes type to be character as.integer() changes type to be integer as.numeric() c() creates a vector c() creates a vector (concatenate, combine) class() returns objects [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/s-oneill.com\/sov02\/r-programming\/\" \/>\n<meta property=\"og:site_name\" content=\"s-oneill.com\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-04T01:04:21+00:00\" \/>\n<meta name=\"author\" content=\"Me(sean)\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Me(sean)\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/\"},\"author\":{\"name\":\"Me(sean)\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\"},\"headline\":\"R Programming\",\"datePublished\":\"2022-12-04T01:04:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/\"},\"wordCount\":298,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/r-programming\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/\",\"url\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/\",\"name\":\"R Programming - s-oneill.com\",\"isPartOf\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\"},\"datePublished\":\"2022-12-04T01:04:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/s-oneill.com\/sov02\/r-programming\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/r-programming\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/s-oneill.com\/sov02\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R Programming\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#website\",\"url\":\"https:\/\/s-oneill.com\/sov02\/\",\"name\":\"s-oneill.com\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a\",\"name\":\"sean o\",\"logo\":{\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/\"},\"description\":\"Web dev over 15 years.\",\"sameAs\":[\"http:\/\/s-oneill.com\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545\",\"name\":\"Me(sean)\",\"url\":\"https:\/\/s-oneill.com\/sov02\/author\/user01\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"R Programming - s-oneill.com","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:\/\/s-oneill.com\/sov02\/r-programming\/","og_locale":"en_US","og_type":"article","og_title":"R Programming - s-oneill.com","og_description":"This area discusses popular functions used in RStudio (sum(!is.na(x))) &#8211; count of non-missing values ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color = class)) as.character() changes type to be character as.integer() changes type to be integer as.numeric() c() creates a vector c() creates a vector (concatenate, combine) class() returns objects [&hellip;]","og_url":"https:\/\/s-oneill.com\/sov02\/r-programming\/","og_site_name":"s-oneill.com","article_published_time":"2022-12-04T01:04:21+00:00","author":"Me(sean)","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Me(sean)"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/#article","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/"},"author":{"name":"Me(sean)","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545"},"headline":"R Programming","datePublished":"2022-12-04T01:04:21+00:00","mainEntityOfPage":{"@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/"},"wordCount":298,"commentCount":0,"publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/s-oneill.com\/sov02\/r-programming\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/","url":"https:\/\/s-oneill.com\/sov02\/r-programming\/","name":"R Programming - s-oneill.com","isPartOf":{"@id":"https:\/\/s-oneill.com\/sov02\/#website"},"datePublished":"2022-12-04T01:04:21+00:00","breadcrumb":{"@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/s-oneill.com\/sov02\/r-programming\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/s-oneill.com\/sov02\/r-programming\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/s-oneill.com\/sov02\/"},{"@type":"ListItem","position":2,"name":"R Programming"}]},{"@type":"WebSite","@id":"https:\/\/s-oneill.com\/sov02\/#website","url":"https:\/\/s-oneill.com\/sov02\/","name":"s-oneill.com","description":"","publisher":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/s-oneill.com\/sov02\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/a9217b5797251a243dfd504d7ad7d00a","name":"sean o","logo":{"@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/image\/"},"description":"Web dev over 15 years.","sameAs":["http:\/\/s-oneill.com"]},{"@type":"Person","@id":"https:\/\/s-oneill.com\/sov02\/#\/schema\/person\/ab11148c6ea273be80dddd8baec1a545","name":"Me(sean)","url":"https:\/\/s-oneill.com\/sov02\/author\/user01\/"}]}},"_links":{"self":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/comments?post=854"}],"version-history":[{"count":1,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/854\/revisions"}],"predecessor-version":[{"id":855,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/posts\/854\/revisions\/855"}],"wp:attachment":[{"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/media?parent=854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/categories?post=854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/s-oneill.com\/sov02\/wp-json\/wp\/v2\/tags?post=854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}