Importing and Exporting Data in R Studio
In this post i am going to talk about importing common data format like Excel/CSV files or Text files in R studio and also how you can export the data out of R studio to Excel,CSV and Text file formats. CSV Files The utils package, which is automatically loaded in R studio on startup, can import CSV files using read.csv function. To import CSV data files we can do it in the following ways: 1) file <- read.csv(file.choose()) This will initiate a pop-up window to open and you can manually choose the desired CSV file. It will create a dataframe named "file". The other important arguments to consider in the above statement are header=True when the CSV file contains header (column names). The default for this argument is always true. Also, an important argument to specify is separator (sep= ) . You have to specify the character that is separating the fields. "," means data is separated by comma. 2) file <- read.csv("file-name.csv",header=,sep=) This state...