Displaying 3 results from an estimated 3 matches for "last_subject".
2016 Mar 29
2
Filtering based on the occurrence
Hello,?
I have a data set similar to below and I wanted to keep the observations after the first occurrence of these department: "B", "D", "F".For example for ID=2, the observation with deps=B and anything after will be kept in the data. For ID=3, observations with deps=D and anything after will be included.
Subject<- c("2", "2", "2",
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'...
2016 Mar 31
0
Filtering based on the occurrence
Hi Jim,?
Thank you tons for your help. The code worked perfectly :)?Best,Farnoosh
On Wednesday, March 30, 2016 1:13 AM, Jim Lemon <drjimlemon at gmail.com> wrote:
Hi Farnoosh,
Despite my deep suspicion that this answer will solve a useless
problem, try this:
last_subject<-0
keep_deps<-c("B","D","F")
keep_rows<-NULL
for(rowindex in 1:dim(df)[1]) {
if(df[rowindex,"Subject"] != last_subject) {
? last_subject<-df[rowindex,"Subject"]
? start_keeping<-0
}
if(df[rowindex,"deps"] %in% keep_deps)...