I split a very large dataframe into a number of smaller ones but I am unable...
So I am working with some Census API data. Sadly there are a number of NAs in some of the columns. I am replacing the NAs with the column means, but I figured I would get more accurate information if I...
View ArticleShrinkage effects in a hierarchical model
I am working on the chimpanzees dataset from Richard Mclearth's text, "Statistical Rethinking", edition 2.I have built 2 simple models, one a fixed effects model and the other a hierarchical...
View ArticleMultiple boxplots placed side by side for different column values in ggplot
I have read different posts like this and this but my problem has a small variation. I have a df like this ID <- c("DJ45","DJ46","DJ47","DJ48","DJ49","DJ53","DJ54","DJ55","DJ56","DJ57") Tool <-...
View ArticleMultiple random samples without replacement in R
I have a vector of size M = 2630, How can I draw 4 samples of size M/4. The following code is not working M <- c(1:2630) mysample <- split(sample(M), 1:(length(M)/4)) Since (length(M)/4) is not...
View ArticleCustomizing dragulaR [Shiny] to pre-populate using dropdown
I'm creating an app using dragulaR where I'd like the user to be able to select from a drop down and a draggable element will move from the drag area alphaBlocks into the drop area alphaOutput:Desired...
View ArticleConnect bars with lines in R plotly
I am trying to connect the stacked bars with lines. Expectation : However I am unable to draw the lines between the bars. Have tried with the following script however it is not adding the line.Using...
View ArticleHow to make a boxplot with 3D array with ggplot?
I have technical question for you please. Here are my observed data. : observed <- structure(c(4.06530084555243e-05, 4.34037362577724e-05, 5.25472735118296e-05, 5.75250282219017e-05,...
View ArticlePut xtable and ggplot2 output side-by-side in Beamer
MWE:\documentclass[pdf, t, 10pt]{beamer} \usetheme{Antibes} \mode<presentation>{} \usepackage{array} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash\hspace{0pt}}p{#1}} \begin{document}...
View ArticleIs there a way to check if a column is a Date in R?
This is a pseudo followup to this question: Why is ggplot graphing null percentage data points?Let's say this is my dataset:Date AE AA AEF Percent 1/1/2012 1211 1000 3556 0.03 1/2/2012 100 2000 3221...
View ArticleLoop in R matching values across dataframes?
I have two dataframes, one (df1) that looks like this:CityYear City Year Value NY2000 NY 2000 1.2 NY2005 NY 2005 1.0 NY2010 NY 2010 1.4 NY2015 NY 2015 NA LA2000 LA 2000 0.9 LA2005 LA 2005 1.5 LA2010 LA...
View ArticleUsing forecast.gts (package hts) with external regressor and parallel processing
I'm currently using the hts package to forecast (forecast.gts). I'm now interested in running it in parallel, using the num.cores argument. but when i'm adding an external regressor (using the xreg and...
View ArticleStates Clusters Colors in R
I am analysing a sample of 28 states. I am clustering the states based on variables in 6 clusters. I want to track how states migrate/keep there places in a same cluster over a period of ten years. I...
View Articlegeom_vline doesn't work after the scale_x_discrete in R
I am a newie here, sorry for not writing the question right :p1, the aim is to plot a graph about the mean NDVI value during a time period (8 dates were chosen from 2019-05 to 2019-10) of my study site...
View ArticleReturning Neighbor Attributes Using Queen Contiguity [closed]
I am trying to build a function to return the value(s) of a neighboring state(s) FIPS for any given state FIPS. So far I've been able to create a spatial weights matrix using the spdep::poly2nb()...
View Articler- bind rows of a list of dataframes, while keeping empty dataframes as NA rows
I'm looking for a way to rbind a list of dataframes (around 7000 dataframes of one row or empty) into a single dataframe but without removing the empty dataframes of the list.## Example of data l <-...
View ArticleControl row stripe color in datatable output
What is the "best" way is to set a custom row stripe/row striping color in datatable (DT)?I'm using datatable (DT) to create interactive tables (e.g HTML via rmarkdown), with download ability, etc....
View ArticleHow to fix '404 (Not Found)' errors when sourcing CSS and Javascript files in...
I am trying to launch a shiny app using ShinyProxy - something I have done many times before. However, this app is not correctly using any of the CSS or JS files that is required to make it run.When I...
View ArticleHow can I keep pivot_wider() from dropping factor levels in names?
I would really like pivot_wider to create a column with NAs if the level of a factor exists but never appears in the data when it's used as a names_from argument. For example, the first line gives me a...
View ArticleHandling missing values in growthcurver
The R package growthcurver is great for efficient analysis and visualization of organism growth except when there are missing values. Because I have data in wide format (each column is a variable) and...
View ArticleHow can I compute other network indicators in R?
I have a Network consisting out of patent data and I want to compute several Network indicators. Unfortunately, the Code below works just with the functions ecount and vcount but with nothing else. I...
View Article