Questions tagged [dcast]

2 votes
1 replies
How do I change the column names using dcast?
I'm transforming my data from long to wide. Part of the data are dates. My problem is that I would like to have other colnames. It is formed li...
asked 1 month ago
1 votes
1 replies
Recast in R gives different value
I have the following dataframe in R DF2<-data.frame("ID"=c("A", "A", "A", "B", "B", "B", "B", 'B'), 'Freq'=c(1,2,3,1,2,3,4,5), "Val"=c(1...
asked 1 month ago
0 votes
1 replies
how to specify ID variables in dcast?
Following is a sample of the data I have datahave # A tibble: 6 x 6 YEAR SCHOOL_NAME CONTENT_AREA BELOW_BASIC_PCT BASIC...
asked 2 months ago
1 votes
2 replies
Customise the aggregate function inside dcast based on the max value of a column in data.table?
I've got a data.table that i'd like to dcast based on three columns (V1, V2, V3). there are, however, some duplicates in V3 and I need an aggrega...
0 votes
1 replies
reshape a matrix in R and converting every n rows into one row
I have a data frame df like: year location 1 A 2 B 3 C ------------------ 1 X 5 A 10...
asked 3 months ago
0 votes
1 replies
I have a long data set. How do I convert to wide format while using a rank function to limit the number of columns created?
I have a data set in a long format. Some records only have one manufacturer, some records are duplicated because there are multiple manufacturers...
asked 2 months ago
0 votes
0 replies
Plotting model predictions of logistic regression with two categorical variables in an additive model?
For my graduate work, I'm examining the effects of forest management on the nesting success of breeding songbirds. I've built a combination of mo...
asked 3 months ago
0 votes
0 replies
Remove the column with same value and added as a new column after transform the data in R [duplicate]
I have a data.frame that looks like this. x a 1 x b 2 x c 3 y a 3 y b 3 y c 2 I want this in matrix form so I can feed it to heatmap to...
asked 4 months ago
0 votes
1 replies
R long to wide format categorial variables and dates
I want to make a dataset with long format with a categorial variabel (medication) that has a start and end date to wide format. As the result the...
asked 1 month ago
0 votes
0 replies
Transforming long dataframe to wide. Using loops, apply family, dcast, or reshape on large datasets with metadata
I have one large long data frame where every chemistry constituent (20+) is listed in a single column "Analyte" and corresponding numerical value...
asked 5 months ago
0 votes
1 replies
Spread data based on multiple key variables
My data: df <- as.data.frame(cbind(Bilagstoptekst = c("A", "A", "A", "B", "B", "C", "D", "E", "E", "F", "F", "F", "F", "F"), A...
asked 5 months ago
1 votes
5 replies
How can I merge three columns into one column according to the order of in the three columns [closed]
Could you give me an advice, please? I have three columns, e.x.: x y z 0.2 0.5 0.26 0.75 0.58 0.25 0.78 0.86 0.95 0.56 0.75 0...
asked 6 months ago
-1 votes
0 replies
Reshape data.table using multilevel index?
I have this data.table: data.table(Playlist = c("micrhouse","micrhouse","attlas","attlas"), Track = c("make a move","mango","ryat","further"), S...
asked 1 month ago
1 votes
2 replies
Calculate value with two columns based on four conditions in R
I have a large dataset uploaded in r (see below for a short version): I want to calculate a value for each Cruiseid, Samplenr, Species and Age (s...
asked 3 months ago
1 votes
2 replies
how to dcast in pandas with more than one columns for columns argument
I have the following dataframe import pandas as pd df = pd.DataFrame({'id':[1,2,3,4,5,6], 'id_2':[6,5,4,3,2,1], 'col_1':['A','A','A','B','B','B'...
asked 2 months ago
1 votes
1 replies
r data.table::dcast cross product fails on large data set
i have a dcast() application whose cross-product exceeds .Machine$integer.max. is there a recommended alternative to dealing with this situation...
asked 4 months ago
0 votes
1 replies
Calculate different sets of functions passed as text strings for different columns by factor
In my R shiny App, I want to allow the user, by means of check boxes, to choose columns (instrument parameters in data), and for each of those wh...
asked 4 months ago
1 votes
2 replies
Long to wide with different number of rows for each group/ID
I have the following data frame: df <- data.frame(stringsAsFactors=FALSE, ID = c(2016070707, 2016070707, 2016070707, 201708080...
asked 4 months ago
0 votes
0 replies
Reshaping long to wide with multiple key pairs and aggregating based on multiple column values
I have a dataframe that looks like this: df <- data.frame(value =c(2,3,1,3,5,2), renew =c(2,2,3,2,4,1), renewFreq = c(.02,...
asked 6 months ago
0 votes
0 replies
Unable to get dCast to work - Aggregate function missing: default to length
I have tried solutions from multiple posts on stackoverflow, but haven't had any success. If you think this is a duplicate, it's not. I have alre...
asked 6 months ago
0 votes
0 replies
Reshape2 dcast with multiple columns in R
I am trying to use the dcast function in R on a dataframe but I see something is weird in my output. x <- dcast(DT,COUNTRY + DESCRIPTION ~...
asked 6 months ago
-1 votes
1 replies
R - Transpose a data.table by group [duplicate]
This question already has an answer here: How to reshape data from long to wide format...
asked 4 weeks ago
0 votes
1 replies
Is it possible to operate on the aggregated dcast values?
dcast.data.table has the feature to aggregate on multiple value.var. Is it possible to somehow reference the aggregated values being created and...
asked 3 weeks ago