similar to: Confused...

Displaying 20 results from an estimated 6000 matches similar to: "Confused..."

2005 Aug 10
1
Why only a "" string for heading for row.names with write.csv with a matrix?
Consider: > x <- matrix(1:6, 2,3) > rownames(x) <- c("ID1", "ID2") > colnames(x) <- c("Attr1", "Attr2", "Attr3") > x Attr1 Attr2 Attr3 ID1 1 3 5 ID2 2 4 6 > write.csv(x,file="x.csv") "","Attr1","Attr2","Attr3" "ID1",1,3,5
2010 Jun 01
2
Help on aggregate method
Dear R experts, I would really appreciate if you had an idea on how to use more efficiently the aggregate method: More specifically, I would like to calculate the mean of certain values on a data frame,? grouped by various attributes, and then create a new column in the data frame that will have the corresponding mean for every row. I attach part of my code: matchMean <-
2009 Sep 18
1
inconsistency in attaching attributes to NULL
In R-devel (svn 49628) and back to at least R 2.7.0 we get inconsistent results when attempting to attach attributes to a variable with the value NULL. If we use attributes<- it finishes but changes the value to list(). > a<-NULL > attributes(a)<-list(attr1="First attribute", attr2=2+2i) > a list() attr(,"attr1") [1] "First
2010 Jul 02
3
Knowledge discovery
Hi, I have 100000 units with 10 attributes (attr1, attr2, attr3, etc...) For instance: unit attr1 attr2 attr3 ... 1 a ww 12 2 a re 11 3 b ww 09 4 c yt 02 5 a qw 02 ... I'd like to answer to the question: a) what are the most frequent combinations of attributes? b) How could I describe the relations
2012 Jan 04
1
AR update / create pattern: is there an easier way?
I find myself writing the following frequently: r = MyActiveRecord.where(:attr1 => cond1, :attr2 => cond2, ...) r.exists? ? r.first : r.create ... which has the effect of returning an instance of MyActiveRecord if all the conditions are met, or creating one if it doesn''t. A variant of this: c = MyActiveRecord.new(:attr1 => val1, :attr2 => val2, ...) r =
2011 Nov 12
1
With an example - Re: rbind.data.frame drops attributes for factor variables
When I use rbind() or rbind.data.frame() to add a row to an existing dataframe, it appears that attributes for the column of type "factor" are dropped. See the sample example below to reproduce the problem. Please suggest How I can fix this. Thanks, Sammy a=c("Male", "Male", "Female", "Male") b=c(1,2,3,4) c=c("great", "bad",
2006 May 17
6
ActiveRecord#to_param
Hello, to implement some some kind of optimistic locking, I want to build a view, where an object is displayed together with a link containing the data of the displayed object. My first try looked something like <%= object.object_discription %> <%= link_to "action", :action => "take_action", :data => object %> this won''t work because object is of
2007 Mar 05
1
Deletion of xattr don't sync
Is there option for deleting xattr-s same as --delete for files, because it seems deletion of xattr don't sync, however it is synced when data of file change, see example below. Maybe this is a bug or maybe this is ok? System gentoo attr-2.4.32, rsync form today cvs. -- Regards Stanislaw Gruszka stasiu@sg /mnt/hda5/export $ echo "data" > file stasiu@sg /mnt/hda5/export $
2009 Feb 19
3
Associated child records not created on creation of a parent.
I am trying to create a record with association. Within the create method, I would also like to pre-populate dependent (has_many) records from a template in the database. The child records are <u>mysteriously rolled back </u> if I insert them in a loop. If I try to insert a single child record, it works.I have read the books and tried to google my way out of this but am at a dead
2005 Jul 25
2
acts_as_tree and traversing parent/child relationships
I am working on an Rails application that uses a pretty complex category structure through out the site. I have defined a table to house all the info and a FK to reference parents within the table CREATE TABLE categories ( id int(11) NOT NULL auto_increment, name varchar(50) NOT NULL, parent_id int(11) default NULL, constraint fk_category_id foreign key (category_id) references
2007 Oct 12
3
Models that reference themselves
Hi I''m pretty much a newbie to Rails and I have at least two projects under development that are going to need the same type of constructs and I''m struggling to get my head around how to achieve what I want using Rails models and relationships. In one project I have a hierarchy of (geographical) sites. For example: Earth Europe Ireland Cork Kerry Galway
2006 May 30
2
acts_as_tree, acts_as_list and is invincible (help!)
So I have the following model class Topic < ActiveRecord::Base belongs_to :topic has_many :topics, :order => :position acts_as_tree :order => :position acts_as_list :scope => :topic_id end that I use for a site''s navigation. Everything (list, create, edit, even the drag&drop sort) works fine, except the destroy function, which the vanilla version def destroy
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the views with tons of <% %> ? Like this <%= start_form_tag() %> <%= text_field_tag(''category[title]'', category.title, {:size => 20, :maxlength => 128}) %> <% if not category.parent_id.nil? %> <%= select("category", "parent_id", Category.find(:all,
2006 Oct 22
3
Keeping DRY - I like a simple life!
Hi, I''m new to Ruby and Rails and I would be very grateful for some advice. I''ve got the following code. class Foo < ActiveRecord::Base include Versionable # Some methods to handle my versioned objects has_many :versions, :class_name => "FooVersion", :foreign_key => "parent_id" belongs_to :curr, :class_name => "FooVersion",
2009 Mar 08
2
RESTful nested resources and polymorphism?
With ref to my previous post: http://www.ruby-forum.com/topic/180356 I am now able to access items from topics controller. However, now I need to add sub-item e.g.: An item itself could have many sub-items. So my items model is like: class Item < ActiveRecord::Base validates_uniqueness_of :title, :scope => [:topic_id] validates_presence_of :topic_id, :title, :owner, :position
2006 Apr 09
1
select helper question
Hi there, I try to develop a medical application using ruby on rails. There are many categories which can contain subcategories. I defined the model like this: class Category < ActiveRecord::Base has_and_belongs_to_many :notes belongs_to :parent_category, :class_name=>"Category", :foreign_key=>"category_id" has_many :sub_categories,
2003 Oct 23
1
Can you create a MySQL database with RMySQL?
Is it possible to create a database in MySQL via RMySQL? Also, is the format for the authorization field 'userName/password at databasename'? I saw an example like this somewhere in the documenation, but I haven't found the actual specification. Thanks, Barnet Wagman
2006 Mar 15
5
acts_as_threaded - help ???
Hi, has anyone successfully used the acts_as_threaded plugin with postgresql? I''m using rails 1.0 and ruby 1.8.4 on linux. Following the screencast on http://www.railtie.net/articles/2006/02/05/rails-acts_as_threaded-plugin , I got to where we''re ready to create our first post, having made the changes to controllers/posts_controller.rb, views/posts/_form.rhtml,
2006 Jan 09
1
Saving an upload
I am creating a database for movies (films) and television shows (shows) that will have has_and_belongs_to_many relationships with the pictures table. CREATE TABLE screenshots ( id serial NOT NULL, filename character varying NOT NULL, content_type character varying NOT NULL, primary key (id) ); CREATE TABLE films ( id serial NOT NULL, name character varying NOT NULL,
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations. The validation works as expected, but I can''t get "error_messages_for" to display. How is the name of the object supposed to be formated? Where is this object created, the model or controller? What am I doing wrong here? #### Model ######################## class MyFolder < ActiveRecord::Base def validate # validation