similar to: question: ragged array

Displaying 20 results from an estimated 400 matches similar to: "question: ragged array"

2011 Dec 20
1
Convert ragged list to structured matrix efficiently
Hi All, I'm wanting to convert a ragged list of values into a structured matrix for further analysis later on, i have a solution to this problem (below) but i'm dealing with datasets upto 1GB in size, (i have 24GB of memory so can load it) but it takes a LONG time to run the code on a large dataset. I was wondering if anyone had any tips or tricks that may make this run faster? Below is
2004 Sep 13
1
Adding ranks to a repeatedly ragged array
How can I add an extra column containing the rank to a ragged array indexed by more than one grouping factors? E.g. with the barley dataset: How can I to add an additional column ``rank'' containing the rank of the ``yield'' of the different varieties in relation to the indices ``year'' and ``site'' to the barley dataframe? I achieved to calculate the ranks with:
2009 Jun 22
5
Convert "ragged" list to matrix
Hi, I have a list made up of character strings with each item a different length (each item is between 1and 6 strings long). Is there a way to convert a "ragged" list to a matrix such that each item is its own row? Here is a simple example: a=list(); a[[1]] = c("a", "b", "c"); a[[2]] = c("d", "e"); a[[3]] = c("f",
2011 Jun 03
0
ragged data.frame? using plyr
I have a dataset that looks like: set.seed(144) sam<-sample(1000,100) dat<-data.frame(id=letters[1:10],value=rnorm(1000),day=c(rep(1,100),rep(2,100),rep(3,100),rep(4,100),rep(5,100))) I want to "normalise" it using the following function (unless you have a better idea...): adj.values<-function(dframe){ value_mean<-mean(dframe$value) value_sd<-sd(dframe$value)
2006 Jul 19
2
Aligning ragged text columns
Can anyone please suggest how I can print: a <- matrix(c( "Heading 1", "This is some info\nabout heading 1", "Heading 2", "This is some info\nabout heading 2", ), byrow=T, nrow=2) to look like: Heading 1 This is some info about heading 1 Heading 2 This is some info about heading 2 (if you're not using a fixed width
2007 Nov 24
1
ragged array with append
I wonder what's the right way in R to do the following -- placing objects of the same kind together in subarrays of varying length. Here's what I mean: > word <- c("a","b","c","d","e","f","g","h","i","j") > kind <- c(1,1,1,2,3,4,5,5,7,7) > d <-
2001 Oct 22
1
statistics for ragged arrays: loop to vector
Dear R users, I am currently writing a MCMC algorithm for spatial Poisson model. One problem which I need to solve is as follows: I have a vector X[1:J] which describes characteristics of cells of a rectangular grid. Further, for each cell I have a list of adjascent cells adj[] and the vector listing numbed of adjascent cells num[]. Thus if I want to list cells adjascent to cell i I write
2008 Oct 03
2
Ragged time series data
Hi and thanks in advance, I am fairly new with R so I hope this problem isn't too amateur. I have a vector of count data which correspond to vectors of date (%m/%d/%Y) and time of day (%H:%M:%S). I am trying to compute various statistics (e.g. daily max) by lumping the data together by day. I have been able to utilize tapply() and group the counts together, but with the method I use I end
2007 Mar 16
1
Fast lookup in ragged array
Hello, I'm running an algorithm for graph structural cohesion that requires a depth-first search of subgraphs of a rather large network. The algorithm will necessarily be redundant in the subgraphs it recurses to, so to speed up the process I implemented a check at each subgraph to see if it's been searched already. This algorithm is very slow, and takes days to complete on a
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi, We''re trying to rewrite veeeery old Rails app that we successfully managed to move to 1.2.6 and now we''re trying with 2.1.0. One of the problems is caused by :include in AR.find. Rails 1.2.6 generates totally different SQL query than 2.1.0. Here''s Rails find query and generated SQL queries: Foo.find(:all, :include => :ticket, :conditions =>
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
I''m on the downhill side of a large project that requires an additional integer field to be added to the tag.rb in acts_as_taggable. I feel I have a good understanding of ActiveRecord and have performed the correct migrations. (As a short background for those following this thread) when one wants to add tags to a model they call the ''tag_with'' method that jumps into
2006 Jun 01
4
can''t convert Fixnum into String ??
I have been getting this error message on various pages, just wondering if anyone could explain whats going wrong, and the best way to correct it code that is cuasing the problem is below @project = Project.find(:first, :conditions => "id = " + @purchaseorder.project_id) -- Posted via http://www.ruby-forum.com/.
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list, In the app we are making we have a rout something like this: map.resources :projects do |projects| projects.resources :pages, :controller =>"Wiki::Pages", :path_prefix => "/projects/:project_id/ wiki", :name_prefix => "project_wiki_" end But I can''t get RSpec(I''m very new to it) to accept this. It keeps throwing errors:
2007 Nov 14
6
a few add_index questions..
on previous apps i hadn''t really worried much about adding foreign key indexes on my tables just because they''ve been fairly small and i didn''t really think i needed them. well, i''m working on something now that has the potential to have a lot more data, and a lot more foreign keys. so i have 3 tables... users, projects, and tasks.. should i be using add_index
2008 Sep 06
6
Active record question
I''m not quite sure how to get at this data using Actrive record.. I''m trying to get all the appointments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I''m looking for but how do I do it using Active Record? Select a.* from appointments a join resources r on r.id = a.resource_id join
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
2012 Mar 26
3
render :json not sending any data back ...
[rails 3.2.2] I perform an ajax call : ... $.ajax url: " /backoffice/expenses/rate" type: "GET" dataType: "json" data: project_id: $(''#project_id'').val() code: $(this).val() success: (result) -> alert result $(''#expense_price'').val(result) in
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
I have a master record called ''project'' and a child record called ''agycode''. Obviously, agycode has a project_id FK. I wish to make the "descr" field unique ONLY within the ''project_id'' ''scope''. Here are the key pieces of information Agycode fields (id, project_id, descr) Here''s the declaration in the
2006 Apr 25
4
Newbie - Grouping of items...
I''m trying to build a dashboard type page (similar in function to basecamp''s) where I can show the last 5 updated items from my 3 differing models, then grouped together by project. Solution ideas: (1) Is it best to create a log model where everytime I add or update another model (like messages, comments, lists etc) an enrty gets added to the log along with the project. I
2012 Oct 23
10
How to pick colums from a ragged array?
I have a large dataset (~1 million rows) of three variables: ID (patient's name), DATE (of appointment) and DIAGNOSIS (given on that date). Patients may have been assigned more than one diagnosis at any one appointment - leading to two rows, same ID and DATE but different DIAGNOSIS. The diagnoses may change between appointments. I want to subset the data in two ways: - define groups