r

Plot a table of separate data below a ggplot2 graph that lines up on the X axis

孤人 提交于 2021-02-18 18:11:00
问题 I'm looking to create a plot that contains a simple multi-line ggplot2 graph with a table of separate (but relevant) data below the graph that lines up by the X axis of the graph. The data table's column names do match the x axis of the graph (hours 1 to 24), but one column is dedicated to necessary row names. Here are the graph and the data table separately: Data table is cut off at hour 16 for brevity, but does extend to 24. I've been attempting different solutions in gridExtra all morning

Setting specific tile size for geom_tile between two graphs

孤者浪人 提交于 2021-02-18 18:10:54
问题 Might be missing something simple here, but my goal is to plot two heatmaps from two separate matrices. The matrices are of different dimensions, but I want each of the individual plotted tiles to be the same physical measurements between the two graphs. The graph size should then be dependent on the matrix dimensions, since the tile size will be constant between the graphs. Here is an example of two different size matrices and a stripped down version of the graphs I want to make. mat_lg <-

Setting specific tile size for geom_tile between two graphs

耗尽温柔 提交于 2021-02-18 18:10:09
问题 Might be missing something simple here, but my goal is to plot two heatmaps from two separate matrices. The matrices are of different dimensions, but I want each of the individual plotted tiles to be the same physical measurements between the two graphs. The graph size should then be dependent on the matrix dimensions, since the tile size will be constant between the graphs. Here is an example of two different size matrices and a stripped down version of the graphs I want to make. mat_lg <-

Setting specific tile size for geom_tile between two graphs

你离开我真会死。 提交于 2021-02-18 18:09:42
问题 Might be missing something simple here, but my goal is to plot two heatmaps from two separate matrices. The matrices are of different dimensions, but I want each of the individual plotted tiles to be the same physical measurements between the two graphs. The graph size should then be dependent on the matrix dimensions, since the tile size will be constant between the graphs. Here is an example of two different size matrices and a stripped down version of the graphs I want to make. mat_lg <-

Alignment of multiple (non-biological, discrete state) sequences

大兔子大兔子 提交于 2021-02-18 17:53:51
问题 I have some data that describes an ordered set of discrete events (or states). There are 34 possible states, which may occur in any order and may repeat. Each sequence of events can contain any number of events, and crucially there are more than 2 sequences of events. My eventual aim is to cluster these sequences into similar subsets, but my hunch is that this cannot be meaningful unless these sequences are aligned such that equivalent events occupy the same position in all sequences. I'm

How to scrape JavaScript rendered Website by R?

谁都会走 提交于 2021-02-18 17:48:07
问题 Just wanna ask if there is any good approach to scrape the website below? https://list.jd.com/list.html?cat=737,794,798&page=1&sort=sort_rank_asc&trans=1&JL=6_0_0#J_main Basically I want to get the name and price of all products However, the price info is stored in some JQuery scripts Is Selenium the only solution? Thought of using V8 / Jsonlite, but it seems that they are not applicable. It'd be great if you can offer some alternatives in R. (Access to exe files is blocked in my computer, I

Add average lines for categorical scatterplots with single group values

安稳与你 提交于 2021-02-18 17:47:06
问题 I have a categorical scatter plot like this: which I generated in R with the following code (using the ggplot2 library): data <- runif(50, 13, 17) factors <- as.factor(sample(1:3, 50, replace = TRUE)) groups <- as.factor(sample(1:3, 50, replace = TRUE)) data_table <- data.frame(data, factors) g <- ggplot(data_table, aes(y = data_table[, 1], x = data_table[, 2], colour = groups)) + geom_point(size = 1.5) I am trying to add an average line for each x-group, but I can't manage to find the right

How to read.table with “Hebrew” column names (in R)?

会有一股神秘感。 提交于 2021-02-18 17:16:54
问题 I am trying to read a .txt file, with Hebrew column names, but without success. I uploaded an example file to: http://www.talgalili.com/files/aa.txt And am trying the command: read.table("http://www.talgalili.com/files/aa.txt", header = T, sep = "\t") This returns me with: X.....ª X...ª...... X...œ.... 1 12 97 6 2 123 354 44 3 6 1 3 Instead of: אחת שתיים שלוש 12 97 6 123 354 44 6 1 3 My output for: l10n_info() Is: $MBCS [1] FALSE $`UTF-8` [1] FALSE $`Latin-1` [1] TRUE $codepage [1] 1252 And

How to join location data (lat,lon)

微笑、不失礼 提交于 2021-02-18 17:12:36
问题 I have to dataset, one with some location (lat,lon), that's test, and one with the lat/lon information of all zip codes in NYC, that's test2. test <- structure(list(trip_count = 1:10, dropoff_longitude = c(-73.959862, -73.882202, -73.934113, -73.992203, -74.00563, -73.975189, -73.97448, -73.974838, -73.981377, -73.955093), dropoff_latitude = c(40.773617, 40.744175, 40.715923, 40.749203, 40.726158, 40.729824, 40.763599, 40.754135, 40.759987, 40.765224)), row.names = c(NA, -10L), class = c("tbl

GPU computing for bootstrapping using “boot” package

寵の児 提交于 2021-02-18 17:11:32
问题 I would like to do a large analysis using bootstrapping. I saw that the speed of bootstrapping is increased using parallel computing as in the following code: Parallel computing # detect number of cpu library(parallel) detectCores() library(boot) # boot function --> mean bt.mean <- function(dat, d){ x <- dat[d] m <- mean(x) return(m) } # obtain confidence intervals # use parallel computing with 4 cpus x <- mtcars$mpg bt <- boot(x, bt.mean, R = 1000, parallel = "snow", ncpus = 4) quantile(bt$t