I am trying to use the Highest In, First Out accounting method on trades. Highest In, First Out means that when you sell, you sell your most expensive shares fi
how would you add a column to this dataset showing the number of individuals of each species?. install.packages("ggplot") library(ggplot) library(ggplot2) star
I have a dataset with ~2500 columns in R, and I am trying to find the minimum value greater than zero from the entire data frame. Once I have found this number,
I have a really simple question but am not able to figure out at all. animal age cat 12 dog 8 Normally I'd apply data %>% mutate(diff = age[1] - age[2]), b
I have a datafram such as COL1 COL2 COL3 G1 1 6 G1 2 6 G1 3 7 G1 4 9 G1 5 9 G1 6 9 G1 7 6 G1 8 6 G1 9 7 G1 10 7 G1 11 7 G1 12 8 G1 13 7 and I would like to rem
I have dataset input with a couple of missing values. and I have to create dataset output with the following logic: If there is a missing in any of the columns
Each primary_citation may have multiple copublications. I would like to aggregate citation_id's associated with each primary citation. The following code works
I have the following data: date_range <- c('2020-01-31', '2020-02-28', '2020-03-31', '2020-04-30', '2020-05-31',
I'm making a table like this: basic_table() %>% split_cols_by("ARM") %>% analyze(vars = c("AGE", "BMRKR1"), afun = function(x) { in_rows( "M
Running regression with panel data on different geographical levels in the US and Euro area with weights that essentially look like this: lm(log(POP25) ~ log(EM
I have a data frame df<-data.frame(Name=c('H001', 'H002', 'H003', 'H004', 'H005', 'H006', 'H007', 'H008', 'H009', 'H010'),
I have a longitudinal data set with two people in which the rows of data are numbered as 'episodes', and some episodes have a test 'result'. The goal of the bel
I have the following dplyr code: df3 <- Table3%>% group_by(Q6,Q9,Q11) %>% summarise(count = n()) %>% mutate(per = paste0(round(100 *count/sum(
Using dplyr, I'm looking to summarise a new column of data as a lagged version of an existing column of grouped data. Reprex: dateidx <- as.Date(c("2019-
Apologies if this is obvious, I don't have much experience with R. I have a function contains_leap_year(date1, date2) that I want to pass in as a condition to d
I'd like to create several new columns. They should take their names from one vector and they should be computed by taking one column in the data and dividing i
I need to merge three separate DFs ("factors_sed", "resp", and "npoc_sed") based on the shared column "Samples". Each DF contains a different number of rows (s
I have a dataframe: n <- 50 df <- data.frame(id = seq (1:n), age = sample(c(20:90), n, rep = TRUE), s
I have the following R dataframe df: library(tidyquant) start_date <- as.Date('2022-01-01') end_date <- as.Date('2022-03-31') assets_list <- c('DGS30
I have the following dataframe: # A tibble: 8 x 5 Year Group Unit Profit Sales <dbl> <chr> <chr> <dbl> <dbl> 1 2021 One