Comments (5)
Try setting method = "data.frame"
. If you have a well-formed table, that should return a very nice data.frame with column names specified and row names as a column.
from tabulizer.
The table i am sourcing from looks well formed but it comes out as a list even when stipulating as a data.frame and when I coerce to data.frame the first row becomes the column headings
library(tidyverse)
library(tabulizer)
extract_tables("https://crashstats.nhtsa.dot.gov/Api/Public/ViewPublication/812293", pages = 3, method="data.frame") %>%
as.data.frame()
I'm on v 0.1.22
from tabulizer.
@pssguy It's a list of data.frames:
> str(.)
List of 1
$ :'data.frame': 52 obs. of 10 variables:
..$ Alabama: chr [1:52] "Alaska " "Arizona " "Arkansas " "California " ...
..$ X820 : chr [1:52] "73 " "770 " "466 " "3,074 " ...
..$ X4.849 : chr [1:52] "737 " "6,731 " "2,966 " "38,803 " ...
..$ X3.882 : chr [1:52] "532 " "4,882 " "2,112 " "24,813 " ...
..$ X5.367 : chr [1:52] "800 " "5,588 " "2,779 " "28,687 " ...
..$ X65.667: chr [1:52] "4,857 " "62,631 " "34,024 " "332,857 " ...
..$ X16.91 : num [1:52] 9.91 11.44 15.71 7.92 9.11 ...
..$ X21.13 : chr [1:52] "13.73 " "15.77 " "22.07 " "12.39 " ...
..$ X15.28 : num [1:52] 9.12 13.78 16.77 10.72 10.12 ...
..$ X1.25 : num [1:52] 1.5 1.23 1.37 0.92 1 0.8 1.26 0.65 1.24 1.04 ...
Just extract the first element using [[
to get the data frame you want
from tabulizer.
@leeper thansk for reply but I still haven't got it
crash <- extract_tables("https://crashstats.nhtsa.dot.gov/Api/Public/ViewPublication/812293", pages = 3, method="data.frame")
crash[[1]]
Alabama X820 X4.849 X3.882 X5.367 X65.667 X16.91 X21.13 X15.28 X1.25
1 Alaska 73 737 532 800 4,857 9.91 13.73 9.12 1.50
from tabulizer.
It has to be output = "data.frame"
- not method.
from tabulizer.
Related Issues (20)
- Specifying columns as percentages
- Having problems with automate table recognition, can one save areas found manually for reproduction?
- {tabulizer} got archived on CRAN on 2021-10-31 HOT 20
- extract_tables function status was 'SSL connect error' error
- Select multiple areas per page in `*_areas()`
- q question about package( Tabulizer) installation HOT 4
- a suggested code or documentation change, improvement to the code, or feature request HOT 1
- inconsistent behavior of extract_tables and extract_areas HOT 4
- Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.lang.IllegalAccessException: class RJavaTools cannot access a member of class java.util.ArrayList$Itr (in module java.base) with modifiers "public" HOT 11
- New Maintainer Wanted :-) HOT 6
- An illegal reflective access operation has occurred HOT 1
- Renaming to tabula HOT 2
- Windows CI fails because of Java 8 requirement HOT 1
- build fails with tabula 1.2.1 jar HOT 1
- ROADMAP FOR FALL 2023 HOT 6
- Unable to install in tabulizer HOT 1
- pkgdown building issue HOT 10
- Is jdk7 -y needed? HOT 6
- Is the package abandoned? HOT 1
- Issue with extract_tables function. Couldn't run the example: getRowCount HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tabulizer.