search for: rownum

Displaying 20 results from an estimated 27 matches for "rownum".

Did you mean: row_num
2012 Feb 24
6
strange behaviour of "POSIXlt" "POSIXt" object
Hi, Does anybody know why get I this kind of strange situation: Browse[2]> hcEnd [1] "2009-03-29 06:30:00" Browse[2]> class(hcEnd) [1] "POSIXlt" "POSIXt" Browse[2]> is.na(hcEnd) [1] TRUE This issue is the source of my all issues in my program, Thanks for your help -- View this message in context:
2008 Jul 18
0
spreading the risk
...ND OUT WHERE ALL THE ONES ARE. # ARR.IND = TRUE GIVES THEM BACK IN MATRIX FORM whichres <- which(tempbinmat == 1, arr.ind=TRUE) # THIS LAPPLY GOES THROUGH THE LOCATIONS WHERE # THERE ARE ONES AND FINDS LOCATIONS WHERE # ONES NEED TO BE ADDED onespositions <- lapply(1:nrow(whichres),function(.rownum) { rightspot <- c(whichres[.rownum,1], whichres[.rownum,2]+1) leftspot <- c(whichres[.rownum,1], whichres[.rownum,2]-1) belowspot <-c(whichres[.rownum,1]-1, whichres[.rownum,2]) abovespot <- c(whichres[.rownum,1]+1, whichres[.rownum,2]) temp <- rbind(rightspot,leftspot...
2011 May 18
4
Loop stopping after 1 iteration
...handle,data_type,sep="_") data_grid<-read.table(file=paste(filename,".txt",sep="")) num_rows_data<-nrow(data_grid)-1 num_cols_data<-ncol(data_grid)-4 num_obs<-num_rows_data*num_cols_data time_series<-matrix(nrow=0,ncol=2) for(i in 1:length(num_obs)){ rownum<-ceiling(i/31)+1 colnum<-if(i%%31==0){ 35 }else{ (i%%31)+4 } year<-data_grid[rownum,2] month<-data_grid[rownum,3] day<-colnum-4 date_string<-paste(month,day,year,sep="/") date<-as.Date(date_string,format='%m/%d/%Y') value<-as.character(data...
2006 Jan 25
4
Cannot :order when using :offset and :limit in find
...entlogs = Componentlog.find(:all, :conditions => [ "cl_compname like ?", @criteria ], :offset => offset, :limit => items_per_page, :order => "cl_spr DESC" ) It goes totally doolally. OCIError: ORA-00907: missing right parenthesis: select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM componentlog WHERE (cl_compname like ''CAPODIR'') ORDER BY cl_spr DESC ) raw_sql_ where rownum <= 25) where raw_rnum_ > 0 I don''t have much control over this (line is there, line isn''t, line is there, line isn''t...)...
2006 Jan 26
1
Help constructing a find_by_sql command
...imit => items_per_page, :order => "cl_spr DESC" ) in a find_by_sql statement. I cannot use the build in because the adaptor isn''t quite right (OCI8) When I use it I get the following error OCIError: ORA-00907: missing right parenthesis: select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM componentlog WHERE (cl_compname like ''CAPODIR'') ORDER BY cl_spr DESC ) raw_sql_ where rownum <= 25) where raw_rnum_ > 0 I am not sure how to convert this into a find_by_sql statement, I tried: result = Componentlog.find_by_sql ["select *...
2006 Jul 04
1
[Fwd: formatting using the write statement]
...ell the write statement that i want the data >to be written in a fixed format ( same number of spaces >betweewn character strings and numbers ) rather than written as it >is above ? i tried sep = " ", instead of ncolumns butt hat >just makde things worse. thanks. > >for (rownum in 1 (1:nrow(sortedForecastData)) { > >outfile=paste(forecsastfiledir,rownames(sortedForecastData[rownum],".mls",sep="") > >for colnum in (1:ncol(sortedForecastData) { > >if ( colnum == 1 ) { > >write(c(colnames(sortedForecastData[colnum],sortedForecastD...
2011 Apr 04
1
moving mean and moving variance functions
Hello Lets say as an example I have a dataframe with the following attributes: rownum(1:405), colnum(1:287), year(2000:2009), daily(rownum x colnum x year) and foragePotential (0:1, by 0.01). The data is actually stored in a netcdf file and I'm trying to provide a conceptual version of the data. Ok. I need to calculate a moving mean and a moving variance for each cell on the f...
2011 Oct 05
2
aggregate function with a dataframe for both "x" and "by"
...=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA) , stringsAsFactors =F) myaggs <- data.frame(matrix(data=NA, nrow=nrow(mydata), ncol=ncol(mydata) ) ) for(i in 1: ncol(mydata) ) { temp <- aggregate(mydata[i], by = as.list(mybys[i]), FUN=sum, na.rm=T) rownums <- match(mybys[,i],temp[,1]) myaggs[,i] <- temp[rownums,2] } myaggs Finally, how do I convert and use "mybys" to factors, so that I can tell R that the NA values form a group? I tried substituting this line above: temp <- aggregate(mydata[,i], by = as.list(mybys[,i])...
2010 May 30
1
Count the number of consecutive 1's
...mn that indicates the day of the sampling, so the end result of what we want is a vector: 1,1,1,1,2,2,3,3,3 Additional information that might simplify the matter is that, for each day, the time starts with zero and ends with 5. I am a beginner with R.? So far I have: t <- c(0,1,2,5,0,5,0,2,5) rownum = length(t) y <- NULL y0 <- NULL y1 <- NULL x <- ifelse (t!=5,x<-1,x<-0) for (i in 1:rownum){ ? if (x==1)? { ????? y <- y+x ? } else {y+1 then ????????? y0<-sum(y) then ????????? y=0 ???????? } y1 <- c(y1,y0) } y2 <- y1 y2 <- y2[y2!=0] ? y2 Day <- NULL for (i in...
2004 Mar 19
2
for loop or Hmisc library trap.rule function syntax error
...om the Hmisc trap.rule function into "control" and "test" for hypothesis testing. I tried posting this last PM, but my message seems to have been lost. I apologize if this appears as a duplicate message. Thanks. Neil ... control = c(); test = c(); for (subj in 1:11) { rownum = subj+1 # add one to subject as first row is column labels control(subj)=trap.rule(c(0,30,60,90,120,180),c(data.df(subj,2:7)) test(subj)=trap.rule(c(0,30,60,90,120,180),c(data.df(subj,8:13)) } ...
2008 Aug 11
2
sampling
Hello, I have a matrix and I want to sample 20 rows that are the the percentiles of 0-100 in 0.05 increments. I have a vector of my sequence (0, 0.05, 0.10, 0.15,....1.0) and also a normalised vector of rownumbers. That is, there are 234 rows (for example) so I do perc<-c(1:234/234) which looks like a bunch of numbers from 0 - 1. In Excel (which I try not to use at every possible occaison) you can use a VLOOKUP function to say choose the rows from the perc vector that are the closest match to the...
2011 Jun 23
2
Confidence interval from resampling
...0 times with shape=xwei.shape, scale = xwei.scale draw <- lapply(1:100, function(.x){ out<-rweibull(x, shape=xwei.shape, scale = xwei.scale) }) newx<- data.frame(draw) colnames(newx)<-paste("x", 1:100, sep = "") newmat<-data.matrix(newx) # matrix of coefficients rownum=2 colnum=100 ResultMat<-matrix(NA, ncol=colnum, nrow=rownum) rownum2=45 colnum2=100 ResultMat2<-matrix(NA, ncol=colnum2, nrow=rownum2) #loop through each column in the source matrix for (i in 1:100) { sel_col<-newmat[col(newmat)==i] {ResultMat[,i]<-coef(fitdis...
2006 Jul 06
4
Oracle HR on Rails
Interesting read...apologies if it has been posted already. http://www.oracle.com/technology/pub/articles/saternos-rails.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060706/619e650a/attachment.html
2006 Jan 13
19
Problems with scaffold''s parameter on Oracle
...rimary key, name varchar2(100)); And ruby script\generate model Customer ruby script\generate controller Customer http://localhost:3000/customer/ - show a fine list, but when I click show/edit/destroy, I get an ORA-01722: OCIError: ORA-01722: invalid number: select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM customers WHERE (customers.id = ''5.0'') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0 The problem comes from the parameter applied: Request Parameters: {"id"=>"5.0"} id is a number, not a text string !?! Is this a...
2009 Nov 07
1
after PCA, the pc values are so large, wrong?
rm(list=ls()) yx.df<-read.csv("c:/MK-2-72.csv",sep=',',header=T,dec='.') dim(yx.df) #get X matrix y<-yx.df[,1] x<-yx.df[,2:643] #conver to matrix mat<-as.matrix(x) #get row number rownum<-nrow(mat) #remove the constant parameters mat1<-mat[,apply(mat,2,function(.col)!(all(.col[1]==.col[2:rownum])))] dim(yx.df) dim(mat1) #remove columns with numbers of zero >0.95 mat2<-mat1[,apply(mat1,2,function(.col)!(sum(.col==0)/rownum>0.95))] dim(yx.df) dim(mat2) #remove colunm...
2009 Feb 16
24
como consultar en oracle
holaa todos ante todo un cordial saludo alguien que me pueda ayudar. se plantea lo siguiente necesito mostrar 2 campos de una tabla los cuales son mtin_mtin,mtin_descri de una tabla llamada re_tmtinv de esos dos campos se necesita obtener el codigo y la descripcion,y luego ser mostrado para despues ser agregados a un formulario. el problema que tengo es que ya tengo la vista pero esta en blanco
2006 Mar 01
4
Oracle Bug
I''m using 2 database. The first wrote in MySQL and the second in Oracle. If i use the command "SET_TABLE_NAME" to forge the model to use another table, there isn''t no error with MySQL, while with Oracle if i ask the view "_Form.rhtml" The compiler tell me "No sequence in SELECT TableName_seq.nextval id from dual"(???). Could someone tell me where
2009 May 28
1
Error: argument is of length zero
Hi, I have the following: for(j in (y.raw+1):(rownum-1)){ valsum<-tstfframed[min.x,j]+tstfframed[min.x,j+1] if(valsum == 1){ cat("valsum loop") int.num<-int.num+1 } } but I get the error message: "Error in if (valsum == 1) { : argument is of length zero". I checked whether to see if all the stated variables...
2011 Dec 07
1
data frame and cumulative sum
...6 1 > This corresponds to the time differences (in ms) of a poisson arrival process where Interarrival{i+1} = time_{i+1} - time_{i} I want to get the Time bin (in minutes) of every interarrival basically something like: 1) df$Time <- sum(of all df$Interarrival up to "this rownum") # cumulative sum 2) df$Time <- floor(df$Time / 60000) + 1 then I should get the first minute of Interarrival having 1 and so forth. The problem is I have no idea how to accomplish 1) in R. Can anyone advice? Thanks in advance, Best regards, Giovanni
2002 Apr 18
5
Two problems
Hello! Two questions: 1: I have to import a matrix of adjacency from a file of a software that is not R (for example "bloc notes" of Windows). The problem is that the matrix is not in the explicit form as 0 1 1 1 0 0 1 0 0 but it is a scattered matrix where in each row there are two nodes that have a direct path. The matrix is a b a c b a c a For example, the first row