reshape2 Questions
3
Solved
Say I have a dataframe df with dozens of identifying variables (in columns) and only a few measured variables (also in columns).
To avoid repetitively typing all the variables for each argument, ...
4
Solved
Suppose I have a 3-dimensional array g with dimensions [x,y,z]. reshape2::melt(g) would produce a data frame with columns giving indices of x,y,z and value where value contains the values in each e...
4
Solved
Forword: I provide a reasonably satisfactory answer to my own question. I understand this is acceptable practice. Naturally my hope is to invite suggestions and improvements.
My purpose is to plo...
4
Solved
I don't know whether this is an integer64 (from bit64) problem, or a melt problem (from reshape2, but if I try to reshape a data.frame containing integer64 data then the class information is destro...
2
Solved
3
How do I specify the column order, based on column 'Col' when using dcast?
df <- dcast(x, ID ~ ColumnName, value.var = "Answer")
I need the solution to be non specific to the data as x can be...
3
Solved
I'm trying to pivot to a longer format using dplyr::pivot_longer, but can't seem to get it to do what I want. I can manage with reshape::melt, but I'd also like to be able to achieve the same using...
8
Solved
I have a dataframe in a wide format, with repeated measurements taken within different date ranges. In my example there are three different periods, all with their corresponding values. E.g. the fi...
3
Solved
I love the reshape2 package because it made life so doggone easy. Typically Hadley has made improvements in his previous packages that enable streamlined, faster running code. I figured I'd give ti...
2
My df looks like this:
Id Task Type Freq
3 1 A 2
3 1 B 3
3 2 A 3
3 2 B 0
4 1 A 3
4 1 B 3
4 2 A 1
4 2 B 3
I want to restructure by Id and get:
Id A B … Z
3 5 3
4 4 6
I tried:
df_wide <- dca...
Converse asked 10/10, 2015 at 7:17
2
Solved
Happy Weekends.
I've been trying to replicate the results from this blog post in R. I am looking for a method of transposing the data without using t, preferably using tidyr or reshape. In ex...
3
Solved
I would like to convert a matrix/array (with dimnames) into a data frame. This can be done very easily using reshape2::melt but seems harder with tidyr, and in fact not really possible in the case ...
4
Solved
I was trying to use ggplot2 to plot the built-in anscombe data set in R (which contains four different small data sets with identical correlations but radically different relationships between X an...
7
Edit -- This question was originally titled << Long to wide data reshaping in R >>
I'm just learning R and trying to find ways to apply it to help out others in my life. As a test case, I'...
1
Solved
I have a program that uses reshape2's melt function to melt a 5-dimensional array with named and labelled dimensions to a long-form data frame, which by definition has only two dimensions. Each dim...
Bare asked 8/8, 2020 at 3:1
3
Solved
I have a list of lists that have names.
I want to add them all together into a dataframe but keep all the columns
past_earnings_lists[1]
successfully returns one list from the list of lists
names(...
3
Solved
RStudio was crashing when I tried to reshape a particular data frame using dcast (from the reshape2 package). I discovered that the crash was actually happening in R itself, so I ran my casting cod...
Meiny asked 5/3, 2013 at 18:31
3
Solved
I'm trying to use dcast from the latest reshape2 package (1.2.1) to denormalize a data frame (or data.table) where the value.var is a POSIXct type, but in the resulting data frame, the date values ...
3
Solved
I am relatively new to R and have data in wide format as follows
subject_id age sex treat1.1.param1 treat1.1.param2 treat1.2.param1 treat1.2.param2
------------------------------------------...
4
Solved
I'm using ggplot2 to do a boxplot comparison of two different species, as indicated by the third column shown below:
> library(reshape2)
> library(ggplot2)
> melt.data = melt(actb.raw.dat...
5
Solved
I am trying to convert the following format:
mydata <- data.frame(movie = c("Titanic", "Departed"),
actor1 = c("Leo", "Jack"),
actor2 = c("Kate", "Leo"))
movie actor1 actor2
1 Titanic Leo...
3
Solved
I have the following dummy data:
library(dplyr)
library(tidyr)
library(reshape2)
dt <- expand.grid(Year = 1990:2014, Product=LETTERS[1:8], Country = paste0(LETTERS, "I")) %>% select(P...
2
Solved
I have a program that gives me data in this format
toy
file_path Condition Trial.Num A B C ID A B C ID A B C ID
1 root/some.extension Baseline 1 2 3 5 car 2 1 7 bike 4 9 0 plane
2 root/thing.exte...
4
Solved
I am trying to obtain counts of each combination of levels of two variables, "week" and "id". I'd like the result to have "id" as rows, and "week" as columns, and the counts as the values.
Example...
1
Is there a function similar to melt in SparkR library?
Transform data with 1 row and 50 columns to 50 rows and 3 columns?
Superabundant asked 12/10, 2018 at 15:19
1 Next >
© 2022 - 2025 — McMap. All rights reserved.