similar to: Subsetting subsets of data.frames

Displaying 20 results from an estimated 4000 matches similar to: "Subsetting subsets of data.frames"

2010 Jun 04
5
R Newbie, please help!
Hello Everyone, I just started a new job & it requires heavy use of R to analyze datasets. I have a data.table that looks like this. It is sorted by ID & Date, there are about 150 different IDs & the dataset spans 3 million rows. The main columns of concern are ID, date, and totret. What I need to do is to derive daily returns for each ID from totret, which is simply totret at time
2010 Jun 09
3
Extracting Elements By Date
Dear R Gurus, Thanks for any help in advance! Date.frame: Returns.names X id ticker date_ adjClose totret RankStk 258060 258060 13645T10 CP 2001-06-29 18.125 1877.758 My data frame is in the above format. I would like to filter by period, per id (every 125 days) each consisting of 250 days, I.e. 1-250, 126-375, etc. One important thing to note is that not all
2010 Jun 08
1
Filtering out a data.frame
Sample Data.Frame format Name is Returns.nodup X id ticker date_ adjClose totret RankStk 427225 427225 00174410 AHS 2001-11-13 21.66 100 1235 "id" uniquely defines a row What I am trying to do is filter out id's that have less than 1500 data points (by date) First, I used total<-by(Returns.nodup, Returns.nodup$id,nrow) which subsetted by
2006 Jan 27
1
"Conditional" match?
I have two datasets, big and small. s_date<-c(?2005-12-02?, ?2005-12-01?, ?2004-11-02?,?2002-10-05?,?2000-12-15?) s_id<-c(?a?,?a?,?b?,?c?,?d?) b_date<- c(?2005-12-31?, ?2005-12-31?, ?2004-12-31?,?2002-10-05?,?2001-10-31?,?1999-12-31?) b_id<-c(?a?,?b?,?c?,?d?,?e?,?c?) small<-data.frame(date_=as.Date(s_date),id=s_id) big<-data.frame(date_=as.Date(b_date),id=b_id) For each row
2006 Jan 03
2
For loop gets exponentially slower as dataset gets larger...
I am running R 2.1.1 in a Microsoft Windows XP environment. I have a matrix with three vectors (“columns”) and ~2 million “rows”. The three vectors are date_, id, and price. The data is ordered (sorted) by code and date_. (The matrix contains daily prices for several thousand stocks, and has ~2 million “rows”. If a stock did not trade on a particular date, its price is set to “NA”)
2005 Oct 11
6
adding 1 month to a date
Within an R dataset, I have a date field called “date_”. (The dates are in the format “YYYY-MM-DD”, e.g. “1995-12-01”.) How can I add or subtract “1 month” from this date, to get “1996-01-01” or “ “1995-11-01”. --------------------------------- [[alternative HTML version deleted]]
2012 Nov 28
2
data frame: adding columns from data and file title
Data processing? I have a large number of csv files from animal tracks that look like this: Date_ Time_ Speed Course Type_ Distance 30/03/2012 11:15:05 108 121 -2
2010 Jun 10
3
Retrieving the 2 row of "dist" computations
Dear R Gurus, As you probably know, dist calculates the distance between every two rows of data. What I am interested in is the actual two rows that have the least distance between them, rather than the numerical value of the distance itself. For example, If the minimum distance in the following sample run is d[14], which is .3826119, and the rows are 4 & 6. I need to find a generic way to
2006 Jan 13
0
Controller part of in-place editing
I''m doing some incremental improvements on scaffolding, and want to add in-place editing to an admin section. I think I may have the view part working right (at least, the editor pops up as expected) with this in my view: ### <% for link in @links %> <tr> <td> <div id="<%= ''url'' + link.id.to_s -%>"><%= link.url
2012 Nov 09
2
sink() doesn't work
Oftentimes I want to make outputs to be displayed on the R console. However, after I execute a program with a sink command in it the R console becomes unresponsive. Meaning that the following occurs in R console: > source("Program_containing_sink.R") > a<-1 > a > >sink() >a > R help says that sink() will bring output back to the console but i's not
2004 Jun 18
2
C7960 g729 question
I have multiple voiceage g729 licenses installed on a RH9 box, and have a remote C7960 configured to use it (low bandwidth). In calls like: Remote C7960 -> g729 -> asterisk -> g711 -> C7960 the audio is oftentimes rather choppy. Changing the remote 7960 to use g711 seems to eliminate/reduce the choppyness. Any ideas on what might be behind this?
2009 Feb 13
2
Identifying graphics files produced by R
Oftentimes, I see graphs on the web that *look* like they've been produced by R, but I can never be sure. Or can I? I notice that PostScript files include a "%%%Creator: R Software" line, but do R graphics drivers encode any identifying information in GIF or PNG files more commonly used on the web? And of so, would such evidence necessarily be obliterated in post-processing (e.g
2006 Aug 17
1
Organizing the db/migrate folder
Hiall, I was wondering how you guys are organizing your migrations files under db/migrate? I have like 60 database tables initially, and if I exercise migrations the way they should be exercised, I guess this will become even more files ... Now maybe you say 70 files ain''t that much anyway :) but the thing of course is that these files logically belong to different areas of my
2006 Aug 02
10
Ruby deamon
We are building a web-based application with Ruby on Rails and MySQL backend. The client now wants us to add various workflow features that will eventually expand into SOAP web services. These workflow features include tasks such as automatically sending reminders for due tasks, or if a particular set of information hasn''t been logged by a certain time to automatically send an email
2003 Jun 27
0
Subsetting and conversion in data frames
I have now finished a long session of documenting and bug-fixing the way subscripting of data frames works -- you can see this in the NEWS file in R-devel. As far as I know we are at the point where the only times that character columns get converted to factors are in data.frame(), read.table() and when as.data.frame() is called on a list. (There are read.table-alikes in other packages which
2006 May 04
4
why a perfectly fine iax2 host becomes UNREACHABLE?
I've got this low-ping 100%-up dsl connection between two asterisk 1.2.7.1 servers. And oftentimes one of them would declare its opposite UNREACHABLE. Why can this happen? The host stanzas in iax.conf have raw IP's, so no DNS monkey business here.. An inquiring mind wants to know.
2000 Feb 09
2
Row subsetting of data frames (PR#425)
If you want to use row names to take a row subset of a data.frame then there is a bug when - One row has a name which is a completion of another row name - The shorter name comes after the longer one - You want to retrieve the row with the shorter name An example: R> x <- matrix(1:4, 2, 2, dimnames=list(c("abc","ab"), c("cde","cd"))) R> x cde
2007 May 03
1
reshape question
Hello all, A quick question concerning a behavior of reshape I fail tu understand, probably something obvious but I just can't see it. With the following data frame further referred to as tab :
2007 Feb 07
1
Problem with subsets and xyplot
Hello I have a dataframe that looks like this MSA CITY HIVEST YEAR YR CAT 1 0200 Albuquerque 0.50 1996 1996 5 2 0520 Atlanta 13.00 1997 1997 5 3 0720 Baltimore 29.10 1994 1994 1 4 0720 Baltimore 13.00 1995 1995 5 5 0720 Baltimore 3.68
2017 Mar 09
4
[RFC] bitfield access shrinking
In http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20120827/063200.html, consecutive bitfields are wrapped as a group and represented as a large integer and emits loads stores and bit operations appropriate for extracting bits from within it. It fixes the problem of violating C++11 memory model that original widen load/store of bitfield was facing. It also brings more coalescing