{"id":75512,"date":"2020-01-15T11:54:55","date_gmt":"2020-01-15T06:24:55","guid":{"rendered":"https:\/\/techvidvan.com\/tutorials\/?p=75512"},"modified":"2020-01-15T11:54:55","modified_gmt":"2020-01-15T06:24:55","slug":"r-functions","status":"publish","type":"post","link":"https:\/\/techvidvan.com\/tutorials\/r-functions\/","title":{"rendered":"User-Defined Functions in R Programming with Examples"},"content":{"rendered":"<p>Functions in a programming language are sets of instructions. They divide the code into logical chunks. They help to reduce the complexity of the program and to avoid repetition.<\/p>\n<p>In this article, we are going to learn how to create <strong>user-defined functions in R<\/strong>. We will see when they are needed and what we can do with them. Are you ready for some learning?<\/p>\n<h2>What is R function?<\/h2>\n<p>A function is a collection of <strong>instructions or statements<\/strong> that work together to accomplish a definite task. R treats functions as <strong>objects<\/strong>. The interpreter can pass control to them along with the arguments required by the function. Once the function has achieved its objective, it passes control back to the interpreter.<\/p>\n<h3>Components of R function<\/h3>\n<p>The following are the components of any function in R. A function may or may not have all or some of them.<\/p>\n<ol>\n<li><strong>Function name<\/strong>: Every function needs a name. This name is used to call the function from other parts of the program. R stores a function as an object with this name given to it.<\/li>\n<li><strong>Arguments<\/strong>: Arguments are placeholders for the inputs a function may require. When we call a function, we need to provide the proper values for all the arguments the function needs. A function may or may not have one or more arguments.<\/li>\n<li><strong>Function body<\/strong>: A function\u2019s body contains a set of instructions or statements. The body is where the magic happens. A function completes its task by running the code inside its body.<\/li>\n<li><strong>Return value: <\/strong>After the function has completed its task, it may or may not return a value before handing over control to the interpreter. This return value can be the result of the task done by the function or confirmation about the completion or failure of the task.<\/li>\n<\/ol>\n<h3>Syntax of function<\/h3>\n<p>The following is the syntax for a user-defined function in R:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Function_name &lt;- function(arguments){\n   function_body\n   return (return)\n}\n<\/pre>\n<p>Where <strong><code>function_name<\/code><\/strong> is the name of the function,<br \/>\n<strong><code>arguments<\/code><\/strong> are the input arguments needed by the function,<br \/>\n<strong><code>function_body<\/code><\/strong> is the body of the function,<br \/>\n<strong><code>return<\/code><\/strong> is the return value of the function.<\/p>\n<h3>How to call R function?<\/h3>\n<p>Once you have created a function, how do you call it? Where can you call the function?<\/p>\n<p>You can call a function from anywhere in the <strong>environment<\/strong> in which the function is declared. We will read more about global and local environments and scopes in a later section.<\/p>\n<p>To call a function, we simply have to use the function\u2019s name and provide appropriate arguments. For example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">function_name(arguments)<\/pre>\n<p>Where <strong><code>function_name<\/code><\/strong> is the name of the function you want to call,<\/p>\n<p>and <strong><code>arguments<\/code><\/strong> are the arguments needed by the function.<\/p>\n<p>If the function doesn\u2019t need any arguments, the parenthesis can be left empty.<\/p>\n<h3>When do you need the R function?<\/h3>\n<p>As a general rule of thumb, we would say you need a function if you need to run the same few lines of code more than once. Look at the example below:<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vec1 &lt;- c(28,64,63,43,56,46,87,34,73)\nvec2 &lt;- c(53,37,29,45,68,33,76,49,30)\nvec3 &lt;- c(12,44,36,75,36,93,34,64,18)\nvec1 &lt;- ((vec1-min(vec1))\/(max(vec1)-min(vec1)))\nvec2 &lt;- ((vec2-min(vec2))\/(max(vec2)-min(vec2)))\nvec3 &lt;- ((vec3-min(vec3))\/(max(vec3)-min(vec3)))\nvec1<\/pre>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vec2\nvec3<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-when-need-functions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75517\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-when-need-functions.png\" alt=\"when need functions in R\" width=\"1299\" height=\"741\" \/><\/a><\/strong><\/p>\n<p>The above code rescales the vectors to a range of 0 to 1. The formula for that is reused every time. This approach is time-consuming and prone to errors. Instead, if we can define a function that does the calculation on an input vector, our work would become much easier and faster.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">rescale &lt;- function(vec){\n  vec &lt;- ((vec-min(vec))\/(max(vec)-min(vec)))\n  return(vec)\n}\nrescale(vec1)<\/pre>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">rescale(vec2)\nrescale(vec3)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong> <a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-when-need-function-rescale.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75522\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-when-need-function-rescale.png\" alt=\"when need R function rescale()\" width=\"1299\" height=\"741\" \/><\/a><\/strong><\/p>\n<p>Forgot how to use R vectors? Revise <strong><a href=\"https:\/\/techvidvan.com\/tutorials\/r-vector\/\">vectors in R<\/a><\/strong><\/p>\n<h3>Single line functions<\/h3>\n<p>The curly brackets around the function\u2019s body are not necessary if the body consists of a single line of code only. For example:<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">vec1 &lt;- c(28,64,63,43,56,46,87,34,73)\nreciprocal &lt;- function(vec) vec &lt;- 1\/vec\nrvec1 &lt;- reciprocal(vec1)\nrvec1<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-single-line-functions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75523\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-single-line-functions.png\" alt=\"single line R functions\" width=\"1299\" height=\"741\" \/><\/a><\/strong><\/p>\n<h3>Return value<\/h3>\n<p>Sometimes, we need the functions to <strong>return the results<\/strong> of their processing. For example, the following function returns a string telling whether or not the input number is divisible by three.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">check &lt;- function(x){\n  if(x%%3==0){\n    result &lt;- \"the number is divisible by three\"\n  }else {\n    result = \"the number is not divisible by three\"\n  }\n  return(result)\n}<\/pre>\n<p>Here are a few test runs of the function:<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">check(6)\ncheck(12)\ncheck(11)\ncheck(8)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-return-value-divisible-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75524\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-return-value-divisible-3.png\" alt=\"return value divisible 3 - functions in r \" width=\"1299\" height=\"742\" \/><\/a><\/strong><\/p>\n<p>In case the return statement is not present, R returns the value of the last expression in the function by default.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">check &lt;- function(x){\n  if(x%%3==0){\n    result &lt;- \"the number is divisible by three\"\n  }else {\n    result = \"the number is not divisible by three\"\n  }\n  result\n}<\/pre>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">check(17)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-return-value-divisible-3-default.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75525\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-return-value-divisible-3-default.png\" alt=\"return value divisible 3 default - functions in r\" width=\"1299\" height=\"741\" \/><\/a><\/strong><\/p>\n<p>Explore <strong>if-else<\/strong> and other <a href=\"https:\/\/techvidvan.com\/tutorials\/r-control-structures\/\"><strong>control structures in R<\/strong><\/a><\/p>\n<h3>Scope of R functions<\/h3>\n<p>An environment is the collection of all the variables and objects. The top-level of the environment is the <strong>global environment<\/strong>. When we create a function, it creates a <strong>local environment<\/strong> that exists in the global environment. The function operates inside the local environment.<\/p>\n<h4>Local vs global variables<\/h4>\n<p>Global variables are variables declared in a global scope that is they are accessible from anywhere in the global environment.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Local_variable\">Local variables <\/a>are variables declared in a local scope i.e. they are only accessible inside their local environment.<\/p>\n<p><em><strong>Note<\/strong>: Global variables are accessible inside local environments but local variables are not accessible outside their local environments.<\/em><\/p>\n<p>Variables and objects created inside a function, exist only inside the function\u2019s local environment. If an object does not exist inside the function\u2019s local environment, then the interpreter tries to find it in the global environment.<\/p>\n<h3>Recursive functions<\/h3>\n<p>It is possible for functions to call themselves. We call a function that calls itself, a <strong>recursive function<\/strong>. We call this technique, <strong>recursion<\/strong>.<\/p>\n<p>Recursion is useful to break down larger <strong>repetitive problems<\/strong> into smaller chunks. Take a look at the following factorial function.<\/p>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">factorial &lt;- function(x){\n  if(x==0)\n    return(1)\n  else\n    return(x*factorial(x-1))\n}\n\nfactorial(5)<\/pre>\n<p><strong>Code:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">factorial(11)<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><strong><a href=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-recursive-functions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-75526\" src=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/sites\/2\/2020\/01\/functions-in-r-recursive-functions.png\" alt=\"recursive R functions\" width=\"1299\" height=\"741\" \/><\/a><\/strong><\/p>\n<h2>Summary<\/h2>\n<p>Functions are the <strong>basic building blocks<\/strong> of complex programs. They help in keeping the code organized and short. They also help in increasing the accuracy of the code. Breaking down code in functions is the easiest way to organize and improve the program.<\/p>\n<p>In this R functions tutorial, we learned about functions and their use. We saw how they are created and a few of their weird quirks. We also learned about their scope and environments. Finally, we looked at recursive functions.<\/p>\n<p>We at <strong>TechVidvan<\/strong> hoped that you understand the basics of functions in R. After reading this tutorial, you should be able to write your own customized functions.<\/p>\n<p>If you find any difficulty while practicing R functions, ask your doubts from <strong>TechVidvan<\/strong> Experts in the comment section.<\/p>\n<p>Keep Learning ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Functions in a programming language are sets of instructions. They divide the code into logical chunks. They help to reduce the complexity of the program and to avoid repetition. In this article, we are&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":75529,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1020],"tags":[1385,1386,1387,1388,1389,1390],"class_list":["post-75512","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-r","tag-call-r-function","tag-functions-in-r","tag-r-function-scope","tag-r-function-usage","tag-r-functions","tag-user-defined-functions-in-r"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>User-Defined Functions in R Programming with Examples - TechVidvan<\/title>\n<meta name=\"description\" content=\"R functions reduce the complexity of the program &amp; avoid repetition. Learn how to create user-defined R functions with their need &amp; usage in R with 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:\/\/techvidvan.com\/tutorials\/r-functions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"User-Defined Functions in R Programming with Examples - TechVidvan\" \/>\n<meta property=\"og:description\" content=\"R functions reduce the complexity of the program &amp; avoid repetition. Learn how to create user-defined R functions with their need &amp; usage in R with examples\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techvidvan.com\/tutorials\/r-functions\/\" \/>\n<meta property=\"og:site_name\" content=\"TechVidvan\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/TechVidvan\/\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-15T06:24:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.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=\"TechVidvan Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:site\" content=\"@vidvantech\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"TechVidvan 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":"User-Defined Functions in R Programming with Examples - TechVidvan","description":"R functions reduce the complexity of the program & avoid repetition. Learn how to create user-defined R functions with their need & usage in R with 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:\/\/techvidvan.com\/tutorials\/r-functions\/","og_locale":"en_US","og_type":"article","og_title":"User-Defined Functions in R Programming with Examples - TechVidvan","og_description":"R functions reduce the complexity of the program & avoid repetition. Learn how to create user-defined R functions with their need & usage in R with examples","og_url":"https:\/\/techvidvan.com\/tutorials\/r-functions\/","og_site_name":"TechVidvan","article_publisher":"https:\/\/www.facebook.com\/TechVidvan\/","article_published_time":"2020-01-15T06:24:55+00:00","og_image":[{"width":802,"height":420,"url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.jpg","type":"image\/jpeg"}],"author":"TechVidvan Team","twitter_card":"summary_large_image","twitter_creator":"@vidvantech","twitter_site":"@vidvantech","twitter_misc":{"Written by":"TechVidvan Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#article","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/"},"author":{"name":"TechVidvan Team","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22"},"headline":"User-Defined Functions in R Programming with Examples","datePublished":"2020-01-15T06:24:55+00:00","mainEntityOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/"},"wordCount":990,"commentCount":0,"publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.jpg","keywords":["call R function","functions in R","R Function Scope","R Function Usage","R functions","user defined functions in R"],"articleSection":["R Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/techvidvan.com\/tutorials\/r-functions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/","url":"https:\/\/techvidvan.com\/tutorials\/r-functions\/","name":"User-Defined Functions in R Programming with Examples - TechVidvan","isPartOf":{"@id":"https:\/\/techvidvan.com\/tutorials\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#primaryimage"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#primaryimage"},"thumbnailUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.jpg","datePublished":"2020-01-15T06:24:55+00:00","description":"R functions reduce the complexity of the program & avoid repetition. Learn how to create user-defined R functions with their need & usage in R with examples","breadcrumb":{"@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techvidvan.com\/tutorials\/r-functions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#primaryimage","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.jpg","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2020\/01\/User-defined-functions-in-R.jpg","width":802,"height":420,"caption":"r functions"},{"@type":"BreadcrumbList","@id":"https:\/\/techvidvan.com\/tutorials\/r-functions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techvidvan.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"User-Defined Functions in R Programming with Examples"}]},{"@type":"WebSite","@id":"https:\/\/techvidvan.com\/tutorials\/#website","url":"https:\/\/techvidvan.com\/tutorials\/","name":"TechVidvan Blogs","description":"","publisher":{"@id":"https:\/\/techvidvan.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techvidvan.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techvidvan.com\/tutorials\/#organization","name":"TechVidvan","url":"https:\/\/techvidvan.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","contentUrl":"https:\/\/techvidvan.com\/tutorials\/wp-content\/uploads\/2024\/03\/techvidvan-logo-200x50-1.webp","width":200,"height":50,"caption":"TechVidvan"},"image":{"@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/TechVidvan\/","https:\/\/x.com\/vidvantech"]},{"@type":"Person","@id":"https:\/\/techvidvan.com\/tutorials\/#\/schema\/person\/e9c26e74dd3d87421f7ada9433b8cd22","name":"TechVidvan Team","description":"The TechVidvan Team delivers practical, beginner-friendly tutorials on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our experts are here to help you upskill and excel in today\u2019s tech industry."}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/75512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/comments?post=75512"}],"version-history":[{"count":0,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/posts\/75512\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media\/75529"}],"wp:attachment":[{"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/media?parent=75512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/categories?post=75512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techvidvan.com\/tutorials\/wp-json\/wp\/v2\/tags?post=75512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}