search for: addcol

Displaying 4 results from an estimated 4 matches for "addcol".

Did you mean: addcols
2009 Jun 30
2
Using functions to change values in a data.frame
...unctions to make the code more readable and ensure that every frame is done the same way. However my simple example doesn't work as I expected it to: Here the R example code to cut and paste. The basic idea is to copy positive values of y into p and negative values into l. <START COPY> AddCols = function (MyFrame) { MyFrame$p<-0 MyFrame$l<-0 return(MyFrame) } BinPosNeg = function (MyFrame) { ifelse(MyFrame$y>0, MyFrame$p<-MyFrame$y, MyFrame$l<MyFrame$y) return(MyFrame) } F1 <- data.frame(x=1:10, y=-4:5) F1 F1 <- AddCols(F1) F1 F1 <- BinPosNeg(F1) F1 &lt...
2009 Jul 01
1
running count in data.frame
...0 0 7 7 2 2 0 0 0 8 8 3 3 0 0 0 9 9 4 4 0 0 0 10 10 5 5 0 0 0 > I wanted $lc to go up to 4 and then hold 4 until the end. $pc should have stays 0 until line 6 and then gone up to 5 at the end. Any and all inputs appreciated on what I'm doing wrong. Thanks, Mark AddCols = function (MyFrame) { MyFrame$p<-0 MyFrame$l<-0 MyFrame$pc<-0 MyFrame$lc<-0 return(MyFrame) } BinPosNeg = function (MyFrame) { ## Positive y in p column, negative y in l column pos <- MyFrame$y > 0 MyFrame$p[pos] <- MyFrame$y[pos] MyFrame$l[!pos] <- MyFrame$y[!po...
2009 Jul 01
2
?max (so far...)
...e function, in the sense I can create tempt1[1:7] and the max function returns what I expect. How do I do this with row? Simple example attached. hp should be 'highest p', ll should be 'lowest l'. I get an error message "Error in 1:row : NA/NaN argument" Thanks, Mark AddCols = function (MyFrame) { MyFrame$p<-0 MyFrame$l<-0 MyFrame$pc<-0 MyFrame$lc<-0 MyFrame$pwin<-0 MyFrame$hp<-0 MyFrame$ll<-0 return(MyFrame) } BinPosNeg = function (MyFrame) { ## Positive y in p column, negative y in l column pos <- MyFrame$y > 0 MyFrame$p[pos] &...
2009 Jan 13
2
Using fortran code which call LAPACK subroutines
...s I have to include something more? or modify the script? -should I compile from SHLIB with other options or include it directly into a package and cretae a makevars or PACKAGE_LIBS...? I'm lost... The subroutine I try to use is delcols.f (http://www.maths.manchester.ac.uk/~clucas/updating/addcols.f) which calls * .. External Subroutines .. EXTERNAL DGEQRF, DLASR, DROT, DROTG, XERBLA Thank you very much!!