Category "r"

Dates error NAs are not allowed in subscripted assignments

Consider the following dataset. It concerns the final date of the unemployment spell, but for now it can simply be seen as changing an enddate when certain char

Insert group-final time measurement from last observation to set limit

This dataframe: df <- structure(list(Subject = c("A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B"), Timestamp = c("00:00:00.146 - 00:00:

How to make expand_limits dynamic in a pyramid chart?

I want to make a population pyramid chart to display differences of age and gender among different jobs in the DF i have (small sample below). I want to make th

cumsum with a condition to restart in R

I have this dataset containing multiple columns. I want to use cumsum() on a column conditioning the sum on another column. That is when X happens I want the su

Problem with adding labels using tm_text function within tmap

I have created a great map using the code below but got a problem with labels. The labels overlaps with each other and become unreadable. How can I fix this? My

Putting data into specific row order in R

I have inherited a mess of a table which looks a little like this: A1 B1 C1 V1 B1 0/1 C1 0/0 A1 1/1 V2 C1 0/1 A1 0/0 B1 0/1 V3 B1 0/0 NA A1 0/1 e

Combine multiple histograms ggplot

I have several character variables with the same dimensions of outcome that I would like to compare. I am able to create a hsitogram for each of these variables

Draw histogram between cluster via R

This is dataset with my variables for analysis. clys<-structure(list(session_price = c(18824.7664, 35584.4106, 21084.4035, 9907.5856, 30806.5486, 15788.1279

Creating axis gap in histograms

I'm trying to create a gap in a histogram between 0.6 and 1 (on the y axis) but don't really know how to go about this. The gap.barplot solution does not seem t

I want to replace dplyr style, but I don't know how to do it in R

I want to replace this code into dplyr style. financials[is.na(ForecastEarningsPerShare), ForecastEarningsPerShare := ForecastEarningsPerShare2] Could you tell

Perform T test on DE genes pathologies in R

I have this: subset_1 <- degs[degs$pathol=='fibrosis'&degs$value==1,] mean_1 <- mean(subset_1$logFC) sd_1 <- sd(subset_1$logFC) tsub_1 <- t.test

Add a title and description to leaflet map

I have attempted to create a leaflet map of the birthplaces of NHL players. However, I would like to add a title and/or a description in the map. I have attempt

Tracking observations across different datasets (e.g. sub-reddits)

I have three datasets from three different sub-reddits, and my goal is 1-to check how many users are active in df1 (i.e. a sub-reddit), active in df2, and/or df

How to plot coefficients with robust standard errors?

I have this LSDV model using the "lm()" function and adding the country dummy variables minus the intercept. Then I made robust standard errors in order to fix

Average a multiple number of rows for every column, multiple times

Here I have a snippet of my dataset. The rows indicate different days of the year. The Substations represent individuals, there are over 500 individuals. The 1

plotting means in a horizontal bar with a vertical line

ID score1 score 2 score 3 score 4 1 200 300 400 -200 2 250 -310 -470 -200 3 210 400 480 -200 4 220 -10 -400 -200 5 150 -50 400 -200 I am new to R, I want to m

plotting means in a horizontal bar with a vertical line

ID score1 score 2 score 3 score 4 1 200 300 400 -200 2 250 -310 -470 -200 3 210 400 480 -200 4 220 -10 -400 -200 5 150 -50 400 -200 I am new to R, I want to m

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