similar to: Can you recover default argument values of a function?

Displaying 20 results from an estimated 8000 matches similar to: "Can you recover default argument values of a function?"

2007 Dec 10
4
Reading through a group of .RData files
Hi. I have a procedure that reads a directory, loops through a set of particular .RData files, loading each one, and feeding its object(s) into a function, as follows: cvListFiles<-list.files(fnDir); for(i in grep(paste("^",pfnStub,".*\\.RData$",sep=""),cvListFiles)){ load(paste(fnDir,cvListFiles[i],sep="/")); myFunction(rliObject); rm(rliObject); };
2008 Jan 07
3
Seeking a more efficient way to find partition maxima
Hi. Suppose I have a vector that I partition into disjoint, contiguous subvectors. For example, let v = c(1,4,2,6,7,5), partition it into three subvectors, v1 = v[1:3], v2 = v[4], v3 = v[5:6]. I want to find the maximum element of each subvector. In this example, max(v1) is 4, max(v2) is 6, max(v3) is 7. If I knew that the successive subvector maxima would never decrease, as in the example,
2008 Jan 02
2
Seeking a more efficient way to read in a file
Hi. I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two numbers, etc. In general, row k+1 contains k numbers; the matrix has 3000 rows, so the file has 3001 rows. The file has variable length records, so each row ends
2011 Mar 25
4
read.xls -> rotate data.frame
Hi to all, how could I to rotate automatically a data sheet which was imported by read.xls? x1 x2 x3 .... xn y1 1 4 7 ... xn/y1 y2 2 5 8 .... xn/y2 y3 3 6 9 ....xn/y2 yn ... ... ... Xn/Yn to y1 y2 y3 .... yn x1 1 2 3 ..... Yn/x1 x2 4 5 6 .... Yn/x2 x3 7 8 9 .... Yn/x2 xn ... ... ... ..... Yn/xn Kind regards Knut
2007 Dec 19
1
Function reference
Hi. I'm looking for an R equivalent to something like function pointers in C/C++. I have a search procedure that evaluates the fitness of each point it reaches as it moves along, and decides where to move next based on its fitness evaluation. I want to be able to pass different fitness functions to this procedure. I am trying to find a good way to do this. I was thinking of passing in
2005 Aug 03
1
filter data set unique, duplicate..
Hello First, thanks for the help for an earlier question about error handling! I have problem filtering a dataset. I'm trying to filter the data in the y columns based on the values in the x column, e.g.: x y1 y2 yn 1.0 1 NA 3 2.0 1 NA 11 2.0 2 NA NA 3.0
2008 Jun 24
2
persp plot
I have a set of data in the form x1, y1, z1 x1, y2, z2 ... x1, yN, zN x2, y1, z(N+1) x2, y2, z(N+2) ... x2, yN, z(2N) ...and so on... xM, yN, val(M*N) I have been trying to figure out how to get R to use this data in a persp plot. So far the only thing that I can figure out to do is to break the data file into three different files. The first file contains the x-coordinate data: x1 x2
2009 Dec 24
2
how to do multiple responses in a linear regression
Hi, I have multiple responses y1, y2, .., yn, and would like to do linear regression for each of them with x1, x2, ..., xm. Instead of doing regression n times, it it possible to do it all at once? I tried lm(y1+y2 ~ x1 + x2 + x3) and lm added y1 y2 and then did the regression. thanks Jeff
2007 Mar 05
2
Linear programming with sparse matrix input format?
Hi. I am aware of three different R packages for linear programming: glpk, linprog, lpSolve. From what I can tell, if there are N variables and M constraints, all these solvers require the full NxM constraint matrix. Some linear solvers I know of (not in R) have a sparse matrix input format. Are there any linear solvers in R that have a sparse matrix input format? (including the
2010 May 30
1
Count the number of consecutive 1's
Hi All, We have a raw dataset that, on the sampling time column, for example: t <- c(0,1,2,5,0,5,0,2,5) And we need to create a second column 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
2007 Jan 03
1
na.action and simultaneous regressions
Hi. I am running regressions of several dependent variables using the same set of independent variables. The independent variable values are complete, but each dependent variable has some missing values for some observations; by default, lm(y1~x) will carry out the regressions using only the observations without missing values of y1. If I do lm(cbind(y1,y2)~x), the default will be to use
2012 Feb 23
5
cor() on sets of vectors
suppose I have two sets of vectors: x1,x2,...,xN and y1,y2,...,yN. I want N correlations: cor(x1,y1), cor(x2,y2), ..., cor(xN,yN). my sets of vectors are arranged as data frames x & y (vector=column): x <- data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10)) y <- data.frame(d=rnorm(10),e=rnorm(10),f=rnorm(10)) cor(x,y) returns a _matrix_ of all pairwise correlations: cor(x,y)
2007 Feb 01
3
Can this loop be delooped?
Hi. I have the following code in a loop. It splits a vector into subvectors of equal size. But if the size of the original vector is not an exact multiple of the desired subvector size, then the first few subvectors have one more element than the last few. I know that the cut function could be used to determine where to break up the vector, but it doesn't seem to provide control over
2011 Mar 09
4
Extracting only odd columns from a matrix
Hi, This might seem like a simple question but at the moment I am stuck for ideas. The columns of my matrix in which some data is stored are of this form: X1 Y1 X2 Y2 X3 Y3 ... Xn Yn with n~100. I would like to look at just the X values (i.e. odd column numbers). Is there an easy way to loop round extracting only these columns? Any help would be appreciated.
2012 Oct 10
3
Generating random geographical coordinates
Dear all, I have two coordinates vectors, say X and Y of length n. I want to generate for each couple of coordinates X1,Y1 X2,Y2 X3,Y3....Xn,Yn a random coordinate which is located in a square define as X +/- dx and Y +/- dy. I saw the runif function which can generate for just one value at a time what I want : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y + dy) for Y. I would like
2010 Apr 19
2
nls minimum factor error
Hi, I have a small dataset that I'm fitting a segmented regression using nls on. I get a step below minimum factor error, which I presume is because residual sum of square is still "not small enough" when steps in the parameter space is already below specified/default value. However, when I look at the trace, the convergence seems to have been reached. I initially thought I might
2010 Apr 29
1
Request - adding recycled "lwd" parameter to polygon
Hello dear members of R-help and R-core mailing list, I am not sure if this request is a "ticket" that should be filled somewhere outside the mailing list. If so, I apologize for not doing and would like to know where I should have filled it. And to the subject matter: I would like to use a command like this: plot(c(1,8), 1:2, type="n") polygon(1:7, c(2,1,2,NA,2,1,2),
2010 Apr 29
1
Request - adding recycled "lwd" parameter to polygon
Hello dear members of R-help and R-core mailing list, I am not sure if this request is a "ticket" that should be filled somewhere outside the mailing list. If so, I apologize for not doing and would like to know where I should have filled it. And to the subject matter: I would like to use a command like this: plot(c(1,8), 1:2, type="n") polygon(1:7, c(2,1,2,NA,2,1,2),
2007 Jan 11
1
rank function and NA in 2.3.1
Hi. I am using R 2.3.1 on WIndows XP, and I am having trouble with the rank function in the presence of numerical NA data. I want the NA's all to get the same rank, but they don't. Here is an example from my session: >ct_align_rets_f2$liq[6851:6859] [1] 115396 NA 362595 NA 242986 340805 NA 692905 251533
2012 Oct 02
3
Integration in R
Dear R-users, I am facing problem with integrating in R a likelihood function which is a function of four parameters. It's giving me the result at the end but taking more than half an hour to run. I'm wondering is there any other efficient way deal with. The following is my code. I am ready to provide any other description of my function if you need to move forward.