Long waiting time to execute optimization problems
I'm using a Genetic algorithm, bayesian optimization for parameters tuning in R. But, even after running for hours I'm not getting any response. My questions are:Why is it happening? I mean does...
View ArticleIs there a function in R for discrete probability distribution?
I have a set of Bernoulli variables, giving specific values with different probabilities. The variables are independent. I'm trying to build a simple discrete probability table for all the possible...
View ArticleThe tooltip issue in ggplotly for error bars and bar chart
I using ggplotly to plot a graph. I am using the tooltip function to represent the values in the barchart when the cursor is moved on the top of the graphs.Source_Data <- data.frame( key = c(1, 1,...
View ArticleR raster warning: In (function (..., deparse.level = 1) : number of columns...
I am trying to create a raster by subsetting/intersecting two others from the Hansen et al. global forest change data set (found here:...
View ArticleForce read_xml to interpret string as literal XML
I've been struggling to force the read_xml function (xml2 package) to treat my character input as a literal string. Apparently, if the input doesn't look like XML enough, it will try to open it as an...
View ArticleMutating multiple columns dynamically while conditioning on specific rows
I know there are several similar questions around here, but none of them seems to address the precise issue I'm having.set.seed(4) df = data.frame( Key = c("A", "B", "A", "D", "A"), Val1 = rnorm(5),...
View ArticleReactive shiny modules sharing data
I'm trying to create a shiny app using modules. Two dataframes (tables a and b) are reactive and can be modified, a third dataframe (table c) is also reactive and is based on tables a and b. I tried...
View ArticleIs there a way to install R packages using emacs?
I am using ESS, but every time I need to install a new package I have to use R gui. Isn't there a way to do this without leaving emacs?
View ArticleGGPLOT2 scale_x_discrete(labels = abbreviate) problem with october
Recently I tried to make monthly distribution of one value as a geom bar in GGPLOT. I have a problem with plots labels where for october it shows on X-axis 2019-1 instead 2019-10.ggplot(data =...
View ArticleSome way to pull every row before a specific occurrence
I am having difficulty attempting to figure out how to pull all of the rows from a data frame before an occurrence. I know I can pull the first occurrence of something quite easily, but for my specific...
View ArticlePerforming time series analysis of quanteda tokens
I am running into issues figuring out a way to pair time information with each individual token in quanteda. I want to run times series analysis on a list of 25 different tokens. I know that I can just...
View Article'df' must evaluate to column positions or names, not a list- pivot_wider
I have a df similar to this ID Concentration A 1 A 2 B 3 B 4 and I would like the pivot the id's into columns with the values being the concentrations and missing values being filled with NAs. At first...
View ArticleHow to code a subscript i within a function?
I have the following function that I am trying to write in R: Currently, I have the following code, but I don't understand how to denote the subscript i?f5 <- function(x) {((x^4 - 16*x^2 + 5*x)/2)}
View ArticleHow to convert "heading" rows into new columns
I have data (imported imperfectly from a PDF) that has everything in a single column, with certain rows as descriptive headers. For example:dfx <- data.frame(V1 = c("Box 1", "abcd10", "bcde15", "Box...
View ArticleMerge tables by DateTimeStamp in R
I would like to merge at least two tables using a DateTimeStamp column of the format "%Y-%m-%d %H:%M:%OS" (e.g. "28-Jun-2019 20:50:55.123"). Although at different positions, the DateTimeStamp column is...
View Articleerror with rda test in vegan r package. Variable not being read correctly
I am trying to perform a simple RDA using the vegan package to test the effects of depth, basin and sector on genetic population structure using the following data frame. datafile. The "ALL" variable...
View Articleggplot2 seperating legend by shape
# Data: zz <- "Small Large Lat Long 1 51 2 11 10 2 49 0 12 11 3 77 7 13 13 4 46 5 12 15 5 32 6 13 14 6 54 3 15 17 7 68 0 14 10 8 39 5 12 13" Data <- as.data.frame(read.table(text=zz, header =...
View ArticleNxN tabluation over columns in R and check duplicacy between columns
I have a dataframe with unique items procured on rows and their corresponding sources on columns (Basically this is a data which I have "dcast" from original data)Now it looks like thisDF <-...
View ArticleNo spacing between the tab names in shiny applications
I have created a shiny application and there is no extra spacing between the tabs which I have rendered to the UI. I am using bs4dash shiny framework for the UI. Is this issue related to the this...
View ArticleMap Arctic/subarctic regions in ggplot2 with Lambert Conformal Conic...
I am trying to map lat/lon locations in the Arctic/subarctic region using ggplot2, and colour them by type. Here are the packages I'm using:library(ggplot2) library(rgdal) library(ggmap) library(sp)...
View Article