Convert an Object to a String in R Programming - toString() Function Last Updated : 17 Jun, 2020 Comments Improve Suggest changes Like Article Like Report toString() function in R Language is used to convert an object into a single character string. Syntax: toString(x, width) Parameters: x: Object width: maximum string width Example 1: Python3 1== # R program to convert an object to string # Creating a vector x <- c("Geeks", "for", "geeks") # Calling toString() Function toString(x) toString(x, width = 12) Output: [1] "Geeks, for, geeks" [1] "Geeks, f...." Example 2: Python3 1== # R program to convert an object to string # Creating a matrix x <- matrix(c(1:9), 3, 3) # Calling toString() Function toString(x) Output: [1] "1, 2, 3, 4, 5, 6, 7, 8, 9" Comment More infoAdvertise with us Next Article Convert an Object to a String in R Programming - toString() Function N nidhi_biet Follow Improve Article Tags : R Language R String-Functions Similar Reads Convert an Object to a Table in R Programming - as.table() Function as.table() function in R Language is used to convert an object into a table. Syntax: as.table(x) Parameters: x: Object to be converted Example 1: Python3 1== # R Program to convert # an object to a table # Creating a vector vec = c(2, 4, 3, 1, 2, 3, 2, 1, 4, 2) # Calling as.table() Function as.table 1 min read Convert an Object into a Vector in R Programming - as.vector() Function as.vector() function in R Language is used to convert an object into a vector. Syntax: as.vector(x) Parameters: x: Object to be converted Example 1: Python3 1== # R program to convert an object to vector # Creating an array x <- array(c(2, 3, 4, 7, 2, 5), c(3, 2)) x # Calling as.vector() Function 1 min read Convert String to Integer in R Programming - strtoi() Function strtoi() function in R Language is used to convert the specified string to integers. Syntax: strtoi(x, base=0L) Parameters: x: character vector base: integer between 2 and 36 inclusive, default is 0 Example 1: Python3 # R program to illustrate # strtoi function # Initializing some string vector x 1 min read Convert a String to an Expression in R Programming - parse() Function parse() function in R Language is used to convert an object of character class to an object of expression class. Syntax: parse(text = character) Parameters: character: Object of character class Example 1: Python3 1== # R program to convert # character to expression # Creating an object of character 1 min read Convert an Object to List in R Programming - as.list() Function as.list() function in R Programming Language is used to convert an object to a list. These objects can be Vectors, Matrices, Factors, and dataframes. Syntax: as.list(object) Parameters: object: Vector, Matrix, factor, or data frame R - as.list() Function ExampleExample 1: Converting Vector to list 2 min read Print a Formatted string in R Programming - sprintf() Function The sprintf() function is used to create formatted strings in R. These formatted strings enable us to insert variables and values into a string while controlling their appearance and formatting. The sprintf() function uses a user-defined format to return a formatted string by inserting the correspon 2 min read Convert an Expression to a String in R Programming - deparse() Function deparse() function in R Language is used to convert an object of expression class to an object of character class. Syntax: deparse(expr) Parameters: expr: Object of expression class Example 1: Python3 1== # R program to convert # expression to character # Creating an object of expression class x 1 min read Convert string from lowercase to uppercase in R programming - toupper() function toupper() method in R programming is used to convert the lowercase string to uppercase string. Syntax: toupper(s) Return: Returns the uppercase string. Example 1: Python3 # R program to convert string # from lowercase to uppercase # Given String gfg <- "Geeks For Geeks" # Using toupper( 1 min read Convert String to Single Quote Text in R Programming - sQuote() Function sQuote() function in R Language is used to convert the given string or character vector into single quote text. Syntax: sQuote(x) Parameters: x: specified string, character vector Example 1: Python3 # R program to illustrate # sQuote function # Initializing a string x <- "GeeksforGeeks" 1 min read Convert type of data object in R Programming - type.convert() Function type.convert() function in R Language is used to compute the data type of a particular data object. It can convert data object to logical, integer, numeric, or factor. Syntax: type.convert(x) Parameter: x: It can be a vector matrix or an array Example 1: Apply type.convert to vector of numbers Pytho 2 min read Like