Comments (1)
Hi @xiaodaigh, thanks for your question. In an R
factor, the value NA
is encoded as a NA
value in the value vector:
# some factor
x <- factor(sample(LETTERS, 10), levels = LETTERS)
# set factor value to NA
x[5] <- NA
# underlying value is set to NA
as.integer(x)
#> [1] 23 22 16 18 NA 5 8 4 2 26
This could have been done better in R
I guess, for example by coding the value 0 as the NA
, but with the current implementation that leads to an error:
# create factor manually
y <- c(1L, 2L, 3L, 0L, 4L, 5L)
attr(y, "levels") <- LETTERS
attr(y, "class") <- "factor"
print(y)
#> Error in as.character.factor(x): malformed factor
For performance reasons, fst
takes bit 32 from the factor values and adds bit 0-7 to that to get a single byte. So these 7 bits can only be used for < 128 levels. I could also re-code value 0 as an NA
, but that would require more processing and would reduce the speed of the filter...
Hope that answers your question!
from fstlib.
Related Issues (10)
- Large datasets HOT 3
- Linux support HOT 12
- Looking forward to full description of fst format HOT 11
- Documentation on setting up a `C++` project using the `fstlib` library
- Scan multi-threaded code for false sharing
- Project readme file
- Fix coveralls
- Format specifications and C++ API docs HOT 1
- Zero-row tables are correctly serialized
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 fstlib.