Please, I have this wide data and I want to pivot it to long data. I have used the pivot_longer() function, but I don't seem to get it right. I wan ...
Please, I have this wide data and I want to pivot it to long data. I have used the pivot_longer() function, but I don't seem to get it right. I wan ...
I am looking to generate a longitudinal dataset. I have generated my pat numbers and treatment groups: My timepoints (in days) are: How can I pi ...
I'm generating some data as follows: This gives me a table like: I want to pivot this into longer format, so I have the columns: timepoints_days ...
I have a panel dataset that counts violent events per year in multiple districts on a map. I am interested in the number of violent events in neighbor ...
I have a data frame with a date column with some missing values: I want to fill in the NA dates thus: fill with next non-NA, upwards subtract ...
I have the code below in which I basically subtract the values on column qty based on if they have the same value in column activity and with the logi ...
Trying to use tidyr::fill() to fill in the blanks in the inception_date and expiry_date fields (filling in a downward direction) in a test data set: ...
I have this table with two columns, major_activity_area and word_stem. major_activity_area word_stem Yo ...
I have an output table I've created that includes customer level information and some more granular data (plan level information) as well, such that c ...
I want to modify a list of columns. Each column has a list of conditions that need to be applied with a case_when. I tried the following: df <- t ...
I'm still learning R and was wondering if I there was an elegant way of manipulating the below df to achieve df2. I'm not sure if it's a loop that is ...
I have a messy csv dataset that contains several (but not all) rows that unfortunately contains multiple entries. For each row, I'd like to separate e ...
I have responses where I solicited rankings of issues and the response I have for each individual look like this: I am trying to create a column th ...
when I use tidyr's gather() function and manipulate my dataframe, I lose row names of prev. data frame. this is output of my rstudio console after ...
The answers to this question document that the tidyverse analog of reshape2::melt() is tidyr::pivot_longer(). That's true, as far as it goes, but I st ...
I'm having trouble using the apply function and repeatedly get an error about different sources. I believe that both sources are data.frames, so I ca ...
I am trying to pivot_wider() the column X of a data frame containing various persons names. Within group_by() another variable Y of the df there are a ...
I have a dataset in which the number of pixels is counted for each value looking like this: HISTO_2 caputres the number of pixels with value 2, HIS ...
` I'm starting with a variable with chr strings. df$Specs : chr [1:28752] "4 GB RAM | 64 GB ROM | ExpandableUpto256GB", "..." enter image descripti ...
When select() uses argument contains("T"), the time column is lost. The function works when other character elements "PAR" or "RH" are used. here a s ...