Questions tagged [reshape]
In R, Matlab, NumPy and APL, reshape functions allow data to be transformed into more convenient forms.
reshape
3,904
questions
29
votes
2
answers
47k
views
melt to two variable columns
I have the following variables in a data frame:
[1] "Type" "I.alt" "idx06" "idx07" "idx08" "farve1" "farve2"
If I do:
dm <- melt(d, id=c("Type","I.alt"))
I get these variables:
"Type" ...
17
votes
5
answers
35k
views
Reshaping data frame in R [duplicate]
I'm running into difficulties reshaping a large dataframe. And I've been relatively fortunate in avoiding reshaping problems in the past, which also means I'm terrible at it.
My current dataframe ...
19
votes
3
answers
26k
views
Convert data from many rows to many columns [duplicate]
I have data that comes out of a DB in a normalized way with a field for year, state, and value.
I would like to do analysis on the data and need it formatted where each year is a field and not a ...
8
votes
3
answers
43k
views
How do I resize a matrix in MATLAB?
Suppose I had a 1-by-12 matrix and I wanted to resize it to a 4-by-3 matrix. How could I do this?
My current solution is kind of ugly:
for n = 1:(length(mat)/3)
out(n,1:3) = mat( ((n-1)*3 + 1):((...