LISTSERV mailing list manager LISTSERV 16.0

Help for R-USERS-L Archives


R-USERS-L Archives

R-USERS-L Archives


R-USERS-L@LISTS.UFL.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

R-USERS-L Home

R-USERS-L Home

R-USERS-L  2014

R-USERS-L 2014

Subject:

working on 3d dataframe

From:

"Bhattacharya,Souvik" <[log in to unmask]>

Reply-To:

UF R Users List <[log in to unmask]>

Date:

Sat, 28 Jun 2014 04:24:26 -0400

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (37 lines)

Hello all,

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 
each.
I keep adding each dataframes to a 3dim "Clean" dataframe using the 
code

Clean <- abind(Clean,totalm,along=3)

After the 3d dataframe is created, all elements seems to be of 
character type.

  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 
regard.

Thanks
Souvik

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.

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

2019
2018
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008

ATOM RSS1 RSS2



LISTS.UFL.EDU

CataList Email List Search Powered by the LISTSERV Email List Manager