Comments (6)
We need a way to specify this. I think read_csv
could get some non standard evaluation to specify the classes. For this I was thinking something like this:
classes( "character", "integer", date( "%Y-%m-%d" ) )
classes( ymd() )
read_csv(file, classes( ... ) )
@hadley do you have syntax ideas.
from readr.
I don't think we need non-standard evaluation, just a succinct DSL for expressing column types. I'll have a think about it.
from readr.
[Moving discussion about specification into #14]
from readr.
We can probably again use boost spirit. See here: http://www.boost.org/doc/libs/1_47_0/libs/spirit/example/qi/parse_date.cpp
Some relevant extract:
template <typename Iterator>
bool parse_date(Iterator& first, Iterator last, boost::gregorian::date& d)
{
typedef boost::fusion::vector<int, int, int> date_parts;
qi::rule<Iterator, date_parts(), qi::space_type> date =
qi::int_ >> '-' >> qi::int_ >> '-' >> qi::int_;
return phrase_parse(first, last, date, qi::space, d);
}
from readr.
Got Date
, borrowing some logic from fasttime
.
from readr.
We can now read dates with "Date"
, and dates + times with "POSIXct"
. This is largely inspired from fasttime.
from readr.
Related Issues (20)
- Request for argument synchronization with dplyr HOT 4
- Support for factor labels with integer coded factors. HOT 1
- Does lazy reading actually work? HOT 2
- Lines read and skip lines use different evaluation in read_lines HOT 8
- read_lines() warning message and the problems() function HOT 4
- Strange rounding errors with signif and write_csv HOT 6
- Improve `read_delim()` docs
- `read_delim()` and friends should error if delimiter and locale are incompatible
- read_lines truncates at \001
- Parse number cannot recognize number HOT 1
- read_delim fails on non utf 8 charset when delim is NULL with R 4.3.1 HOT 1
- `col_types` is processed differently by `read_*()` and `type_convert()` HOT 1
- Add decor to suggests? HOT 1
- read_csv unnecessarily renames column when dots in column names HOT 2
- `read_csv` crashed R session while `read.csv` or `fread` did not
- Use cols or list in read_csv HOT 1
- write_csv adds 15 decimal digits to numbers obtained by subtracting from 1 HOT 4
- FR: Spin off `readr::type_convert()` and other type inferencing tools HOT 2
- Undocumented `name_repair = "unique_quiet"` HOT 1
- Document parse_factor produces different levels than base factor
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 readr.