[R] Data is not properly written in csv file
Marc Schwartz
m@rc_@chw@rtz @end|ng |rom me@com
Tue Jun 22 00:33:39 CEST 2021
Hi,
If each of the extracted tables do not have consistent content and
structure, that may be causing problems as you append each to the same file.
You might want to modify your loop so that each table gets written to a
different CSV file and see what that looks like.
Also, review ?write.table and take note of the default arguments that
are used for write.csv(), as noted in the CSV Files section, and in the
Examples.
Regards,
Marc Schwartz
Sri Priya wrote on 6/20/21 11:03 AM:
> Dear R Users,
>
> I am working on extracting tables from PDF and I am writing that in a csv
> file. When I executed the code, the tables were not properly written in the
> csv file.
>
> Here is my code:
>
> library(tabulizer)
> # Location of pdf file.
> location <- '
> http://keic.mica-apps.net/wwwisis/ET_Annual_Reports/Religare_Enterprises_Ltd/RELIGARE-2017-2018.pdf
> '
>
> # Extract the table
> out <- extract_tables(location)
> for(i in 1:length(out))
> {
> write.table(out[i], file='Output.csv',append=TRUE, sep=",",quote =
> FALSE)
> }
> I enclosed the screenshot of the output file. In that you can see
> the tables are incomplete.
>
> Any help would be appreciated.
>
> Thanks
> Sripriya.
>
More information about the R-help
mailing list