search for: bonakdarian

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

2008 May 09
2
which.max2()
Hello, which.max() only returns one index value, the one for the maximum value. If I want the two index values for the two largest values, is this a decent solution, or is there a nicer/better R'ish way? max2 <-function(v) { m=which.max(v) v[m] = -v[m] m2=which.max(v) result=c(m, m2) result } Seems to work ok. Thanks, Esmail
2008 Jun 12
3
Adding new columns to (output) data - e.g., read 5 cols write 8
Hello, I have the following task I'd like to accomplish: A file contains 5 columns of data (several hundred rows), let's call them a, b, c, d and e (ie these are their column headers) I also have a set of definitions, e.g., f = a + b g = a * 3 h = c + d etc. I would like to write out a new .rda file that contains columns a b c d e f g h etc. I.e. , the original data plus new columns
2008 May 06
2
building a formula string bit by bit ..
Hello, Still a newbie with R, though I have learned a lot from reading this list. I'm hoping someone can help with this question: I have two vectors, one for variables, and one for bits. I want to build a string (really a formula) based on the values in my vector of 1s and 0s in bits. If I have a one, I want to include the corresponding entry in the vars vector, otherwise ignore it. Of
2008 Jun 11
3
searching for specific row in matrix
Hi, I have matrix of bits and a target vector. Is there an efficient way to search the rows of the matrix for the target? I am interested in the first row index where target is found. Example: > source("lookup.R") [,1] [,2] [,3] [,4] [,5] [1,] 1 0 1 1 0 [2,] 1 1 0 1 0 [3,] 0 0 1 0 0 [4,] 1 0 0 1 1 [5,]
2008 May 27
1
hash or other quick lookup function?
Hello all, I have a matrix of bit values. I compute certain values based on the bits in each row. There may be *duplicate* entries in the matrix, ie several rows may be identical. These rows change over time, and identical entries may not be next to each other. Computing these values is time consuming, so I would like a way to store a value once it's computed. That way I would be able to
2009 May 24
1
using optimize() correctly ...
Hi, I am trying to use the optimize function to optimize a function. The results I am getting don't agree with what I compute on my own and when I look at the graph of f(x) = 100 + ((x-10)**2 + (x-10)) * cos(x-10), where -10 <= x <= 10 in gnuplot. I suspect I am making a mistake in the usage of the R optimize function, perhaps someone could point out where? >
2008 May 10
2
Random number generation
Colleagues, I have encountered behavior of random number generation that eludes me. I generate a random integer in a particular range using the following code: sample(1000:9999, size=1) This code exists within a script that starts with the command: remove(list=ls()) Each time that I run the script, it yields the same random number: 6420. I thought that the problem might result from
2008 Apr 20
1
Java->R functions (or possibly C++ -> R)
Hello all, I am trying to implement a simple Genetic Algorithm using some of the functions of R (such as lm). I am a total newbie with regard to R, but not programming or GAs. I thought I would have to do this in R but now it seems there are ways to call R functions from Java after all. (C++ would work for me too, having a compiled language should speed up the program.) Are there recommended
2008 May 07
1
Automatically generating new column names (and columns)
Once again I need to tap into the collective knowledge here. Let's say I have the following columns and data below Y X1 X2 X3 X4 I would like to generate additional new columns and column names (ie the data would be squared - and I'd like the column names to reflect this) like: Y X1 X2 X3 X4 X1^2 X2^2 X3^2 X4^2 I believe I can compute the values correctly with the code below, but I
2009 Feb 18
2
how to randomly eliminate half the entries in a vector?
(sorry if this is a duplicate-problems with posting at my end) ---- Hello all, I need some help with a nice R-idiomatic and efficient solution to a small problem. Essentially, I am trying to eliminate randomly half of the entries in a vector that contains index values into some other vectors. More details: I am working with two strings/vectors of 0s and 1s. These will contain about 200
2010 Jan 10
1
lme4 and function 'cholmod_start' not provided by package 'Matrix' / Ubuntu
Hello all, Using Ubuntu 9.04 and R 2.8.1. For a project I need to use the Zelig package, which in turn wants to use the lme4 package. When trying to use Zelig and it tries to its required packages I get the following error message. Error in dyn.load(file, DLLpath = DLLpath, ...) : function 'cholmod_start' not provided by package 'Matrix' Error in loadModelDeps(model) :
2008 Jun 05
7
Improving data processing efficiency
Hi everyone! I have a question about data processing efficiency. My data are as follows: I have a data set on quarterly institutional ownership of equities; some of them have had recent IPOs, some have not (I have a binary flag set). The total dataset size is 700k+ rows. My goal is this: For every quarter since issue for each IPO, I need to find a "matched" firm in the same
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame. For instance > ddTable <- data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry")) I want a dataset that is Id Name 1 Paul 2 Bob > unique(ddTable) Will give me all 4 rows, and > unique(ddTable$Id) Will give me c(1,2), but not accompanied by the name column.
2008 May 20
0
recompute values repeatedly, or new file for glm()?
Hello all, I need to tap into the collective wisdom of the group re an issue of efficiency. A sketch of the situation: Let's say 4000 observations in variables Y, X1, X2 , X3 and X4. I would like to feed various combinations of this expression Y ~ X1+X2+X3+X4 + I(X1^2)+I(X2^2)+I(X3^2)+I(X4^2) + X1*X2 + X1*X3 + X1*X4 + X2*X3 + X2*X4 + X3*X4 repeatedly to glm(). (I really have little
2008 Apr 20
1
representing binary data for Genetic Algorithm in R
Hello all, I am trying to implement a simple Genetic Algorithm. I am doing this in R since I want access to the statistical functions (eg lm) it provides. I'm not new to programming, or GAs, but I am totally new to R (the package and the language), and I am hoping someone could help with these questions: 1. I am going to use a binary representation, it seems that vectors of Factors would