data-visualization

R: select by color and by ID

北城余情 提交于 2021-02-11 14:24:16
问题 I have the following data in R Data_I_Have <- data.frame( "Node_A" = c("John", "John", "John", "Peter", "Peter", "Peter", "Tim", "Kevin", "Adam", "Adam", "Xavier"), "Node_B" = c("Claude", "Peter", "Tim", "Tim", "Claude", "Henry", "Kevin", "Claude", "Tim", "Henry", "Claude"), " Place_Where_They_Met" = c("Chicago", "Boston", "Seattle", "Boston", "Paris", "Paris", "Chicago", "London", "Chicago", "London", "Paris"), "Years_They_Have_Known_Each_Other" = c("10", "10", "1", "5", "2", "8", "7", "10",

R: converting tidyverse to dplyr/reshape2 for plots

China☆狼群 提交于 2021-02-11 13:13:25
问题 In a previous post, a user showed me how to to plot longitudinal data in R. Here is the code: library(ggplot2) Data <- data.frame( "ID" = c("ABC111", "ABC111", "ABC111", "ABC111", "ABC112", "ABC112", "ABC112", "ABC113", "ABC113", "ABC114", "ABC115"), "color" = c("red", "red", "red", "red", "blue", "blue", "blue", "green", "green", "black", "yellow"), "start_date" = c("2005/01/01", "2006/01/01", "2007/01/01", "2008/01/01", "2009/01/01", "2010/01/01", "2011/01/01", "2012/01/01", "2013/01/01",

R: converting tidyverse to dplyr/reshape2 for plots

这一生的挚爱 提交于 2021-02-11 13:12:01
问题 In a previous post, a user showed me how to to plot longitudinal data in R. Here is the code: library(ggplot2) Data <- data.frame( "ID" = c("ABC111", "ABC111", "ABC111", "ABC111", "ABC112", "ABC112", "ABC112", "ABC113", "ABC113", "ABC114", "ABC115"), "color" = c("red", "red", "red", "red", "blue", "blue", "blue", "green", "green", "black", "yellow"), "start_date" = c("2005/01/01", "2006/01/01", "2007/01/01", "2008/01/01", "2009/01/01", "2010/01/01", "2011/01/01", "2012/01/01", "2013/01/01",

Zoomable sunburst chart shows only two layers of the hierarchy at a time in React JS

淺唱寂寞╮ 提交于 2021-02-11 12:51:30
问题 I have tried many ways to convert this:- https://observablehq.com/@d3/zoomable-sunburst into react as it's majorly using observable and runtime . That is not being converted to React. It's using some helper.js as well in this. Code is here https://observablehq.com/@d3/zoomable-sunburst Is there any idea that anyone can give or any suggestion to do it. Thanks in advance 回答1: The op has reached to Observablehq forum. Here are some insights on the answer for the problem in case you need help

Zoomable sunburst chart shows only two layers of the hierarchy at a time in React JS

一世执手 提交于 2021-02-11 12:51:11
问题 I have tried many ways to convert this:- https://observablehq.com/@d3/zoomable-sunburst into react as it's majorly using observable and runtime . That is not being converted to React. It's using some helper.js as well in this. Code is here https://observablehq.com/@d3/zoomable-sunburst Is there any idea that anyone can give or any suggestion to do it. Thanks in advance 回答1: The op has reached to Observablehq forum. Here are some insights on the answer for the problem in case you need help

R: Kernel Density Plots (Bandwidth Must be Strictly Positive)

烂漫一生 提交于 2021-02-11 12:38:03
问题 I am using the R programming language. I am following this tutorial over here for making 3d kernel density plots in R: https://plotly.com/r/3d-surface-plots/: library(MASS) library(plotly) kd <- with(MASS::geyser, MASS::kde2d(duration, waiting, n = 50)) fig <- plot_ly(x = kd$x, y = kd$y, z = kd$z) %>% add_surface() fig I decided to try this on my own data : #generate data a = rnorm(100,10,10) b = rnorm(100,5,5) c = rnorm(100,5,10) d = data.frame(a,b,c) #make 3d plot (I think n = 50 refers to

R: Error in FUN(X[[i]], …) : only defined on a data frame with all numeric variables

邮差的信 提交于 2021-02-11 08:22:08
问题 I am working with the R programming language. I am trying to plot some categorical and continuous data that I am working with, but I am getting an error that tells me that such plots are only possible with "only numeric variables". library(survival) library(ggplot2) data(lung) data = lung data$sex = as.factor(data$sex) data$status = as.factor(data$status) data$ph.ecog = as.factor(data$ph.ecog) str(data) #plot mycolours <- rainbow(length(unique(data$sex)), end = 0.6) # png("gally.png", 500,

R: Error in FUN(X[[i]], …) : only defined on a data frame with all numeric variables

微笑、不失礼 提交于 2021-02-11 08:19:42
问题 I am working with the R programming language. I am trying to plot some categorical and continuous data that I am working with, but I am getting an error that tells me that such plots are only possible with "only numeric variables". library(survival) library(ggplot2) data(lung) data = lung data$sex = as.factor(data$sex) data$status = as.factor(data$status) data$ph.ecog = as.factor(data$ph.ecog) str(data) #plot mycolours <- rainbow(length(unique(data$sex)), end = 0.6) # png("gally.png", 500,

How to make a graph of clustered boolean variables in R?

拈花ヽ惹草 提交于 2021-02-11 04:27:35
问题 I have a dataset which consists entirely of boolean variables. Exactly like the transformed animal dataset below, only with many more columns. # http://stats.stackexchange.com/questions/27323/cluster-analysis-of-boolean-vectors-in-r library(cluster) head(mona(animals)[[1]]) war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 The goal is to rearrange the rows in such a way that groupings of similar membership patterns are

How to make a graph of clustered boolean variables in R?

喜夏-厌秋 提交于 2021-02-11 04:26:19
问题 I have a dataset which consists entirely of boolean variables. Exactly like the transformed animal dataset below, only with many more columns. # http://stats.stackexchange.com/questions/27323/cluster-analysis-of-boolean-vectors-in-r library(cluster) head(mona(animals)[[1]]) war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 The goal is to rearrange the rows in such a way that groupings of similar membership patterns are