Modulel IV
Modulel IV
Data Analysis
data1 ->
data2 ->
• Output:
library(readxl)
Data_gfg <- read_excel("Data_gfg.xlsx")
Data_gfg
Data_gfg <-read.xlsx('Data_gfg.xlsx’)
Data_gfg
3. In the third step, a pop-up box will appear, either enter the file name or browse
the desktop.
4. The selected file will be displayed on a new window with its dimensions.
5. In order to see the output on the console, type the filename.
Prepared by : Dr. Srinivasa Rao Pokuri, Faculty SCOPE, VIT AP
Exporting Data from R Scripts
• When a program is terminated, the entire data is lost.
• Storing in a file will preserve one’s data even if the program terminates.
• If one has to enter a large number of data, it will take a lot of time to
enter them all. However, if one has a file containing all the data, he/she
can easily access the contents of the file using a few commands in R.
• Exporting data to a text file:
• One of the important formats to store a file is in a text file. R provides
various methods that one can export data to a text file.
• write.table():
• The R base function write.table() can be used to export a data frame or a matrix to
a text file.
• In This section of R studio we get the data saved as the name that we gave in the
code. and when we select that files we get this type of output.
Prepared by : Dr. Srinivasa Rao Pokuri, Faculty SCOPE, VIT AP
Exporting Data from R Scripts
• write.table():
Parameters:
• x: a matrix or a data frame to be written.
• file: a character specifying the name of the result file.
• sep: the field separator string, e.g., sep = “\t” (for tab-separated value).
• dec: the string to be used as decimal separator. Default is “.”
• row.names: either a logical value indicating whether the row names of x are to be
written along with x, or a character vector of row names to be written.
• col.names: either a logical value indicating whether the column names of x are to
be written along with x, or a character vector of column names to be written.
%>%: the “pipe” operator is used to connect multiple verb actions together into a pipeline