Printing out to the Screen or to a File in R Programming - cat() Function Last Updated : 17 Jun, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report cat() function in R Language is used to print out to the screen or to a file. Syntax: cat(..., file = "", sep = " ", fill = FALSE, labels = NULL, append = FALSE)Parameters: ...: atomic vectors, names, NULL and objects with no output file: the file in which printing will be done sep: specified separator fill: If fill=TRUE, a new line will be printed, otherwise not labels: specified labels Example 1: Python3 # R program to illustrate # cat function # Creating some string and print it x <- "GeeksforGeeks\n" y <- "Geeks\n" # Calling cat() function cat(x) cat(y) # Creating a sequence from 1 to 9 x <- 1:9 # Calling cat() function cat(x, sep =" + ") cat("\n") cat(x, sep =" / ") Output: GeeksforGeeks Geeks 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 Example 2: Python3 # R program to illustrate # cat function # Creating a sequence from 1 to 9 x <- 1:9 # Calling cat() function # fill value TRUE will print # a new line cat(x, sep =" + ", fill = TRUE) cat(x, sep =" / ", fill = FALSE) # Printing new line cat("\n") # Each number from 1 to 9 will be # assigned with alphabets a to i cat(x, fill = 2, labels = paste("(", letters[1:9], "):")) Output: 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 1 / 2 / 3 / 4 / 5 / 6 / 7 / 8 / 9 ( a ): 1 ( b ): 2 ( c ): 3 ( d ): 4 ( e ): 5 ( f ): 6 ( g ): 7 ( h ): 8 ( i ): 9 Comment More infoAdvertise with us Next Article Display the internal Structure of an Object in R Programming - str() Function K Kanchan_Ray Follow Improve Article Tags : R Language R-strings R String-Functions Similar Reads Print the Argument to the Screen in R Programming - print() Function print() function in R Language is used to print out the argument to the screen. Syntax: print(x, digits, na.print) Parameters: x: specified argument to be displayed digits: defines minimal number of significant digits na.print: indicates NA values output format Example 1: Python3 # R program to illu 2 min read How To Import Data from a File in R Programming The collection of facts is known as data. Data can be in different forms. To analyze data using R programming Language, data should be first imported in R which can be in different formats like txt, CSV, or any other delimiter-separated files. After importing data then manipulate, analyze, and repor 4 min read Display the internal Structure of an Object in R Programming - str() Function str() function in R Language is used for compactly displaying the internal structure of a R object. It can display even the internal structure of large lists which are nested. It provides one liner output for the basic R objects letting the user know about the object and its constituents. It can be 3 min read Scan and Read Data from a File in R Programming - scan() Function scan() function in R Language is used to scan and read data. It is usually used to read data into vector or list or from file in R Language. Syntax: scan("data.txt", what = "character") Parameter: data.txt: Text file to be scanned Returns: Scanned output Example 1: Scanning of Text r # R Program to 3 min read Reading Tabular Data from files in R Programming Often, the data which is to be read and worked upon is already stored in a file but is present outside the R environment. Hence, importing data into R is a mandatory task in such circumstances. The formats which are supported by R are CSV, JSON, Excel, Text, XML, etc. The majority of times, the data 4 min read Exporting Data from scripts in R Programming In R, when a program terminates, all data is lost unless it is exported to a file. Exporting data ensures its preservation, even after the program ends, and allows for easy sharing, storage, and transfer between systems.Exporting data is essential to prevent loss of information. It allows for:Data P 6 min read Like