replace a part of variable with new value

By Raju

I am new to R

Help would be appreciated:)

I have a variable below

myvariable <- "somefunction(var1,var2)"

The above stated variable will always change but the pattern remains the same
a function name followed by two values seperated by “,” in brackets

I want to replace

var1 with newVar1
var2 with newVar2

The value to be changed with also remains the same.
In this case it is newVar1 and newVar2.

Need to write a script such that

the desired output is

myvariable <- "somefunction(newVar1 ,newVar2)"

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273