I am working on a 3 dimensional dataframe where the 3rd dimension is
date. I used abind function to join different dataframes to give a 3
dimensional structure. The dataframes donot have same number of rows and
hence I have introduced "NA" to equate all dataframes to have 1000 rows
I keep adding each dataframes to a 3dim "Clean" dataframe using the
Clean <- abind(Clean,totalm,along=3)
After the 3d dataframe is created, all elements seems to be of
My first question , is there a way to change the numeric columns to
numeric type. For instance, there is a list of vector say vec =
c(1:5,9:25, 55:89) which are of numeric type for each date. I want to
change all these columns in the Clean 3 dim dataframe to numeric type.
is there any elegant way to achieve this.
My next question is, if I want to subset a smaller cube from this 3 dim
dataframe,(say I want to use something like
Clean[which(Clean[,"Color" == c("Red","Blue")]),], i.e. I want to
extract all those rows from every date where Clean[,"Color", ] is either
red or Blue ) is there any way to do this in R. Whenever I tried to
subset, it gives me a one dimensional array.
I shall be glad to receive any suggestions from the community in this
This list strives to be beginner friendly. However, we still ask that you
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.