Re: [R] generating sets of parameters when some parameters are vectors

2012-11-27 Thread James Rudge
Not to worry, I just worked it out (seems obvious now, apologies). #Function for generating parameters genparms<-function() { list( x = c(runif(1,2,3),runif(1,2,3)) ,y = runif(1,2,3) ) } #Create N parameter sets N<- 10 set<-rep(list("NA"),N) for (i in 1:N) { set[[i]]<-genparms() } > From: j

Re: [R] Finding values in one column and

2012-11-27 Thread Berend Hasselman
On 27-11-2012, at 23:17, Steven Ranney wrote: > All - > > I have a data frame > > data.a > IDvalueA valueB > 6 12 12 > 1715 14 > 5818 16 > 9811 12 > 7319 20 > 8419 14 > 5820 14 > 2411 12 > 8115 16 > 2115

[R] generating sets of parameters when some parameters are vectors

2012-11-27 Thread James Rudge
I'm trying to generate N lists of randomly selected parameter values. Some of the parameters are vectors while other are single values. I've tried to use the approach below but it doesn't work for parameter x, which should be a vector. Thanks in advance! James #Define names of par

Re: [R] GLM Coding Issue

2012-11-27 Thread Steve Lianoglou
Hi Peter, On Tue, Nov 27, 2012 at 8:05 PM, Peter Ehlers wrote: > > On 2012-11-27 14:34, Steve Lianoglou wrote: [snip] > Steve: > re a matrix response: see MASS (the book, 4ed) page 191; also found > in the ch07.R file in the /library/MASS/scripts folder. I seem to > recall that this is mentioned

Re: [R] NRI or IDI for survival data - Hmisc package

2012-11-27 Thread Pascal Oettli
Hello, I have no knowledge of survival data analysis. But I have some skill in using a web search engine: http://cran.r-project.org/web/views/Survival.html http://cran.r-project.org/web/packages/survIDINRI/index.html Regards, Pascal Le 28/11/2012 10:22, array chip a écrit : Hi, I am trying

[R] zeros in double matrix rather than character matrix

2012-11-27 Thread iembry
Hi, how are you? I have 1000 total columns with 100 rows and I have shown 4 columns of 100 rows below. I want the zeros to be read in as numerical or integer values rather than a character. Right now I have a 100x0 character matrix rather than a 100x1000 double matrix. What do I need to do to re

Re: [R] error, R commends cannot show the expected output

2012-11-27 Thread Pascal Oettli
Hello, And what do you get? Regards, Pascal Le 28/11/2012 12:25, Jack Bryan a écrit : Hi, I am working on R 2.15.2 on Win. 7. I am trying to run some simple commends. class(SWX.RET) # SWX.RET is a data file that has been loaded. But, I cannot see the expected output. I have deselecte

[R] Fixed Effects using AER's Tobit function - system is singular

2012-11-27 Thread Jonathaneyer
I have an unbalanced panel of daily, county data that is naturally bounded at zero so my intention is to use a tobit. I'm using tobit from the AER package. There is cyclicality in the data for each pattern that I would like to control for before I add my variables of interest. I run the regression

[R] generating sets of parameters, when some parameters are vectors

2012-11-27 Thread James Rudge
Hello, I'm trying to generate N lists of randomly selected parameter values. Some of the parameters are vectors while other are single values. I've tried to use the approach below but it doesn't work for parameter x, which should be a vector. Thanks in advance! James #Define names

Re: [R] Plotting an adjusted survival curve

2012-11-27 Thread Brent Caldwell
Dear Terry and David Thank you so much for your rapid and helpful replies! I've changed tack slightly and decided to focus on the effect modifiers which had the greatest effect on the outcome of the trial (HowmanyZonnic_Q and WISDMPDM) I've tried to follow your example on page 16 of the manuscrip

Re: [R] GLM Coding Issue

2012-11-27 Thread Steve Lianoglou
Hi, On Tuesday, November 27, 2012, David Winsemius wrote: [snip] > `cbind`-ing doesn't make much sense here. What is your target (y) >> variable here? are you trying to predict `avoid` or `noavoid` status? >> > > Sorry, Steve. It does make sense. See : > > ?glm # First paragraph of Details. In

Re: [R] code optimisation problem

2012-11-27 Thread William Dunlap
Or try the filter() function (with convolutional filter rep(1/3,3)). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of cbe...@tajo.ucsd.edu > Sent: Tuesday, November 27,

Re: [R] error, R commends cannot show the expected output

2012-11-27 Thread Jack Bryan
Thanks ! I solved it. I run sink() to get the output on command line. > Date: Wed, 28 Nov 2012 12:35:39 +0900 > From: kri...@ymail.com > To: dtustud...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] error, R commends cannot show the expected output > > Hello, > > And what do you

[R] Help setting optimization problem to include more constraints

2012-11-27 Thread Jorge I Velez
Dear R-helpers, I am struggling with an optimization problem at the moment and decided to write the list looking for some help. I will use a very small example to explain what I would like to. Thanks in advance for your help. We would like to distribute resources from 4 warehouses to 3 destinatio

Re: [R] error, R commends cannot show the expected output

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 8:25 PM, Jack Bryan wrote: Hi, I am working on R 2.15.2 on Win. 7. I am trying to run some simple commends. class(SWX.RET) # SWX.RET is a data file that has been loaded. How was it loaded? But, I cannot see the expected output. What output do you see? What is

Re: [R] Can you turn a string into a (working) symbol?

2012-11-27 Thread andrewH
Dear Greg— You mean FAQ 7.21, not 7.22, correct? Though 7.12 also seems relevant. Though I would say I was asking about turning a string into an expression rather than a variable. At any rate, thanks for the pointer. I sure I would benefit from rereading the FAQ on a monthly basis, until I actuall

[R] error, R commends cannot show the expected output

2012-11-27 Thread Jack Bryan
Hi, I am working on R 2.15.2 on Win. 7. I am trying to run some simple commends. >class(SWX.RET) # SWX.RET is a data file that has been loaded. But, I cannot see the expected output. I have deselected "buffered output". Still it does not work. Any help will be appreciated. Thanks

Re: [R] Predict function in Raster package

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 2:33 PM, megmurr wrote: Hey, I am having troubles using the 'predict' function with in the Raster package. I am using pm<-predict(mm, predictors) where mm is the mahalanobis distance and the predictors are a stack of 6 raster layers containing environmental variables. Whe

Re: [R] GLM Coding Issue

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 3:34 PM, Steve Lianoglou wrote: Hi, Comments inline: On Tue, Nov 27, 2012 at 1:00 PM, Craig P O'Connell wrote: Dear all, I am having a recurring problem when I attempt to conduct a GLM. Here is what I am attempting (with fake data): First, I created a txt file, c

Re: [R] Can you turn a string into a (working) symbol?

2012-11-27 Thread andrewH
Dear Michael – This is _very_ interesting and I want to play around with the functions you suggest. I had no idea it was so easy to define assignment operators. However, one question: even after reading the “get” documentation and doing a bunch of mousing around for the expressions “pos” and “the

Re: [R] NRI or IDI for survival data - Hmisc package

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 6:22 PM, array chip wrote: Hi, I am trying to calculate net reclassification improvement (NRI) and Inegrated Discrimination Improvement (IDI) for a survival dataset to compare 2 risk models. It seems that the improveProb() in Hmisc package does this only for binary outc

Re: [R] Predict function in Raster package

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 2:33 PM, megmurr wrote: Hey, I am having troubles using the 'predict' function with in the Raster package. I am using pm<-predict(mm, predictors) where mm is the mahalanobis distance and the predictors are a stack of 6 raster layers containing environmental variables. Whe

Re: [R] problem with svyglm

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 2:31 PM, Pablo Menese wrote: Sorry, it send it alone... When I use it: logit <- glm(bach ~ egp4 + programa, weight=wst7, family=quasibinomial(link"logit")) I reach the same betas that in STATA, but the hypothesis test, the t value, and the std. error is different.

Re: [R] error of installing a R package on Win 7

2012-11-27 Thread David Winsemius
On Nov 27, 2012, at 9:17 AM, Jack Bryan wrote: Hi, I am trying to run R 2.15.2 on Win 7. I am trying to run some example R code of the book :Portfolio Optimization with R/Rmetrics I was told that : To install all packages required for the examples of this ebook we recommendthat you instal

Re: [R] loop command to matrix

2012-11-27 Thread arun
HI Eliza, No problem. You could also use: set.seed(5) mat1<-matrix(sample(1:400,80,replace=TRUE),ncol=8,nrow=10) library(plyr) resnew<-do.call(cbind,lapply(alply(mat1,2),function(x) x-colMeans(t(mat1)[!colnames(mat1)%in%names(alply(mat1,2))[match.call()[[2]][[3]]],]))) resprev<-t(do.call(rbind

[R] NRI or IDI for survival data - Hmisc package

2012-11-27 Thread array chip
Hi, I am trying to calculate net reclassification improvement (NRI) and Inegrated Discrimination Improvement (IDI) for a survival dataset to compare 2 risk models. It seems that the improveProb() in Hmisc package does this only for binary outcome, while rcorrp.cens() does take survival object, b

Re: [R] GLM Coding Issue

2012-11-27 Thread Peter Ehlers
On 2012-11-27 14:34, Steve Lianoglou wrote: Hi, Comments inline: On Tue, Nov 27, 2012 at 1:00 PM, Craig P O'Connell wrote: Dear all, I am having a recurring problem when I attempt to conduct a GLM. Here is what I am attempting (with fake data): First, I created a txt file, changed t

Re: [R] code optimisation problem

2012-11-27 Thread cberry
Rui Barradas writes: > Hello, > > Package 'compiler' is good at optimizing for loops. Try the following. > Or vectorize the function > system.time(f1(x,10)) user system elapsed 5.010.005.00 > system.time(f1.c(x,10)) user system elapsed 1.920.001.91 > f2 <- func

Re: [R] in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing

2012-11-27 Thread Duncan Murdoch
On 12-11-27 10:46 AM, Baoqiang Cao wrote: Hi, I'm trying to plot something in the following way and would like if you could help: I'd like in a same plot window, two plots are shown, the left one is a bird-view plot of the whole data, the right half keep changing, i.e., different plots will be

[R] Using factor variables with overlapping categories

2012-11-27 Thread andrewH
ear folks – I have a question, though it is more of a logic- or a good practices-question than a programming question per se. I am working with data from the American Community Survey summary file. It is mainly categorical count data. Currently I am working with about 40 tables covering about 35

Re: [R] code optimisation problem

2012-11-27 Thread Rui Barradas
Hello, Package 'compiler' is good at optimizing for loops. Try the following. #install.packages('compiler') library(compiler) f1.c <- cmpfun(f1) N <- 1e6 x <- rnorm(N) system.time(f1(x, 10)) user system elapsed 6.770.066.83 system.time(f1.c(x, 10)) user system elapsed 2.5

Re: [R] Books for fully understanding internal logics on some packages(quantmod, xts, zoo and chron)

2012-11-27 Thread Gabor Grothendieck
On Tue, Nov 27, 2012 at 2:41 PM, 박상규 wrote: > Hello, > > > I'm very interested in using financial time series data, but I'm a beginner > of R programming. > I'd like to fully understand internal logics on several time-series related > packages such as quantmod, xts, zoo, chron, etc. > So, I read

Re: [R] Finding values in one column and

2012-11-27 Thread Steven Ranney
Once I figured out the syntax of join() with the plyr package, it worked like a charm. Thanks again. SR Steven H. Ranney On Tue, Nov 27, 2012 at 3:49 PM, John Kane wrote: > Come to think of it the plyr package and the data.table packages also offer > similar tools. For large merges (joins) I

Re: [R] For-loop,string variables, and the $-operator

2012-11-27 Thread Rui Barradas
Hello, It's bad to use the subset operator '$' because you don't have a column named 'j'. Use data[[j]] Hope this helps, Rui Barradas Em 27-11-2012 21:22, Allan Schwade escreveu: Hi all, First time poster, so sorry if I commit some breech of posting etiquette. My problem is as follows. I h

[R] Predict function in Raster package

2012-11-27 Thread megmurr
Hey, I am having troubles using the 'predict' function with in the Raster package. I am using pm<-predict(mm, predictors) where mm is the mahalanobis distance and the predictors are a stack of 6 raster layers containing environmental variables. When I try to run the prediction I get the followin

Re: [R] problems with RPostgreSQL compilation

2012-11-27 Thread Tomas Lanczos
Thank You for Your answer.I have installed libpqxx 4.0.0 and its devel tools also. Regards Tomas On Thu, 2012-11-22 at 19:32 +0900, Pascal Oettli wrote: > Hello, > > Do you have the shared libraries required by PostgreSQL installed on > your machine (libpq)? > > Regards, > Pascal > > Le 22/

[R] Order function

2012-11-27 Thread maths123
I have a set of data with 2 columns: time, size. There are 20 sets of data. The data is looking at whether the size of a seed affects the time it takes to germinate. How do I then create a numerical variable called 'order' with values 1 to 20 in order to plot a graph or order against time? --

[R] code optimisation problem

2012-11-27 Thread 47
I'd like to write a function that has a vector and a (pos.) number as inputs and returns what is on the picture below (arithmetic means of (k) consecutive elements of a given vector). The problem is it works too slow for long vectors and i know it can be done without "for" loop. However, i've got n

[R] CCA plot

2012-11-27 Thread Maria Kernecker
Hi, I have a couple questions about fitting environmental (land use factors, plant species presence-absence, and soil variables) constraints to my CCA biplot. 1. After successfully plotting species and site scores in my CCA, I have been trying to insert the biplot arrows of the environmental constr

[R] For-loop,string variables, and the $-operator

2012-11-27 Thread Allan Schwade
Hi all, First time poster, so sorry if I commit some breech of posting etiquette. My problem is as follows. I have a data frame where each column represents a category and the individual data points in each category are binary responses (in this case they are actually 1's and 0's). What I want to

[R] Plot from a jpeg

2012-11-27 Thread bgnumis
Hi all, I know that I can for instance draw to plots in one using nf<-layout(matrix(c(1,2),1,2,byrow=FALSE)) Imagine I have 3 files: plot1.jpeg plot2.jpeg plot3.jpeg Anyone knows if I can read them and put on one colum and three rows reading directly from the jpeg file? Many Thanks [

Re: [R] Finding values in one column and

2012-11-27 Thread John Kane
Come to think of it the plyr package and the data.table packages also offer similar tools. For large merges (joins) I think the data.table package is much faster. John Kane Kingston ON Canada > -Original Message- > From: steven.ran...@gmail.com > Sent: Tue, 27 Nov 2012 15:28:57 -0700

Re: [R] Finding values in one column and

2012-11-27 Thread arun
Hi, Try ?merge(), ?join() from library(plyr) data.a<-read.table(text=" ID    valueA    valueB 6    12    12 17    15    14 58    18    16 98    11    12 73    19    20 84    19    14 58    20    14 24    11    12 81    15    16 21    15    14 62    14    12 67    13    14 78    13    17 35    10   

Re: [R] GLM Coding Issue

2012-11-27 Thread Steve Lianoglou
Hi, Comments inline: On Tue, Nov 27, 2012 at 1:00 PM, Craig P O'Connell wrote: > > > Dear all, > >I am having a recurring problem when I attempt to conduct a GLM. Here is > what I am attempting (with fake data): > First, I created a txt file, changed the directory in R (to the proper folde

Re: [R] Finding values in one column and

2012-11-27 Thread Steven Ranney
Thanks. Soon after I posted this question, I discovered merge(). Steven H. Ranney On Tue, Nov 27, 2012 at 3:26 PM, John Kane wrote: > Have a look at ?merge > > John Kane > Kingston ON Canada > > >> -Original Message- >> From: steven.ran...@gmail.com >> Sent: Tue, 27 Nov 2012 15:17:58 -

Re: [R] Finding values in one column and

2012-11-27 Thread John Kane
Have a look at ?merge John Kane Kingston ON Canada > -Original Message- > From: steven.ran...@gmail.com > Sent: Tue, 27 Nov 2012 15:17:58 -0700 > To: r-help@r-project.org > Subject: [R] Finding values in one column and > > All - > > I have a data frame > > data.a > IDvalueA value

Re: [R] R strange behaviour when building huge concatenation

2012-11-27 Thread John Kane
I am currently getting the very strange results that if I paste your orginal data from your first message into my R terminal I get the same errors you do. By the way that ";" is not needed in R. If I paste the same data into Rstudo, either into the editor or the console it works fine. If I pa

[R] Finding values in one column and

2012-11-27 Thread Steven Ranney
All - I have a data frame data.a ID valueA valueB 6 12 12 17 15 14 58 18 16 98 11 12 73 19 20 84 19 14 58 20 14 24 11 12 81 15 16 21 15 14 62 14 12 67 13 14 78 13

Re: [R] Some questions about chron package..

2012-11-27 Thread Jeff Newmiller
1. I am not aware of a difference, and don't know why the various forms were used. 2. That handles identifying the correct function to call based on the types of arguments supplied when the function was called. Read about the S4 object-oriented programming features to learn about method dispatc

Re: [R] Stuck trying to modify a function

2012-11-27 Thread Jean V Adams
Ben, You can use the sample() function to randomly add -1, 0, or 1 to each observation, and control for the probability of mutation at the same time. Then you can use the match() function to make sure that any mutations in X are carried through to Y in the same way. I wrote the function to do

Re: [R] Problems with weight

2012-11-27 Thread Milan Bouchet-Valat
Le mardi 27 novembre 2012 à 18:33 -0300, Pablo Menese a écrit : > I can't ... I don't know why but I can't > > When I use it: > > logit <- glm(bach ~ egp4 + programa, weight=wst7, > family=quasibinomial(link"logit")) You were advised to use svyglm(), not glm(). It's usually considered polite to r

Re: [R] Stuck trying to modify a function

2012-11-27 Thread Milan Bouchet-Valat
Le mardi 27 novembre 2012 à 16:45 +, Benjamin Ward (ENV) a écrit : > Hi, > > I have the following data: > > Path_Number <- 5 > ID.Path <- c(1:Path_Number) # Make vector of ID's. > No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) # > X <- split(sample(1:1, sum(No_of_X), replace=TRU

Re: [R] Problems with weight

2012-11-27 Thread Pablo Menese
I can't ... I don't know why but I can't When I use it: logit <- glm(bach ~ egp4 + programa, weight=wst7, family=quasibinomial(link"logit")) I reach the same betas that in STATA, but the hypothesis test, the t value, and the std. error is different. I think that the solution can't be so far fro

Re: [R] problem with svyglm

2012-11-27 Thread Pablo Menese
Sorry, it send it alone... When I use it: logit <- glm(bach ~ egp4 + programa, weight=wst7, family=quasibinomial(link"logit")) I reach the same betas that in STATA, but the hypothesis test, the t value, and the std. error is different. I think that the solution can't be so far from this...

Re: [R] problem with svyglm

2012-11-27 Thread Pablo Menese
I colud not, even without attach the dataset. The thing is, when I use this On Fri, Nov 23, 2012 at 5:56 PM, David Winsemius wrote: > > On Nov 23, 2012, at 12:08 PM, Pablo Menese wrote: > > I have this problem. >> >> test <- svydesign(id=~1,weights=~peso) >> >> logit <- svyglm(bach ~ job2 +

Re: [R] Books for fully understanding internal logics on some packages(quantmod, xts, zoo and chron)

2012-11-27 Thread Patrick Burns
One place to look would be the archives of the r-sig-finance list. A blog post with suggestions on how to achieve that is: http://www.portfolioprobe.com/2012/01/19/how-to-search-the-r-sig-finance-archives/ Pat On 27/11/2012 19:41, 박상규 wrote: Hello, I'm very interested in using financial ti

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Sarah Goslee > Sent: Tuesday, November 27, 2012 12:10 PM > To: Jack Bryan > Cc: r help > Subject: Re: [R] Error: R could not find "listDescription" > > The website given no longe

Re: [R] binning by frequency

2012-11-27 Thread William Dunlap
You might look at the 'mdlp' function in the 'discretization' package. (SPSS has a procedure called 'optimal binning' that uses the 'minimum description length principle' to do the binning.) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun..

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Rui Barradas
Hello, Inline. Em 27-11-2012 19:44, Rui Barradas escreveu: Hello, There are two packages with a function listDescription, package fBasics and package fUtilities. You probably need to install one of them, which I can tell. Sorry, it's obviously "can't" Rui Barradas install.packages('fUtil

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Sarah Goslee
The website given no longer exists. The usual first approach is to contact the author of the books to ask if there's a new location. You could also try installing fPortfolio directly from CRAN: install.packages("fPortfolio") Sarah On Tue, Nov 27, 2012 at 2:57 PM, Jack Bryan wrote: > Hi, > > Th

Re: [R] Some questions about chron package..

2012-11-27 Thread Rui Barradas
Hello, Inline. Em 27-11-2012 18:06, 박상규 escreveu: Hello, I have questions while reviewing "chron" package(e.g.,chron.R). 1. What is the differences between 3 kinds of function definition ? 1) "name" <- function(... 2) 'name' <- function(... 3) name <- function(... Do you know Why auth

Re: [R] binning by frequency

2012-11-27 Thread Santosh
Thanks for your response. Was wondering if there are any R functions/packages to perform optimal binning of continuous data. Thanks, again. Santosh. On Tue, Nov 27, 2012 at 9:09 AM, Mark Lamias wrote: > You might find the binning function in the sm package helpful here. > > --Mark Lamias > >

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Jack Bryan
Hi, Thanks for your reply. I am trying to run R 2.15.2 on Win 7. I am trying to run some example R code of the book :Portfolio Optimization with R/Rmetrics fPortfolio package is included in ebookPortfolio. >From the book, I was told that : To install all packages required for the exampl

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Sarah Goslee
Where did you get the document that tells you to use that code? Does it also tell you to load particular packages? www.rseek.org turns up a listDescription() function in the fBasics package, but that isn't necessarily the one you need for whatever application you're pursuing. Sarah On Tue, Nov 2

Re: [R] Error: R could not find "listDescription"

2012-11-27 Thread Rui Barradas
Hello, There are two packages with a function listDescription, package fBasics and package fUtilities. You probably need to install one of them, which I can tell. install.packages('fUtilities') # for instance, run this only once library(fUtilities) # load it into R session Hope this helps

[R] Books for fully understanding internal logics on some packages(quantmod, xts, zoo and chron)

2012-11-27 Thread 박상규
Hello, I'm very interested in using financial time series data, but I'm a beginner of R programming. I'd like to fully understand internal logics on several time-series related packages such as quantmod, xts, zoo, chron, etc. So, I read some books, 'R Cookbook' and 'Art of R Programming' and an

[R] Error: R could not find "listDescription"

2012-11-27 Thread Jack Bryan
Hi, I am running R on Win 7. I got error for > listDescription(fPortfolio) Error: could not find function "listDescription" What do I need to install for solving this ? Any help will be appreciated. Thanks [[alternative HTML version delet

[R] GLM Coding Issue

2012-11-27 Thread Craig P O'Connell
Dear all,    I am having a recurring problem when I attempt to conduct a GLM.  Here is what I am attempting (with fake data): First, I created a txt file, changed the directory in R (to the proper folder containing the file) and loaded the file: #avoid<-read.table("avoid.txt",header=TRU

Re: [R] aggregate() runs out of memory

2012-11-27 Thread Sam Steingold
> * Steve Lianoglou [2012-11-27 12:53:23 > -0500]: > On Tue, Nov 27, 2012 at 11:29 AM, Sam Steingold wrote: >>> * Steve Lianoglou [2012-11-26 19:47:25 >>> -0500]: > [snip] >>> It just occurred to me that this is even better: >>> >>> R> setkeyv(f, c("share.id", "delay")) >>> R> result <- f[, l

Re: [R] loop command to matrix

2012-11-27 Thread arun
HI, May be this helps you: set.seed(5) mat1<-matrix(sample(1:400,80,replace=TRUE),ncol=8,nrow=10)  split(mat1,col(mat1)) t(do.call(rbind,lapply(lapply(split(mat1,col(mat1)),function(x) cbind(matrix(x,ncol=1),mat1)),function(x){ res1<-rowMeans(t(apply(x,1,function(x) x[!(duplicated(x)|duplicated(

Re: [R] loop with date

2012-11-27 Thread Tagmarie
Sorry again, project is part of the rgdal package. Tagmarie -- View this message in context: http://r.789695.n4.nabble.com/loop-with-date-tp4650961p4651005.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] loop command to matrix

2012-11-27 Thread eliza botto
thanks rui!! how can it be that you advise something and it doesn't work :) eliza > Date: Tue, 27 Nov 2012 18:14:41 + > From: ruipbarra...@sapo.pt > To: eliza_bo...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] loop command to matrix > > Hello, > > Try > > x <- matrix(1:18, n

Re: [R] loop command to matrix

2012-11-27 Thread Rui Barradas
Hello, Try x <- matrix(1:18, ncol = 6) sapply(seq_len(ncol(x)), function(i) x[, i] - rowMeans(x[, -i])) Hope this helps, Rui Barradas Em 27-11-2012 17:51, eliza botto escreveu: Dear UseRs,Extremely sorry for a basic question. I have a matrix of 19 rows and 365 columns. what i want to do is

[R] Some questions about chron package..

2012-11-27 Thread 박상규
Hello, I have questions while reviewing "chron" package(e.g.,chron.R). 1. What is the differences between 3 kinds of function definition ? 1) "name" <- function(... 2) 'name' <- function(... 3) name <- function(... Do you know Why author used various kinds of definitions ? Is there no fu

Re: [R] aggregate() runs out of memory

2012-11-27 Thread Steve Lianoglou
Hi, On Tue, Nov 27, 2012 at 11:29 AM, Sam Steingold wrote: >> * Steve Lianoglou [2012-11-26 19:47:25 >> -0500]: [snip] >> It just occurred to me that this is even better: >> >> R> setkeyv(f, c("share.id", "delay")) >> R> result <- f[, list(min=delay[1L], max=delay[.N], count=.N, >> country=cou

Re: [R] R strange behaviour when building huge concatenation

2012-11-27 Thread Milan Bouchet-Valat
Le mardi 27 novembre 2012 à 07:04 -0800, angeloimm a écrit : > Hello John > It seems correct to me too but in my R console it seems to not be working > Here there is what I did: > i copied the statement on one row (leaving and removing the final useless > semi colomn) > i tried to execute it in the

[R] loop command to matrix

2012-11-27 Thread eliza botto
Dear UseRs,Extremely sorry for a basic question. I have a matrix of 19 rows and 365 columns. what i want to do is the following...First i want to leave out column number 1 and want to calculate the row wise mean of the remaining columns, which will obviously give me 365 values in one column, an

Re: [R] calling c function from R

2012-11-27 Thread Berend Hasselman
On 27-11-2012, at 17:21, Li Shangru wrote: > Hello > > I want to call C function from R. I follow the instruction below using the > example of foo.c > http://www.stat.umn.edu/~charlie/rc/ > > I saved the foo.c in my work directory. Then I entered the command > > R CMD SHLIB foo.c , I got the f

[R] Fitting and plotting a coxph with survfit, package(surv)

2012-11-27 Thread Maziar Mohaddes
Hi Dear R-users I have a database with 18000 observations and 20 variables. I am running cox regression on five variables and trying to use survfit to plot the survival based on a specific variable without success. Lets say I have the following coxph: >library(survival) >fit <- coxph(Surv(futime,

Re: [R] Help with graphics in gamm4 library

2012-11-27 Thread MurphFL
Thank you so much! I really appreciate the rapid response, and I was able to solve my issues with this advice! -- View this message in context: http://r.789695.n4.nabble.com/Help-with-graphics-in-gamm4-library-tp4650908p4650993.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] R strange behaviour when building huge concatenation

2012-11-27 Thread Jagat.K.Sheth
You probably hit a buffer limit in X11/xterm on your ubuntu machine with copy and paste. I get that behavior with Putty using your vector or when pasting (long) commands into Putty. If you really prefer copy and paste for this vector then try something like > eval(parse(text=scan("clipboard",

[R] Concordant und Discordant Paars of Logistic Regression

2012-11-27 Thread Marcus Tullius
Hallo there, can anymore show me how to get results about konkordant und diskordant paars (Sommer-D, Gudman-Krustal-Gama, Kendall-Tau-a) within a logistic regression) in R? Thanks a lot. MT [[alternative HTML version deleted]] __ R-help@r

Re: [R] Using cumsum with 'group by' ?

2012-11-27 Thread peter dalgaard
On Nov 27, 2012, at 14:30 , TheRealJimShady wrote: > Thanks everyone for your help. All good now. Once I'd got the data I > ended up doing this (replaced with real column names rather than the > fakes before). > > microaeth_data$date<-as.Date(microaeth_data$date_time,format="%Y-%m-%d > %H:%M:%S"

Re: [R] interactions in GAMs

2012-11-27 Thread Simon Wood
David, I think that the colorsex approach is the right one, and colorsex should initially be included as a main effect, because the smooths are centred for factor by variables (see e.g. ?gam.models). Whether you then choose to drop this main effect, as it appears to be non-significant, is a m

Re: [R] binning by frequency

2012-11-27 Thread Mark Lamias
You might find the binning function in the sm package helpful here. --Mark Lamias From: Santosh To: r-help Sent: Tuesday, November 27, 2012 9:59 AM Subject: [R] binning by frequency Dear Rxperts, is there way to identify intervals from continuous data (hav

[R] interactions in GAMs

2012-11-27 Thread chirleu
Hi all, I wonder if it's possible to include a double interaction in a GAM formula. Example: If I do this: mod=gam(energy~s(size, *by=color, by=sex*, k=5) + temperature, ...) I get the interaction betwen size*color and size*sex. But I need size*color*sex, being size a smoother. I've created a n

[R] Stuck trying to modify a function

2012-11-27 Thread Benjamin Ward (ENV)
Hi, I have the following data: Path_Number <- 5 ID.Path <- c(1:Path_Number) # Make vector of ID's. No_of_X <- sample(50:550, length(ID.Path), replace=TRUE) # X <- split(sample(1:1, sum(No_of_X), replace=TRUE), rep(ID.Path, No_of_X)) Y <- lapply(X,function(x) sample(x, round(runif(1, min=10, m

[R] R.dll problem during loading the package lme4

2012-11-27 Thread Prasenjit
Greetings, I am using R 2.14.1 and while loading package lme4 I am getting the error message: the procedure entry point R_Check_class_etc could not be located in the dynamic link library R.dll. Could anybody help me on this? Thanks and Regards, Roy -- View this message in context: http://r.789

[R] error of installing a R package on Win 7

2012-11-27 Thread Jack Bryan
Hi, I am trying to run R 2.15.2 on Win 7. I am trying to run some example R code of the book :Portfolio Optimization with R/Rmetrics I was told that : To install all packages required for the examples of this ebook we recommendthat you install the bundle package ebookPortfolio. This can be do

[R] calling c function from R

2012-11-27 Thread Li Shangru
Hello I want to call C function from R. I follow the instruction below using the example of foo.c http://www.stat.umn.edu/~charlie/rc/ I saved the foo.c in my work directory. Then I entered the command R CMD SHLIB foo.c , I got the following message Error: unexpected symbol in "R CMD" How d

Re: [R] install the ggplot2 package

2012-11-27 Thread Jonsson
I did upgrade but that did not solve the problem -- View this message in context: http://r.789695.n4.nabble.com/install-the-ggplot2-package-tp4650935p4650985.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailin

Re: [R] aggregate() runs out of memory

2012-11-27 Thread Sam Steingold
> * Steve Lianoglou [2012-11-26 19:47:25 > -0500]: > > On Monday, November 26, 2012, Sam Steingold wrote: > [snip] > >> >> there is precisely one country for each id. >> i.e., unique(country) is the same as country[1]. >> thanks a lot for the suggestion! >> >> > R> result <- f[, list(min=min(dela

Re: [R] loop with date

2012-11-27 Thread Tagmarie
Ok, sorry, I thought the more complex details might be confusing and nobody might answer. Here is something which looks more like my real dataframe and also what I want to do with it: That's my data frame: myframe <- data.frame (Timestamp=c("24.09.2012 09:00", "24.09.2012 10:00", "24.09.2012 1

Re: [R] Help with optimization problem

2012-11-27 Thread Berend Hasselman
Jorge, First of all, I really do think that questions such as these should be posted directly to R-help. More people will then see it with a greater chance of getting useful replies. I am subscribed to R-help so will see posts. I have cc'ed this reply to R-help so that you may get more answers

Re: [R] Accumulate objects in list after try()

2012-11-27 Thread Jean V Adams
Create an empty list called "result" before you run the loop. Then store the results of the loop in the list. For example: result <- vector(mode="list", length=1000) for(i in 1:1000){ result[[i]] <- try(harvest(i)) } Jean mdvaan wrote on 11/27/2012 12:09:38 AM: > > Hi, >

Re: [R] glm convergence warning

2012-11-27 Thread Jean V Adams
It could be that for some levels of your independent factor variables (WS, SS), the response is either all zeroes or all ones. Or, for your continuous independent variables (DV, DS), there is a clean break between the zeroes and ones. For example, if all the CIDs are one when DS <= 18 but all

[R] best HDF5 package: h5r or rhdf5?

2012-11-27 Thread Johann Hibschman
What is the current best package for manipulating HDF5 data files? I tried "hdf5" a long time ago, but I ran into memory problems. "h5r" is on CRAN now, and "rhdf5" is part of bioconductor. Ideally, I'd like to read simple vectors or tables, either the entire thing or a subset of rows. I don't ne

Re: [R] binning by frequency

2012-11-27 Thread Rui Barradas
Hello, I'm not sure I ubderstand but, h <- hist(b1,brea=100) which.max(h$counts) # max frequency findInterval(b1, h$breaks) Hope this helps, Rui Barradas Em 27-11-2012 14:59, Santosh escreveu: Dear Rxperts, is there way to identify intervals from continuous data (having some kind of a pa

[R] in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing

2012-11-27 Thread Baoqiang Cao
Hi, I'm trying to plot something in the following way and would like if you could help: I'd like in a same plot window, two plots are shown, the left one is a bird-view plot of the whole data, the right half keep changing, i.e., different plots will be shown up on request, so that when I select/c

Re: [R] confidence intervals with glmmPQL

2012-11-27 Thread Sally_roman
Hi - Thanks for the reply. I provided answers below. Sally Sally_roman umassd.edu> writes: > Hi - I am using R version 2.13.0. I have run several GLMMs using > the glmmPQL function to model the proportion of fish caught in one > net to the total caught in both nets by length. I started with

  1   2   >