search for: subject_id

Displaying 15 results from an estimated 15 matches for "subject_id".

Did you mean: object_id
2009 Apr 24
2
Array
Hi there, Just wondering if anyone has any tips for using arrays? I am trying to convert the following SAS code to R: data A2; set A1; by subject_id; retain BX1-BX10 i; array b(1:10) BX1-BX10 ; if first.subject_id then do ; do j=1 to 10; b(j) = .; end; i=1; end; b(i) = BX; i = i+1; if last.subject_id then output; run ; Many thanks in advance, Bronagh [[alternative...
2009 Jul 30
2
weight median by count for multiple records
...e following script to calculate the median for a data frame where each recorded distance has its own row, and where temp is a dataframe containing each unique SubjectID and routes is the file I describe above. for(i in 1:nrow(temp)){ temp$mediandistance[i] <- median(routes$Distance_miles[routes$Subject_ID==temp$Subject_ID[i]]) } I am interested to know... (1) Is there a way to incorporate a weighted median into this script, where the weights are the number of times each distance is recorded? (2) Can I transform my current matrix into one that gives each distance its own row? Help is much appreciat...
2008 Nov 20
2
Calculating SD according to groups of rows
...r in any programming language. Anyhow, how can I calculate the SD for each person in my table? I have two patients in this R data.frame, 7200 and 23955. I extracted this from a relational database, but am I better off attempting to compute SD in SQL, or is this easily accomplished in R? * SUBJECT_ID HR 1 7200 158 2 7200 165 3 7200 138 4 7200 152 5 7200 139 6 7200 157 7 7200 186 8 23955 167 9 23955 162 10 23955 171 11 23955 139 12 23955 170 13 23955 177 14 23955 180 15 23955 176 16 23955 172 17...
2009 Apr 22
1
Count Code
Hi there, I am interested in converting SAS code to R & I wondered if anyone had any quick R code/tips for the following piece of test SAS code? Any feedback greatly appreciated. data A1; set A1; count + 1; by subject_id; if first.subject_id then count = 1; run; [[alternative HTML version deleted]]
2009 Jan 25
1
Multiple lattice plots on a page: aligning x-axes vertically
...OS X 10.5.5; R: 2.8.1; lattice 0.17-20 library(reshape) library(lattice) plotdensitymeans <- function(data,measure,factors=c('subject_group','task'), xlab="",xlim=NULL, ...) { # Create means by subject x.melted <- melt(data, id.var = append(factors,'subject_ID'), measure.var=measure,na.rm=T) formula.bysubject.cast <- paste(factors[1],"+",factors[2],"+ subject_ID ~ .") x.cast.subject <- data.frame(cast(x.melted,formula.bysubject.cast, mean)) # Plot means by subject text.formula <- paste(factor...
2009 Jan 27
1
Creating list or numeric vectors out of selected columns of row oriented data
...made on a specific date for a single subject. I would like to transform the data so that I have an R object with a single entry for each subject and start date and vectors for the observation dates and the observations. The data are something like the following where for each subject the subject_id does not change and the start_date does not change, but the obeservation_date and the three different observations change between rows. (There is one row for each day for each subject over a three year period although some entered the study late): 'subject_id', 'start_date',...
2009 Sep 23
2
collection_text onchange event
hi, I want to display a drop down list and when i select some option from the drop down list i want to display all the records under that selected category in the "SAME PAGE".. eg .. <%= collection_select(:question,:subject_id ,@subject, :id, :name) %> when i choose a subject i should, display all the questions under that subject in the same page.I am new to rails.Can anyone please help me out.. Thanks in advance -- Posted via http://www.ruby-forum.com/.
2006 Jan 08
2
Why is my record readonly=>true?
Hello: I have something very order to create my object def review @bit = Bit.find(:first, :select => "bits.*,subjects.id as sid, subjects.name,gaps.id as gid, gaps.gap", :joins => "left join (subjects,gaps) on (bits.subject_id = subjects.id and bits.gap_id = gaps.id)", :conditions => "bits.status=''a'' and next_review <= CURDATE()", :order => "gap,next_review,subject_id,bits.id") end But when I try to save it rails...
2005 Jun 13
3
validations not working with collection population droplists
...ed_by"=>"", "product_type"=>"curriculum", "product"=>"", "approved"=>"N", "reviewer_email"=>"", "used_since"=>"2000", "what_i_liked"=>"", "subject_id"=>"17", "publisher_id"=>"2", "what_could_be_changed"=>""}, "submit"=>"Save"} This error seems to generate when Rails attempts to re-render the add form. Removing the ''collection_select...'' sta...
2006 Nov 28
0
Eager loading: what am I doing wrong?
...es have an effect on the initial query issued - though not the desired on: it just mentions all the fields explicitly, but creates no joins: [4;36;1mCourse Load Including Associations (0.002771) [0m [0;1mSELECT courses.`id` AS t0_r0, courses.`name` AS t0_r1, courses.`reference` AS t0_r2, courses.`subject_id` AS t0_r3, courses.`course_type_id` AS t0_r4, courses.`description` AS t0_r5, courses.`credits` AS t0_r6, courses.`lock_version` AS t0_r7, courses.`created_on` AS t0_r8, courses.`updated_on` AS t0_r9 FROM courses ORDER BY name [0m And then, when rendering, it churns out the myriad of individual q...
2009 Sep 23
0
page rendering and drop down onchange event
...I want to display a subject drop down list and when i select some option from the drop down list i want to display all the questions under that selected category in the "SAME PAGE" and also get a form to add new questions in the same page. eg .. <%= collection_select(:question,:subject_id ,@subject, :id, :name) %> when i choose a subject i should, display all the questions under that subject in the same page and a text box to add new quesions too in the same page.I am new to rails.Can anyone please help me out.. Will page rendering partial help in any way? Thanks in advance -...
2011 Oct 12
2
update_attribute - effecting multiple attributes
Anybody know why this: User.find(current_user).update_attribute(:last_subject, params[:subject_id]) results in this: AREL (0.6ms) UPDATE "users" SET "last_subject" = 4, "encrypted_password" = ''f470e6e76203973146c3b07e8b31c976b19cb23a9bf37485ad1911687cdc7a29'', "updated_at" = ''2011-10-12 13:43:21.727558'' WHERE "us...
2010 Oct 11
8
Nooby Stuck - "has_and_belongs_to_many" relationship
...class CreateSchemesWorks < ActiveRecord::Migration def self.up create_table :schemes_works, :id => false do |t| t.references :scheme t.references :work end THE ERROR >> scheme = Scheme.last => #<Scheme id: 21, schemename: "another", colour: nil, share: nil, subject_id: nil, user_id: 2, created_at: "2010-10-05 08:17:03", updated_at: "2010-10-05 08:17:03"> >> work = Work.last => #<Work id: 5, workname: "thrd", unit_id: 4, user_id: nil, unit: nil, created_at: "2010-10-11 17:24:51", updated_at: "2010-10-11...
2007 Feb 19
1
random effect nested within fixed effects (binomial lmer)
I have a large dataset where each Subject answered seven similar Items, which are binary yes/no questions. So I've always used Subject and Item random effects in my models, fit with lmer(), e.g.: model<-lmer(Response~Race+Gender+...+(1|Subject_ID)+(1| Item_ID),data,binomial) But I recently realized something. Most of the variables that I've tested as fixed effects are properties of the subject (e.g. Race, Gender, etc.). Is it correct to be using a random effect Subject that is nested within (partially-crossed) fixed effects like...
2009 Dec 24
4
NoMethodError
Hi, In a few words, can someone explain to me the NoMethodError. Googling for answers will get you to something but a direct answer from experts will give you something. NoMethodError in Book#new Showing app/views/book/new.html.erb where line #4 raised: undefined method `title'' for #<Book id: nil, created_at: nil, updated_at: nil> Extracted source (around line #4): 1: