Comments (4)
@hadley Thanks for checking how changes to tidyr will affect others! Really appreciated.
The tab
below used to gather fine but doesn't with the new tidyr. For 4/5 cases I switched to as.data.frame as that seems simpler and gives me what I need (and is not likely to change any time soon :)).
More interesting, perhaps, is the segfault I ran into (see second block below).
tab <- structure(c(39.1067931038135, 63.5264195668282, 32.4450680955929,
52.704884372479), class = "table", .Dim = c(2L, 2L), .Dimnames = structure(list(
c("Low Income", "High Income"), c("WS Journal", "USA Today"
)), .Names = c("", "")))
tab %>% data.frame(., check.names = FALSE)
I had been using gather_
and as I was trying to figure out what was going on and trying to drop a variable I got segfault in R-gui on mac (3.2.2) running the code below:
tab <- structure(c(162.787931034483, 100.212068965517, 196.212068965517,
120.787931034483), .Dim = c(2L, 2L), .Dimnames = structure(list(
c("Low Income", "High Income"), c("WS Journal", "USA Today"
)), .Names = c("", "")))
tab %>%
data.frame(., check.names = FALSE) %>%
mutate(rnames = rownames(.)) %>%
gather_(., "variable", "values", -which(colnames(.) == "rnames"))
from radiant.
This works:
tab %>%
gather(variable, values, -rnames)
so I think something is wrong with your column spec, and tidyr isn't doing a good job of warning. Let me look more
from radiant.
Ok, now I get: Error: Unknown column names: -3
.
You need:
tab %>%
data.frame(., check.names = FALSE) %>%
mutate(rnames = rownames(.)) %>%
gather_(., "variable", "values", setdiff(colnames(.), "rnames")))
from radiant.
Hadn't thought about setdiff
. Nice. Could a setdiff
example perhaps be added to the documentation for gather_
? Similarly, something like the below would be a nice add-on for the dplyr::select_
documentation. Thanks @hadley
select_(iris, .dots = setdiff(colnames(iris), c("Petal.Length", "Petal.Width")))
from radiant.
Related Issues (20)
- Error: package ‘radiant’ is available as a source package but not as a binary HOT 3
- Geom_line color HOT 4
- lost the sync of my fork HOT 3
- Decision Tree: Issue with cost HOT 7
- Package ‘radiant’ was removed from the CRAN repository. HOT 8
- avoid MathJaxR dependency HOT 9
- Chi- Squared distribution Mean HOT 3
- Add URL param that would cause the session to NOT be saved HOT 1
- trouble loading radiant HOT 3
- logo HOT 4
- Dropdown variable list doesnt showup in the Visualize option HOT 1
- make my bar graphs have manually selected colors HOT 3
- r 3.4 HOT 23
- Download button doesn't work properly HOT 2
- Readme has git merge conflict markers HOT 2
- Command options not generating when added to report HOT 4
- Regression - Center Option HOT 4
- Training Variable: same seed, different outputs HOT 3
- simulater for poisson restrict lambda to integer; result is constant 0 for lambda in (0,1) HOT 1
- How to set directory for load the data? 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 radiant.