similar to: has_many, belongs_to

Displaying 20 results from an estimated 8000 matches similar to: "has_many, belongs_to"

2006 Apr 03
2
Order By Number of Comments
Hi, I am new to Ruby on Rails, so I apologise if this has been answered elsewhere. I have had a look through the list but I can''t seem to find what I am trying to do. I have implemented the standard blog and comments app from the screencast. However I am trying to extend the functionality. I want to be able to display a list of posts and order them by the total number of comments
2006 Mar 21
2
Sorting by computed temporary field
Hey all, I''m rather new to Ruby and Rails (and not great with SQL), but I''m developing a ride sharing app and would like to be able to sort on something I don''t have stored. I have users, events, and rides, each of which has a zip code. Events have_many rides, and rides belong_to events. When an event is selected, I''d like to be able to show a list of
2009 Jun 25
2
variable driven summary of one column
Hello, how can I get a variable driven summary of one column of my data.frame? Usually I would do > summary(data$columnname) to get a summary of column named "columnname" of my data.frame named "data". In my case the columnname is not static but can be set dynamically. So I save the chosen columname in something like variable <- "columnname" but how can I
2011 Jul 27
1
Referencing a column using a function argument
Hi all, I've been having trouble with something that seems like it should be fairly straight forward. Any help at all from more experienced users is appreciated! I'd like to write a function that uses a column name as an argument. However, I run into problems when I try to reference this column within the function. For example, findCutoff <- function(tableName, columnName) {
2007 Apr 22
1
names( d$columnname )
dear R wizards --- would it make sense for names(d$columnname) to be "columnname"? I can preserve the columnname through x=subset(dataset, select="columnname"), of course, but it would seem that x=d$columnname could also do this. No? Sincerely, /iaw
2012 Jan 13
2
question: how to select a column from a dataframe in a function
Hi, I am creating a function and ran into the problem of selecting a column from a dataset. It seems as though the $ function (as in data$columnname) does not apply in the function. In simplified version: This works: testf2<-function(data,columnnumber){print(data[,columnnumber])} But this doesn't: testf<-function(data,column){print(data$column)} Even though the first solution works,
2010 Jul 26
4
using string variable as order() function argument
Hello, In my script I would like to use a loop, which sorts the dataframe according to different columns, pointed by the string variable. id col1 col2 col3 1 10 0 4 8 2 11 1 2 2 3 12 0 8 3 4 13 0 5 5 Usually the order() function can be used like this: sorted = mytable**[order(column3) , ] which results in properly sorted table: **
2006 Jul 03
1
difficult data manipulation question
hi everyone : suppose i have a matrix in which some column names are identical so, for example, TEMP "AAA", "BBB", "CCC", "DDD","AAA", "BBB" 0 2 1 2 0 0 2 3 7 6 0 1 1.5 4 9 9 6 0 1.0 6 10 11 3 3 I didn't even check yet
2012 Aug 07
2
What is this called? lapply(datum,"[[","ColumnName")
Hello R users I recently learned how to use this command: lapply(datum,"[[","ColumnName") Unfortunately, I don't know how exactly it works, what it's called (in particular the "[[" part], and what other things you can do with it (retrieve multiple columns?). Given datum is a list of dataframes with the same column, but different number of rows,
2003 Feb 17
1
R environment advice?
Hello, My questions are meant to be not necessarily specific...I am looking for advice and best practices for setting up an R environment. Here's my situation: I am one of perhaps three or four individuals who will be analyzing the same data through the use of R. I would like to set up a "base" environment for our project, basically some scripts that connect to a database, load
2011 Dec 02
2
order function give back row name
Hello, I have a matrix results with dimension 1x9 double matrix XLB XLE XLF XLI 1 53.3089 55.77923 37.64458 83.08646 I'm trying to order this matrix > print(order(results)) [1] 3 1 2 4 how can the function order return the columnname XLF XLB XLE XLI instead of 3 1 2 4 any idea ? Thank you in advance --
2008 Oct 21
6
detecting width overflow in serialized column with mysql
So I''ve got an ActiveRecord model pointing to a MySQL db, with an auto-serialized column ("serialize :columnName"). Thing is, MySQL, depending on how it''s configured (like, by default), has a bad habit of just truncating your data if it''s too wide for the column, with no error raised. Yeah, I can probably reconfigure MySQL and/or my AR connection to it. But
2005 Mar 06
4
has_many and order
Hi all, if I have a has_many and belongs_to relations like this category has many articles article belongs to category is there a way I can specify the order of articles when pulling them up with @some_category.articles ? Many thanks in advance! -- Nicky
2006 Jul 02
4
is "label for" better?
I''ve noticed that it is common practise in forms to use: <label for="tablename","columnname"> ...Some column name</label> Why is the above construct better than just writting it this way? <label> Some column name</label> If there is not compelling reason, I''d prefer to use the second example and save on typing. -- Best Regards,
2001 Apr 06
2
automatic levels
Hello, I've imported a csv, semi-colon spearated file with read.csv2, containing one column of rownames and one column of floating point numbers. When I look at the column of data with framename$columnname, I get the values of the column plus level values. Are these level values created automatically ? The problem is when I try to calcluate the correlation coefficient between this set of data
2010 Apr 13
2
transpose but different
Hi all, I want to make extra columns in my datafile where the id of every groupmember is mentioned in separate columns. To explain it better see the example: id<-c(1,2,3,4,5,6,7,8,9,10,11,12) group<-c(1,1,1,1,2,2,3,3,3,3,3,3) a<-as.data.frame(cbind(id,group)) a id group 1 1 1 2 2 1 3 3 1 4 4 1 5 5
2008 Jul 01
2
Are centre coordinates or upper left corners used of x, y for SpatialPixels?
Dear all, I'm working with satellite images in R and plotting them via the code below. I was wondering whether coordinates (spatial["x"], spatial["y"]) are used as centre coordinates of the pixels in the GRID? In this script; spatial["x"] & spatial["y"] are the centre coordinates of the satellite image pixels. I'm asking this because some
2007 Mar 01
2
Query about data manipulation
Hi Thanks much for the prompt response to my earlier enquiry on packages for regression analyses. Along the same topic(?), I have another question about which I could use some input. I am retreiving data from a MySQL database using RODBC. The table has many BLOB columns and each BLOB column has data in the format "id1 \t id2 \t measure \n id3 \t id4 \t measure...." (i.e. multiple rows
2008 Mar 24
4
SIP carrier billing technicalities
Hi, Does anyone know anything about the following? In a hosted environment where several area DIDs are provisioned on a single server, how do most carriers establish the origination DID, number. Asterisk allows us to modify the CallerID, name, number and DNID channel variables before dialling out via SIP. Most carriers will allow us to spoof a callerID when placing a call, and pass it forward.
2008 Sep 23
2
how to model this
Dear list, I met with a business case and feel frustrated to model it,scenario is like this 1. logistics department running 2. a lot of customers place orders and goods need to be send to their site (nationwide) 3. order received and then choose from a list of truck carriers to deliver goods,a cheapest one should be selected but might not available for the limit of order-shipment time,so a more