R String toString

In this tutorial you will learn about the R String toString and its application with practical example.

R String toString

The toString() function is used to convert an R Object to a Character String. It is a helper function used with format, to produce a single character string describing an R object.

Table Of Contents

Syntax:-

Above is the general syntax of toString() function, it first converts x to character type and then concatenates the elements with “, “. If width is passed and it is not a NULL value, then it returns the first width – 4 characters of the result appended with (….), in case of full result using more than width specified.

x:- It is a R object to be converted.
width:- It represents the maximum field width. The minimum value for width can be 6 and anything smaller than 6 is taken as 6, 0 or NULL indicate no maximum.
… :- It is the optional arguments passed to or from methods.

Example:-

Output:-

r_tostring

 

In this tutorial we have learn about the R String toString and its application with practical example. I hope you will like this tutorial.