Saturday, November 26, 2016

String In R Programming

             All literal string  in R programming was write in single or double quotes. You can not use mixed string quote and double quotes. for example( "Mr. Nay'), you must write like this ('Mr. Nay' or "Mr. Nay").

Please See in Console
1.


Result is correct

2.


Result is correct
3.

Result is not correct.

String Manipulation

          1.Check Information of  any variable

                1.1/function is.character(str)
                         use for check value of variable whether string or others. Why we need to check value               of  variable .Every programmer that learned R-programming, know that we use variable in R    
            by assign value not define type like other programming (c ,C++, C#, Java...). To understand                   well please see examples below:


                 


              1.2/function as.character(str)
                          use for convert value of variable that is not string to string. Above example variable   "st2" store value that have type as Number not character so if you want to convert it strin                     you use function as.character(str). please sea example below:


          1.3/function nchar(str)
                 used for count number of string variable. please see example below

         

No comments:

Post a Comment