Category "r"

Efficient implementation of value selection based on a column

R> data.frame(x1=1:3, x2=11:13, y=c('a', 'a;b', 'b')) x1 x2 y 1 1 11 a 2 2 12 a;b 3 3 13 b I have a data.frame in the format like above, where if

Trying to run a moderation analysis in R with multiple variables, but getting an error message

I'm trying to run setCor(Relconflict ~ dif * ï..ORG * Nation * LrelQ, data = Data2, zero = FALSE, std = FALSE, use = "complete") while trying to run a mode

How to add the same hyperlink to the value in a table in shinnyapp?

I have the below UI and server for my data. I would like to have the value in the number column as a hyperlink, then by clicking can go through the website. I w

row_sums vs findFreqTerms for subsetting TermDocMatrix to include words with a given min frequency

my question is straightforward. I have a (binary) TDM and I want to reduce the number of rows to include only those rows that appear in at least two documents:

Error in switch(tolower(device), ragg_png = , png = paste0(files, ".png"), : EXPR must be a length 1 vector

I am very new to R, so apologies if I don't make any sense. I am trying to make a flexdashboard for a class project and wanted to create an animated graph. The

Error in iiwgee: aeqSurv exception, an interval has effective length 0

I am using iiwgee function to fit survival model. I got this error when I fitting my model: Error in aeqSurv(Y) : aeqSurv exception, an interval has effectiv

Using character vectors from two different data frames as formula in regression with lm function

Currently i have two data frames that would look something like this: df1 <- as.data.frame(rbind(c("Name1", "Name2"), c("Name2", "Name3"), c("Name4", "Name5"

"grouping factor must have exactly 2 levels"

Hi y'all I'm fairly new to R and I'm supposed to calculate F statistic for this table The code I have inputted is as follows: # F-test res.ftest <- var.test

Rstudio Installation on Ubuntu App windows 11 I get Black screen

I installed Rstudio from terminal of Ubuntu App of windows 11 (Windows subsystem for linux) R version is R version 4.2.0 (2022-04-22) R studio after installatio

Plotly multiple updatemenus

Building on this post, I am trying to create two updatemenus in R plotly that would allow to select every possible combination of two factors. This is what I ha

inconsistent date format. Fixing it using is.na() and creating a new column with a unified format

heres what happens after I do bdata$Period <- as.Date(cdata$Period,"%Y-%m-%d") bdata So how do I convert the dates that are still in character format usin

Incorporating external regressor in a hierarchical/ grouped time series

Fellow contributors, I have been working with a hierarchical time series, relating to a set of identical products in a number of stores. For this purpose when w

Apply condition to opposite of regex pattern

How could I apply this regex so that all data in the column that does not match this regex turns to 'Need' - Currently, if I run this, it applies Need to all th

How to interpret the fixed effects in relation to random effects in mixed effects model?

This is a small subset of my data to show what it looks like because my data set is too large: I want to compare the long-term effect of two t

Filling NA data with data from another row with matching

Here is example data: df = data.frame(id = (1:5), type= c("a_type","a_type","b_type","b_type", "c_type"), start_date= lubridate:

How can I plot time series data?

My df dataset is like this. I want to plot the yield of sugarcane, coconut and rice in time. I filter the data by rice,sugarcane and coconut. My code is this:

R Fastest way to get value from a data.table under multiple criteria

i am trying to get the fastest (and to some extent elegant) method to extract single elements out of a data.table under a few criteria (with support table). For

Shared keys in repeated measures ANOVA in R

I am trying to preform a repeated measures ANOVA in R with anova_test from the rstatix package. However I got the error shared keys in 98 rows. The dataframe In

increase the memory allocation to R in windows10

I want to increase the allocated memory to 200GB in r. how should I do it? i tried using: memory.size(2000000). it didn't work. Any other suggestions, please. T

Insert NA values in Mysql table RMySQL

I am trying to insert a data frame row in a mysql table, but I have NA values in character and numeric columns. I'm getting this error: Error in .local(conn, st