

{"id":4898,"date":"2017-12-23T07:03:15","date_gmt":"2017-12-23T01:33:15","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=4898"},"modified":"2021-08-25T17:25:53","modified_gmt":"2021-08-25T11:55:53","slug":"r-numeric-and-character-functions","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/","title":{"rendered":"Numeric and Character Functions in R &#8211; Gain Proficiency in the concept!"},"content":{"rendered":"<p>In this tutorial, we will learn about R built-in functions,\u00a0in which we will focus on different types of numeric and character functions in R. Along with this, we will also understand different types of properties of character functions.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-62889\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg\" alt=\"Numeric and Character Functions in R\" width=\"802\" height=\"420\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg 802w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2-150x79.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2-300x157.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2-768x402.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2-520x272.jpg 520w\" sizes=\"auto, (max-width: 802px) 100vw, 802px\" \/><\/a><\/p>\n<p>So, let&#8217;s start the R numeric and character functions tutorial.<\/p>\n<h2>R Built-in Functions<\/h2>\n<p>We use R built-in functions to perform almost everything in R. Here we are only referring to numeric and character functions that are generally used in creating or recording variables.<\/p>\n<p><em><strong>Wait! Have you checked &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/r-vector-functions\/\">R Vector Functions<\/a><\/strong><\/em><\/p>\n<h2>R Numeric Functions<\/h2>\n<p>Let us see R\u00a0Numeric functions:<br \/>\n<b><\/b><\/p>\n<p><b>\u00a0 \u00a0 \u00a0Function\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 Description<\/b><\/p>\n<ul>\n<li style=\"text-align: left\">abs(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0absolute value<\/li>\n<li style=\"text-align: left\">ceiling(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0ceiling(3.475) is 4<\/li>\n<li style=\"text-align: left\">sqrt(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 square root<\/li>\n<li style=\"text-align: left\">floor(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0floor(3.475) is 3<\/li>\n<li style=\"text-align: left\">log(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 natural logarithm<\/li>\n<li style=\"text-align: left\">trunc(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 trunc(5.99) is 5<\/li>\n<li style=\"text-align: left\"><span style=\"font-weight: 400\">round(x, digits=n)\u00a0 \u00a0 \u00a0 \u00a0 round(3.475, digit=2) is 3.48<\/span><\/li>\n<li style=\"text-align: left\">log10(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 common logarithm<\/li>\n<li style=\"text-align: left\">signif(x, digits=n)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0signif(3.475, digit=2) is 3.5<\/li>\n<li style=\"text-align: left\">exp(x)\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 e^x<\/li>\n<li style=\"text-align: left\">cos(x), sin(x), tan(x)\u00a0 \u00a0 \u00a0 also acos(x), cosh(x), acosh(zx) etc<\/li>\n<\/ul>\n<h2>Character Functions in R<\/h2>\n<p>Let us see various R character functions:<\/p>\n<p><strong>1. grep(pattern, x , ignore.case=FALSE, fixed=FALSE)<\/strong><\/p>\n<p><strong>Description:<\/strong><\/p>\n<ol>\n<li>Search for a pattern in x.<\/li>\n<li>If fixed =FALSE, then the pattern is a regular expression.<\/li>\n<li>If fixed=TRUE, then the pattern is a text string.<\/li>\n<li>Returns matching indices.<\/li>\n<\/ol>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; grep(\"A\", c(\"b\", \"A\", \"c\"), fixed = TRUE)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63106\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c.jpg\" alt=\"grep A c b A c\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/grep-A-c-b-A-c-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><strong>2.\u00a0substr(x, start=n1, stop=n2)<\/strong><\/p>\n<p><strong>Description:<\/strong><\/p>\n<ul>\n<li>Extract or replace substrings in a character vector.<\/li>\n<\/ul>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; string = \"abcdef\"\r\n&gt; substr(string,2,4)\r\n\r\n&gt; substr(string,2,4) &lt;- \"2222\"\r\n&gt; string<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63107\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f.jpg\" alt=\"string=a b c d e f\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/stringa-b-c-d-e-f-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><em><strong>You must definitely explore the <a href=\"https:\/\/data-flair.training\/blogs\/r-recursive-function\/\">R Recursive Function Tutorial<\/a><\/strong><\/em><\/p>\n<p><strong>3. strsplit<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; strsplit(\"abc\", \"\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63108\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c.jpg\" alt=\"strsplit a b c\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strsplit-a-b-c-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><strong>4.\u00a0sub(pattern, replacement, x, ignore.case =FALSE, fixed=FALSE)<\/strong><\/p>\n<p><strong>Description:<\/strong><\/p>\n<ol>\n<li>Find a pattern in x and replace it with the replacement text.<\/li>\n<li>If a fixed = FALSE, then a pattern is a regular expression.<\/li>\n<li>If fixed = TRUE, then a pattern is a text string.<\/li>\n<\/ol>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sub(\"\\\\s\",\".\",\"DataFlair\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63109\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s.jpg\" alt=\"sub s\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sub-s-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><strong>5. toupper(string)<\/strong><\/p>\n<p><b>Description:<\/b><\/p>\n<p>Uppercase<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; toupper(string)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string-.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63110\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string-.jpg\" alt=\"toupper string\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string-.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string--150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string--300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string--768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string--1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/toupper-string--520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><em><strong>Do you know about <a href=\"https:\/\/data-flair.training\/blogs\/object-oriented-programming-in-r\/\">Object Oriented Programming in R<\/a><\/strong><\/em><\/p>\n<p><strong>6.\u00a0tolower(string)<\/strong><\/p>\n<p><strong>Description:<\/strong><\/p>\n<p>Lowercase<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; tolower(string)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63111\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string.jpg\" alt=\"tolower string\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolower-string-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><strong>7. paste(&#8230;, sep=&#8221;&#8221;)<\/strong><\/p>\n<p><b>Description:<\/b><\/p>\n<p>Concatenate strings after using sep string to separate them.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; paste(\"string\", 1:3, sep = \"\")\r\n\r\n&gt; paste(\"string\", 1:3, sep = \"M\")\r\n\r\n&gt; paste(\"Today is\", date())<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-63112\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13.jpg\" alt=\"paste string 1:3 (Numeric and Character Functions in R)\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/paste-string-13-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h2>R Character Function &#8211; Create Strings<\/h2>\n<p>In R, we store strings in a character vector. We can create strings with a single quote\/ double quote.<br \/>\n<b><\/b><\/p>\n<p><b>For example &#8211;<\/b><span style=\"font-weight: 400\">\u00a0y = \u201cHadoop at DataFlair\u201d<\/span><\/p>\n<h4>1. Convert Object into Character type<\/h4>\n<p>We use an as.character function that converts arguments to a character type.<br \/>\n<b><\/b><\/p>\n<p><b>For example<\/b><span style=\"font-weight: 400\"> &#8211; We are storing 20 as a character.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Y = as.character(20)\r\nclass(Y)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63114 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character.jpg\" alt=\"Y = as.character\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Yas.character-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>The class(Y) returns character as 20 and is stored as a character in the above code.<\/p>\n<p><em><strong>Explore all the <a href=\"https:\/\/data-flair.training\/blogs\/r-arguments-introduction\/\">Types of Arguments in R<\/a><\/strong><\/em><\/p>\n<h4>2. Check the character type<\/h4>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; X = \u201cHadoop at DataFlair\u201d\r\n&gt; is.character(X)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63116 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop.jpg\" alt=\"is.character (x) - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xHadoop-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>There are other functions that are similar to is.character such as is.integer, is.array and is.character for validating integer, array and character data types respectively.<\/p>\n<h4>3. Concatenate Strings in R<\/h4>\n<p><span style=\"font-weight: 400\">In order to join the two strings (also known as concatenation), we make use of the paste function. <\/span><span style=\"font-weight: 400\">It is one of the most important strings manipulation task. Every analyst performs it almost daily to structure the data.<\/span><br \/>\n<b><\/b><\/p>\n<p><b>Paste Function Syntax:<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">paste (objects, sep = \" \", collapse = NULL)<\/pre>\n<ul>\n<li>sep &#8211; Keyword which denotes a separator or delimiter.<\/li>\n<li>default separator &#8211; A single space.<\/li>\n<li>collapse &#8211; Keyword which is used to separate the results.<br \/>\n<b><\/b><\/li>\n<\/ul>\n<p><b>For example<\/b><span style=\"font-weight: 400\">:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; x = \"DataFlair\"\r\n&gt; y = \"Big Data\"\r\n&gt; paste(x,y)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-59411\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R.jpg\" alt=\"Concatenate Strings in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Concatenate-Strings-in-R-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><em><strong>Understand the <a href=\"https:\/\/data-flair.training\/blogs\/r-string-manipulation-functions\/\">String Manipulation Function in R<\/a><\/strong><\/em><\/p>\n<h4>4. String Formatting in R<\/h4>\n<p>Suppose the value is stored in fraction and you need to convert it to percentage. In order to format our string in a C-style, sprintf function is used.<br \/>\n<b><\/b><\/p>\n<p><b>Sprintf Function Syntax:<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sprintf(fmt, ...)<\/pre>\n<p>The keyword fmt denotes string format. The numbers and letters in the format start with the % symbol.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">x = 0.25\r\nsprintf(\"%.2f%%\",x*100)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63118 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf.jpg\" alt=\"sprintf - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/x0.25-sprintf-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h4>5.\u00a0Extract or replace substrings in R<\/h4>\n<p><b>substr Syntax <\/b><span style=\"font-weight: 400\">&#8211; <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; name = \"abcdef\" #Author DataFlair\r\n&gt; substr(name,1,4)\r\n<b><\/b><\/pre>\n<p>In the above example, we are telling <a href=\"https:\/\/en.wikipedia.org\/wiki\/R_(programming_language)\">R<\/a> to replace first 3letters with 111.<\/p>\n<p><b>Replace Substring<\/b><span style=\"font-weight: 400\"> &#8211; substr(x, starting position, end position) = Value<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; substr(name,1,3) = \"11\" \r\n#Replacing Substring \r\n&gt; name<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63120 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f.jpg\" alt=\"substr name 1,4 (Numeric and Character Functions in R)\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/namea-b-c-d-e-f-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h4>6. String Length<\/h4>\n<p><span style=\"font-weight: 400\">The <\/span><b>nchar<\/b><span style=\"font-weight: 400\"> function is used to compute the length of a character value.<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; x = \"Big Data at DataFlair\"\r\n&gt; nchar(x)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63121 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx.jpg\" alt=\"nchar(x) - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/xBig-Data-ncharx-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p>It returns 14 as the vector &#8216;x&#8217; contains 14 letters (including 2 spaces).<\/p>\n<p><em><strong>Don&#8217;t forget to check the <a href=\"https:\/\/data-flair.training\/blogs\/r-statistics\/\">R Statistics Tutorial<\/a><\/strong><\/em><\/p>\n<h4>7. Extract word from a programming<\/h4>\n<p>Suppose you need to pull a first or last word from a character string.<br \/>\n<b><\/b><\/p>\n<p><b>Word Function Syntax (Library : stringr)<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">word(string, position of word to extract, separator)<\/pre>\n<p><b>For example<\/b><span style=\"font-weight: 400\">:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; name = \"Big Data DataFlair\"\r\n&gt; library(stringr)\r\n&gt; word(name,1)<\/pre>\n<p>In the example above, &#8216;1&#8217; denotes the first word to be extracted from a string.<br \/>\n<b><\/b><\/p>\n<p><b>Extract Last Word<\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; word(name,-1) #Extracting Last Word<\/pre>\n<p>In the example above, &#8216;-1&#8217; denotes the first word to be extracted from the right of the string.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63122 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr.jpg\" alt=\"library(stringr) - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/library-stringr-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h4>8. Convert Character to Uppercase \/ Lowercase \/Propercase<\/h4>\n<p>At many times, we need to change the case of a word.<br \/>\n<b><\/b><\/p>\n<p><b>For example<\/b><span style=\"font-weight: 400\">: convert the case to uppercase or lowercase.<\/span><b><\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; name = \"Big Data DataFlair\"\r\n&gt; tolower(name) #lowercase<\/pre>\n<p>The tolower() function converts letters in a string to lowercase.<\/p>\n<p>toupper(x)<br \/>\n<b><\/b><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; toupper(name) #UPPERCASE<\/pre>\n<p>The toupper() function converts letters in a string to uppercase.<\/p>\n<p>library(stringr)<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; library(stringr)\r\n&gt; str_to_title(name) #Title Case<\/pre>\n<p>The str_to_title() function converts the first letter in a string to uppercase and the remaining letters to lowercase.<\/p>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63125 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername.jpg\" alt=\"tolower name - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/tolowername-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<p><em><strong>Grab the <a href=\"https:\/\/data-flair.training\/blogs\/debugging-in-r-programming\/\">list of R Debug Functions<\/a><\/strong><\/em><\/p>\n<h4>9. Repeat the character N times<\/h4>\n<p>We can use strrep base R function to repeat the character N times.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; strrep(\"DataFlair\", 5)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63129 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep.jpg\" alt=\"strrep - Numeric and Character Functions in R\" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/strrep-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h4>10. Find String in a Character Variable<\/h4>\n<p>The str_detect() function helps to check whether a substring exists in a string. It is equal to &#8216;contain&#8217; function of SAS. It returns TRUE\/FALSE against each value.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; names = c(\"DataFlair\", \"Hadoop\", \"Spark\", \"Flink\")\r\n&gt; library(stringr)\r\n&gt; str_detect(names, \"DataFlair\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63130 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c.jpg\" alt=\"library stringr \" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/names-c-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h4>11. Splitting a Character Vector<\/h4>\n<p>In the case of text mining, it is required to split a string to calculate the used keywords in the list.\u00a0We use &#8216;strsplit()&#8217; in base R to perform this operation.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">&gt; sentence &lt;- \"Big Data at DataFlair\"\r\n&gt; strsplit(sentence, \"\")<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-63131 size-full\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data.jpg\" alt=\"sentence &lt;- Big Data \" width=\"1299\" height=\"741\" srcset=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data.jpg 1299w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data-150x86.jpg 150w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data-300x171.jpg 300w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data-768x438.jpg 768w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data-1024x584.jpg 1024w, https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/sentence-Big-Data-520x297.jpg 520w\" sizes=\"auto, (max-width: 1299px) 100vw, 1299px\" \/><\/a><\/p>\n<h2>Summary<\/h2>\n<p>We have studied in deep about various numeric and character functions in R and also learned different properties of these functions which help a lot in R programming.<\/p>\n<p><em><strong>Next tutorial in our learning box of R DataFlair Tutorial Series &#8211; <a href=\"https:\/\/data-flair.training\/blogs\/r-matrix-functions\/\">R Matrix Functions<\/a><\/strong><\/em><\/p>\n<p>Still, if any doubt regarding Numeric and Character Functions, ask in the comment section.<span hidden class=\"__iawmlf-post-loop-links\" data-iawmlf-links=\"[{&quot;id&quot;:1467,&quot;href&quot;:&quot;https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/R_(programming_language)&quot;,&quot;archived_href&quot;:&quot;http:\\\/\\\/web-wp.archive.org\\\/web\\\/20251001042859\\\/https:\\\/\\\/en.wikipedia.org\\\/wiki\\\/R_(programming_language)&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2025-12-09 08:17:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-12 12:22:33&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-15 12:29:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-18 15:20:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-21 18:00:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-25 04:08:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-28 06:54:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2025-12-31 09:47:17&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-03 17:14:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-06 19:17:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-09 21:09:32&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-13 04:31:41&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-16 15:06:53&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-19 19:03:58&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-23 05:30:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-26 10:18:28&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-01-29 11:45:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-01 12:00:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-04 12:09:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-07 15:09:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-10 18:01:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-13 23:45:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 05:29:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 07:23:59&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-23 10:05:24&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-26 14:54:33&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-01 16:00:29&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 19:56:49&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-08 03:19:57&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-03-11 07:47:37&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-14 13:54:22&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 17:24:09&quot;,&quot;http_code&quot;:429},{&quot;date&quot;:&quot;2026-03-20 23:04:55&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-24 00:07:34&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-27 00:15:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-30 08:20:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-03 14:48:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-06 19:55:35&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-10 05:52:27&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-13 07:47:26&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-16 08:05:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-19 13:04:23&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-22 13:52:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-25 13:58:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-29 01:16:25&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-02 04:13:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-05 06:33:38&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-08 17:48:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-12 03:38:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-15 04:53:06&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-18 09:15:30&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-21 12:35:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-25 03:51:04&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-05-28 07:13:15&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-01 04:45:49&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-04 06:40:14&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-07 06:45:43&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-10 09:02:48&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-13 16:18:42&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-16 16:46:46&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-19 17:47:20&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-23 10:18:08&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-06-26 13:31:48&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-06-29 19:56:22&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-06-29 19:56:22&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]\"><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will learn about R built-in functions,\u00a0in which we will focus on different types of numeric and character functions in R. Along with this, we will also understand different types of&#46;&#46;&#46;<\/p>\n","protected":false},"author":6,"featured_media":62889,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51],"tags":[16704,20151,20152],"class_list":["post-4898","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","tag-numeric-and-character-functions-in-r","tag-r-built-in-functions","tag-string-creation-from-r-character-function"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Numeric and Character Functions in R - Gain Proficiency in the concept! - DataFlair<\/title>\n<meta name=\"description\" content=\"Explore the R inbuilt functions; numeric and character functions in R. Learn to create strings from R character functions with syntax and examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Numeric and Character Functions in R - Gain Proficiency in the concept! - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Explore the R inbuilt functions; numeric and character functions in R. Learn to create strings from R character functions with syntax and examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-23T01:33:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-25T11:55:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"802\" \/>\n\t<meta property=\"og:image:height\" content=\"420\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Numeric and Character Functions in R - Gain Proficiency in the concept! - DataFlair","description":"Explore the R inbuilt functions; numeric and character functions in R. Learn to create strings from R character functions with syntax and examples.","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:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/","og_locale":"en_US","og_type":"article","og_title":"Numeric and Character Functions in R - Gain Proficiency in the concept! - DataFlair","og_description":"Explore the R inbuilt functions; numeric and character functions in R. Learn to create strings from R character functions with syntax and examples.","og_url":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2017-12-23T01:33:15+00:00","article_modified_time":"2021-08-25T11:55:53+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-1.jpg","type":"image\/jpeg"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89"},"headline":"Numeric and Character Functions in R &#8211; Gain Proficiency in the concept!","datePublished":"2017-12-23T01:33:15+00:00","dateModified":"2021-08-25T11:55:53+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/"},"wordCount":935,"commentCount":1,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg","keywords":["Numeric and Character Functions in R","R Built-in Functions","String Creation from R Character Function"],"articleSection":["R Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/","url":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/","name":"Numeric and Character Functions in R - Gain Proficiency in the concept! - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg","datePublished":"2017-12-23T01:33:15+00:00","dateModified":"2021-08-25T11:55:53+00:00","description":"Explore the R inbuilt functions; numeric and character functions in R. Learn to create strings from R character functions with syntax and examples.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2017\/12\/Numeric-and-Character-Functions-in-R-2.jpg","width":802,"height":420,"caption":"Numeric and Character Functions in R"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/r-numeric-and-character-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"R Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/r\/"},{"@type":"ListItem","position":3,"name":"Numeric and Character Functions in R &#8211; Gain Proficiency in the concept!"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/2c58ecb4f73a39f0ef993f1ddfcd7b89","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ce4a0e3e542444fc73bbebf83e89e8b73e2d95ccb1fcee64da9945f078b97c5?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"The DataFlair Team provides industry-driven content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our expert educators focus on delivering value-packed, easy-to-follow resources for tech enthusiasts and professionals.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam2\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4898","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=4898"}],"version-history":[{"count":13,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4898\/revisions"}],"predecessor-version":[{"id":63135,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/4898\/revisions\/63135"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/62889"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=4898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=4898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=4898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}