File Handling
Title
Question
In R,
1) Can we copy specific content of .csv file to particular place in word file(may be table in word file).
2) Shall generate separate word file for each row of .csv file.
3) each word file shall be then converted to pdf file.
Can we write script for the same.
Thanks.
R General
Answers:
Yes, we can do it. First, read the file in R say my_data=read.csv(file.choose(),header=T) let's assume my_data consists of 4 rows and 10 columns.
my_data1=data[1,]
my_data2=data[2,]
my_data3=data[3,]
my_data4=data[4,]
Now we shall use the command write.csv(my_data1, "desiredpath/filename.csv"), similarly for remaining files. This will give us .csv file then you can open these files and save as .PDF file. This is the simple example illustrated here if we have a large number of rows we can use loops.
For any kind of data manipulation, you may watch the following tutorials -
1) https://spoken-tutorial.org/watch/R/Data+Manipulation+using+dplyr+Package/English/
2) https://spoken-tutorial.org/watch/R/More+Functions+in+dplyr+Package/English/
In order to export the data directly into a Word file, you may explore the "R2wd" package of R.
In order to export the data directly into a pdf file, you may explore the "rmarkdown" package in R.
Login to add comment