reshape

How to use acast (reshape2) within a function in R?

I tried to use acast from reshape2 within a self written function, but had the problem that acast did not find the data I send to it. Here is my data: library("reshape2") x <- data.frame(1:3, rnorm(3), rnorm(3), rnorm(3)) colnames(x) <- c("id", "var1", "var2", "var3") y <-melt(x, id = "id", measure = c("var1", "var2", "var3")) y ...

Create a panel from two data frames

I have two data frames -- one with stock closing prices arranged by date (rows) and ticker symbol (columns): > head(data.stocks) date A AAPL ABAT AB ABV 1 2010-10-04 32.59 278.64 3.65 26.42 125.89 2 2010-10-05 33.04 288.94 3.66 27.10 129.05 3 2010-10-06 32.67 289.19 3.59 26.99 129.90 4 2010-10-07 33.20 289.22 3.66 27...

matlab reshape function, number of elements problem

Hey guys. I want to use reshape() function in matlab by calling the following self-defined function : imgRgb = reshape(convertYuvToRgb(reshape(imgYuv, height*width, 3)), height, width, 3); here, width=352, height=288, imgYuv is a 4D matrix. However, the system gave me the following error message: To RESHAPE the number of elements must...