Comments (6)
Using boost::replace_all(line, "\"", "")
should allow a reversion to strtok. Since we can pass multiple (single) delimiters to strtok, it should work for the last token as well.
I'll have a go and see how I get on.
from bikedata.
I remember now why I initially didn't just use strtok with replace_all. It was because I wasn't sure if any of the data would contain strings with commas (in an address for instance). The Citibike data doesn't seem to have this issue but it is something to keep in mind for other systems.
from bikedata.
One alternative if we want to use strtok together with boost::replace_all would be to use boost::replace_all(line, "\",\"", "?")
where instead of the question mark we use an infrequently used character.
from bikedata.
nah, we've still got comma separators, so can't stick anything but black spaces in (with strok
). The good news is that all data thus far from global bike systems is ultimately stored in strict .csv
format, so comma's are used exclusively as field delimiters and never as punctuation. That means we can definitely rely on comma separators at all times.
i didn't document my previous attempts, but recall that everything worked fine simply removing double quotes up until the line ending, but I couldn't get strok
to properly return the final token. The rm_dos_end
function was intended to solve it, but still didn't somehow.
from bikedata.
In that case I'll go ahead and try removing any speech marks and use strtok.
from bikedata.
Closing this because strtokm
is utlimately still needed because there are cities (such as London) in which station names do have commas, yet are delimited by double quotes. All such cases use strtokm
, while all others revert to std::strtok
where possible.
from bikedata.
Related Issues (20)
- check UBSAN issues from examples HOT 1
- ditch reshape2 for tidyr HOT 1
- integer overflow
- Vanouver Mobi data
- get back on CRAN
- Issue downloading 2020 data from london HOT 2
- Guadalaraja data breaks with 2021-06 data HOT 3
- potentially inverted lat/lng in sf bay area stations HOT 5
- naive question: is fast c++ csv/zip --> sqlite3 useful enough to be its own package? HOT 2
- put citation in readme
- London dates not parsed correctly in bike_daily_trips() HOT 4
- Fix Guadalajara stations
- CRAN fails
- auto-download niceridemn
- bikedata misses numerous csv files from London HOT 11
- consider updating main readme to match vignette HOT 1
- fix tests HOT 1
- Removed from CRAN HOT 1
- Unable to store NYC data from 2018 and 2019
- Update all tests and examples to reflect new latest_lo_stns param
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 bikedata.