I have data on this form in a data.table DT: year value order '1981' 2 1 ...
I have data on this form in a data.table DT: year value order '1981' 2 1 ...
I have a dataframe of the form: col1 var value A VAR1 1 B VAR1 ...
I have two data frames, d1 and d2: The data is grouped by 'ID'. The 'stat' column are stations (or sites) visited. The 'OD' column is the origin an ...
I am trying to spread df on two columns in RHS long to wide. Dataframe I have: What gives: Desired dataframe: I am wondering if it can be don ...
I created this dataframe Variable_7101 but I would like to repeat this analysis for multiple variables. To be more specific, I have another dataframe ...
I have data as follows: I would like to merge this data. However: Since the combination of ID + year has multiple matches, this is not an optio ...
I have a data frame like this: and I'd like to transform into this one ...And continuing with all observations there are in the original datafra ...
After a long struggle with my code I think I found a strange behavior of dcast() function in data.table library. Can anyone confirm it, or am I doing ...
I need to reshape a dataframe csf_antibio (sample below) from long to wide format, separating all values per patient by row. I tried the following ...
I'm trying to calculate favorite brand per productcategory per customer. 1. Start and what I want to achieve I start with a dataframe (mydata) with ...
I want to convert table dt: into using dcast or other function/s from data.table. I have tried things such as dcast(dt, Who ~ T + Res) but got ...
I know there must be a one-line data.table solution for this, probably with dcast, but I can't figure it out. I have data like this: I simply wish ...
I have solved a problem using the dcast function from reshape library. However, I don't usually work with that library and generally I prefer working ...
I want to transform a data set from long to wide. The data contains multiple observations for each time point. To illustrate, consider the following ...
I am having trouble understanding how I can use dcast (or any other function) to restructure my data frame. I was given a data frame that looks somet ...
I have a DT like this: I reshape to wide after making a counter ("seq") by id to have all drugs in one observation/id Obtaining: The Desired ...
I am learning R and attempting to figure out splitting a column. I am looking to spread my data from a single column in wide format. I was told to use ...
My sample dataset has multiple columns that I want to convert into wide format. I have tried using the dcast function, but I get error. Below is my sa ...
I have data in the form of a pandas dataframe similar to that described here. That is: And I want to create a presence-absence matrix like so: H ...