Possible directed cycle in JAGS
I am trying to fit a space state model, and I am getting this error message:Error in jags.model(file = model.file, data = data, inits = inits, n.chains = n.chains, : RUNTIME ERROR: Possible directed...
View ArticleR: Merging two date columns into one in order by id
I am currently working in R in data table and have two date columns (first_day and last_day) that I need to merge together into one date column (date). This needs to be done so that the column has the...
View ArticleChanging facet_wrap Graph Titles for Survival Curves
I have 5 survival curves I currently need to format for a research paper. The code for my survivorship function is below.all<-survfit(Surv(MD,Censor)~DepTyp,data=add,conf.type='log-log') From the...
View ArticleR, ggplot2 - In the legend, how do I hide unused colors from one geom while...
I'm making a plot that has color defined for a geom_point(), and everything looks good.points_a <- data.frame(x = sample(1:10, 4), y = sample(50:60, 4), id = "a") points_b <- data.frame(x =...
View ArticleR: How to use Bing free tier web search using R
Assuming user provided card and phone and has valid Azure account. Created a free tier service. (has key and endpoint, something like xyz.cognitiveservices.azure.com/bing/v7.0Using free tier (3...
View Articleproblems writing a space state model
I am trying to fit a state-space model. I started with a simple model which included only one variable but, since that model did not explained one of my parameters, I am trying to include another...
View ArticleIs there any R code to repeat a same value for multiple rows?
My df looks like this now. A B C 1 3 . 1 6 . 1 9 . 2 1 . 2 2 . 2 5 . 3 9 . 3 3 . 3 2 . Below is the ideal dataframe I am try to create:Variable A refers to individuals (user-id). Each individual has...
View ArticleMinimising objective function problem using lpsolve in R
I'm tackling a simple linear optimisation problem. I have a bunch of crops with have their associated land requirements per tonne and their water footprints per tonne. I want to know how many tonnes of...
View ArticleError in gzfile(file, "wb"): cannot open the connection or compressed file
I'm trying to run two things: first, I'm creating a PDF with 4x5, ending with dev.off(), and then trying to create a new graph. However, after starting the second plot, I get:Error in gzfile(file,...
View ArticleR psych, cohen.d error Error in `.rowNamesDF
I get the below error when trying to compute effect size using cohen.d function in psych. Please see example data below. library(psych) x <- c(1, 2, 3, 4, 5, 6, 7, 8) y <- c(1, 1, 1, 1, 2, 2, 2,...
View ArticleMultiplication of large integers
I tried to multiply 111111111*111111111, which is the same as 111111111^2, and got incorrect results. It should give 12345678987654321, but instead it gives a rounding error. Do I need to use some...
View ArticleWhy does these three ggsurvplots not merge into one?
Please, find My Data p below. I have produced three different KM plots by creating ggsurvplots as illustrated below. I would like to merge all three, hence I have used the arrange_ggsurvplots approach...
View ArticleThe time tags in the dygraph are different from the one in the time series...
Code and PlotI have drawn a dygraph in R. But the time tags in the x axis are different from the actual time values in the data. The problem can be seen clearly in the attached image above- Code and...
View Articlehow to edit my code to eliminate the error in r
Hi I am using the following code to generate the best model, and when it is running the following error appearsError: $ operator is invalid for atomic vectors I have read several solcuines, but I have...
View ArticleHow to compare two different datasets in Shiny?
Hopefully I can do a good job explaining what I'm trying to accomplish. Here is a very simple script:library(shiny) data("mtcars") ui <- fluidPage( selectInput("cyl", "Cyl", choices =...
View ArticleConvert a factor column with numbers in k format into numeric without losing...
I have a factor column which has numbers in it. Some numbers are written in k format, for ex. 99k, 9.25k, 91.9k, etc. while others are written in whole like 998, 575, etc. Two things I want to do-:I...
View Articleggplot not drawing boxplots as expected
Consider the MWE below. I would like to generate boxplots with these ideas in mind:Food on the y-axix ordered according to Amot for Home, while Amt (1:40) on x-axisshow mean points overlaying the...
View Article"Rterm could not be found" error trying to run R code using ESS
I'm trying to install Emacs Speaks Statistics using use-package. I have included the following code in my initialisation file.(use-package ess :ensure t :init (require 'ess-site))I believe that ESS is...
View Articleextract values within a range across an entire dataframe in r
I am trying to extract specific values within a dataframe. I am attempting this because I want to gather relevant information from an output which I have saved as a dataframe so I can pull the...
View ArticleHow to add extra arguments to ggplot2 theme?
I'd like to create a script specific theme for some ggplots I'm producing. I plan to have a set custom theme that allows me to make some adjustments if needed using the three-dot notation .......
View Article