[R] A program running for a too long time

2013-02-27 Thread Aya Anas
Dear all, The attached code is supposed to minimize a numerical integration subject to a non linear constraint. The code runs for 2 days more without giving an output. Also, when i change the value of m-100 to m-1 it gives an output in areasonable period but with a message maximum number of

Re: [R] Merging value labels into indicator variable.

2013-02-27 Thread PIKAL Petr
Hi as far as result of operation is logical vector you can change it to numeric by simple multyplying by 1 or adding 0. It is treated as 0 when FALSE and 1 when TRUE. Regards Petr From: Tasnuva Tabassum [mailto:t.tasn...@gmail.com] Sent: Wednesday, February 27, 2013 10:16 AM To: PIKAL Petr;

Re: [R] How to avoid overlapping labels

2013-02-27 Thread Jim Lemon
On 02/27/2013 05:20 AM, john55 wrote: Hi Remko, thanks for your answer. but i do not really understand how to use the commands. if i want to use thigmophobe.labels(x,y,) do i need to identify the xy coordinates for each point first and then manually move every point? and if i neet to do so

Re: [R] temp seems ineffective in SANN (optim)

2013-02-27 Thread Patrick Burns
I don't have an answer for your real question, but you might try a different optimizer. The blog post: http://www.portfolioprobe.com/2012/07/23/a-comparison-of-some-heuristic-optimization-methods/ shows SANN to not do very well relative to other heuristic optimizers. That is for one problem,

Re: [R] cut a vector in equal parts

2013-02-27 Thread Patrick Burns
There is a discussion of the ways to do this task (which can be trickier than it seems) at: http://www.portfolioprobe.com/2012/12/24/miles-of-iles/ Pat On 26/02/2013 17:39, Martin Batholdy wrote: Hi, I would like to cut a vector of values in parts. Each part should have an equal number of

Re: [R] Count function calls

2013-02-27 Thread Simon Zehnder
Dear WIlliam, thank you very much for this very useful information! I learned something new! Enjoy your day! Simon On Feb 27, 2013, at 1:40 AM, William Dunlap wdun...@tibco.com wrote: This is where - is helpful: N - 0 ; trace(solve, quote(N - N + 1), print=FALSE) Tracing function solve

[R] lattice xyplot point labelling

2013-02-27 Thread maxbre
This is my reproducible example tv.ms-structure(list(inq = structure(4:17, .Label = c(D4, D5, D6a, D6b, D6c, D7, D8, F4, F5a, F5b, F6a, F6b, F6c, F6d, F7a, F7b, F8), class = factor), tv.km.median.iteq = c(0.324, 0.238, 0.242, 0.0801,

[R] Count function calls

2013-02-27 Thread Millo Giovanni
Hello. Another thing you may want to do depends on whether you are using model=within (the default) or model=random. In the first case, pvcm() estimates separate regressions, so you just need to loop lm() on individual indices to spot where it fails. In the second case, what you may want to do

Re: [R] metafor - interpretion of QM in mixed-effects model with factor moderator

2013-02-27 Thread Viechtbauer Wolfgang (STAT)
Please see my comments below. Best, Wolfgang -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Rachel Slatyer Sent: Wednesday, February 27, 2013 06:00 To: R-help@r-project.org Subject: [R] metafor - interpretion of QM in

Re: [R] cumulative sum by group and under some criteria

2013-02-27 Thread arun
dat1- read.table(text= m1 n1 m n    A  B    C   D 2    2    4  5  0.1    0.2  0.2 0.3 2   2 4  4  0.2   0.1   0.3  0.4 2   3 4  5  0.5   0.6   0.2  0.2 2  4  3  4  0.2   0.8   0.5  0.3 ,sep=,header=TRUE) dat1[which.max(dat1$D),] #  m1 n1 m n   A   B   C   D #2  2  2 4 4 0.2 0.1

[R] Choosing Grid points for computing Cumulative Incidence Function

2013-02-27 Thread Tasnuva Tabassum
I have a competing risk data where two risks: relapse and death can be considered as responsible for the failure of treatment. I want to find the cumulative incidence function for each of the risk, at 10 grid points. How can I choose the grid points from the continuous lifetime variable TIME?

[R] Finding the knots in a smoothing spline using nknots

2013-02-27 Thread Mike Nielsen
Hi r-helpers. Please forgive my ignorance, but I would like to plot a smoothing spline (smooth.spline) from package stats, and show the knots in the plot, and I can't seem to figure out where smooth.spline has located the knots (when I use nknots). Unfortunately, I don't know a lot about

[R] Integration

2013-02-27 Thread li li
Hi all, I defined the function integrand as follows. library(mnormt) integrand - function (rho, a, b,z, x, y){ Sigma - matrix(c(1, rho, rho, 1), 2,2) mu - rep(0,2) f - pnorm(c((z-a*x)/b, (z-a*y)/b), mu, Sigma)*dnorm(c(0,0), mu, diag(2)) f }

Re: [R] temp seems ineffective in SANN (optim)

2013-02-27 Thread Enrico Schumann
On Wed, 27 Feb 2013, Ross Boylan r...@biostat.ucsf.edu writes: I am trying to control the behavior of the SANN method in optim (R 2.14.1) via control$temp. In my toy tests it works; in my real use, it doesn't. As far as I can tell my code with different temp values is loaded; I even traced

Re: [R] What happened to financial package?

2013-02-27 Thread Keith Weintraub
Dr. R, Thanks for your help. I had already gotten the archive package and sourced the code. I was just wondering if there was a *best* way to make it a kind of local package. I hope this message is in plain text. I thought I changed my settings for this awhile ago. If there is still a

Re: [R] sys.frame() and variables from parent frame

2013-02-27 Thread David Winsemius
On Feb 27, 2013, at 1:11 AM, Zé Miguel wrote: Dear David, thanks for your reply. Sorry for the ambiguous example. I guess the get() will do it, but I still have a question regarding the parent frame. If I declare both function g and f in the global environment: g - function() {

Re: [R] sys.frame() and variables from parent frame

2013-02-27 Thread Bert Gunter
Some additional comments inline below to add to David's clarifications, proffered largely in response to the poster's remark about coming to R from another language. On Wed, Feb 27, 2013 at 9:44 AM, David Winsemius dwinsem...@comcast.net wrote: On Feb 27, 2013, at 1:11 AM, Zé Miguel wrote:

Re: [R] Finding the knots in a smoothing spline using nknots

2013-02-27 Thread David Winsemius
On Feb 27, 2013, at 6:39 AM, Mike Nielsen wrote: Hi r-helpers. Please forgive my ignorance, but I would like to plot a smoothing spline (smooth.spline) from package stats, and show the knots in the plot, and I can't seem to figure out where smooth.spline has located the knots (when I use

Re: [R] sys.frame() and variables from parent frame

2013-02-27 Thread David Winsemius
On Feb 27, 2013, at 10:16 AM, Bert Gunter wrote: Some additional comments inline below to add to David's clarifications, proffered largely in response to the poster's remark about coming to R from another language. On Wed, Feb 27, 2013 at 9:44 AM, David Winsemius dwinsem...@comcast.net

Re: [R] matrix multiplication

2013-02-27 Thread arun
HI Elisa, You can also use: mat2- head(mat1) resNew-do.call(cbind,lapply(seq_len(nrow(mat2)),function(i) do.call(rbind,lapply(split(rbind(mat2[i,],mat2[-i,]),1:nrow(rbind(mat2[i,],mat2[-i,]))),function(x) {x1-rbind(mat2[i,],x);

[R] Plotting multiple Zoo object lines

2013-02-27 Thread Ben Neal
I would like to plot multiple zoo object lines on one plot. These are time series of temperatures derived from different sampling regimes (one is sub-hourly, and the other is bi-weekly). I understand that they need to be indexed in the same way to be plotted together, and so took my two zoo

[R] Displaying two or more heatmaps on same device

2013-02-27 Thread ankita kumari
hello i am working with R to view two or more heatmaps in same pdf or png file in a column wise manner i.e side by side. But layout or mafrow option doesnt help me as it is only for plots. can you please help me out with this. Also how can i edit the heatmap.2 function ? Thankyou

Re: [R] sys.frame() and variables from parent frame

2013-02-27 Thread Zé Miguel
Dear David, thanks for your reply. Sorry for the ambiguous example. I guess the get() will do it, but I still have a question regarding the parent frame. If I declare both function g and f in the global environment: g - function() { get(N,envir = ???) write(N) } f-function() { N-99 g() } What

[R] best ordination method for binary variables

2013-02-27 Thread marco milella
Dear all, I'm analyzing a dataset (A) of 400 cases with 11 binary variables. Unfortunately, several (actually a lot) of cases are identical. NA are also present. I want to to plot distances between cases. For this, I obtained a distance matrix by dist(A, method=binary). I then analyzed the

[R] xyplot and barplot in the same page

2013-02-27 Thread Lisa Daniel
Dear Rhelp, I am trying to get multiple xyplots and barplots in the same page.  I couldn't get it work. Example code: library(lattice) library(grid) xy -xyplot(decrease ~ treatment, OrchardSprays,     main= Some plot,     groups = rowpos, type = a,    

Re: [R] matrix multiplication

2013-02-27 Thread arun
Hi, Just to add: res-do.call(cbind,lapply(seq_len(nrow(mat1)),function(i) {new1-do.call(rbind,lapply(seq_len(nrow(mat1[-i,])),function(j) {x1-rbind(mat1[i,],mat1[j,]);

[R] Separation issue in binary response models - glm, brglm, logistf

2013-02-27 Thread Xochitl CORMON
Dear all, I am encountering some issues with my data and need some help. I am trying to run glm analysis with a presence/absence variable as response variable and several explanatory variable (time, location, presence/absence data, abundance data). First I tried to use the glm() function,

Re: [R] matrix multiplication

2013-02-27 Thread arun
Hi, Try this: #mat1 is the data res-do.call(cbind,lapply(seq_len(nrow(mat1)),function(i) {new1-do.call(rbind,lapply(seq_len(nrow(mat1[-i,])),function(j) {x1-rbind(mat1[i,],mat1[j,]);

[R] question about read.ssd function

2013-02-27 Thread Wu, Juan
Hi there, I am trying to read SAS dataset into R and have observed some weird behaviors. Here is my setting. I copied retail.sas7bdat from sashelp and placed it in my test directory C:\Temp. In R, I submitted the following command read.ssd(C:/Temp, retail, sascmd=C:/Program

Re: [R] cumulative sum by group and under some criteria

2013-02-27 Thread Zjoanna
Hi, I need to change one or several parameters and run the same code several times, how to create a macro with parameters in R? On Wed, Feb 27, 2013 at 7:45 AM, arun kirshna [via R] ml-node+s789695n4659801...@n4.nabble.com wrote: dat1- read.table(text= m1 n1 m nA BC D 22

Re: [R] cutreeDynamic error

2013-02-27 Thread Joanna Papakonstantinou
Thank you, Peter. This worked. I appreciate your time and help. Regards, Joanna On Wed, Feb 27, 2013 at 1:21 AM, Peter Langfelder peter.langfel...@gmail.com wrote: On Tue, Feb 26, 2013 at 8:34 AM, Joanna Papakonstantinou joanna.p...@gmail.com wrote: So I realized I had to convert my

Re: [R] Error in J[time] : invalid subscript type 'closure'

2013-02-27 Thread MacQueen, Don
In my experience, error messages that include the word closure almost always mean that I have tried to do something with a function that isn't supposed to be done with a function (undoubtedly not a technically correct statement, but it works for me). I think that applies here, since time is a

Re: [R] Getting the correct factor level as Dunnett control in glht()

2013-02-27 Thread MacQueen, Don
I think you can probably specify the base level using the contrMat() function, which has a 'base=' argument. Disclaimer: This is a fragment from something I did recently, and is not intended to be reproducible by anyone else. Rather, it is intended to provide a hint as to how to use the

Re: [R] upgrading r-base

2013-02-27 Thread Dave Mitchell
Yes, I've added the appropriate repository to my sources.list file. I'm sorry, I should've mentioned I've followed everything in the tutorial you posted. Has anyone had issues the tutorial at http://cran.r-project.org/bin/linux/ubuntu/README couldn't solve? Thanks for your time. Dave Mitchell

Re: [R] Plotting multiple Zoo object lines

2013-02-27 Thread Gabor Grothendieck
On Wed, Feb 27, 2013 at 8:06 AM, Ben Neal bn...@spg.ucsd.edu wrote: I would like to plot multiple zoo object lines on one plot. These are time series of temperatures derived from different sampling regimes (one is sub-hourly, and the other is bi-weekly). I understand that they need to be

Re: [R] upgrading r-base

2013-02-27 Thread Jeff Newmiller
You have not followed the Posting Guide recommendations (and common sense) that would allow people to compare their configuration with yours. I have had no problem with Ubuntu 12.04 and R 2.15.2. You might consider trying a different R repository mirror.

Re: [R] lattice xyplot point labelling

2013-02-27 Thread Duncan Mackay
hi the bottom panel seems ok so for the top you supply a vector of positions that are your required positions (name eg posvec) to the panel function. may need to do the same for other functions to access the correct panel there is the ifelse statement posvec = c(...) panel = function(x,

[R] positioning of R windows

2013-02-27 Thread Glenn Stauffer
I have 2 (related, I think) questions about positioning of windows within R. 1. I often work with a second monitor and sometimes like to arrange 1 or more plot windows on the second monitor, while keeping the console on the primary monitor (so I can see things better). I used to be able to

Re: [R] How to specify ff object filepaths when reading a CSV file into a ff data frame.

2013-02-27 Thread strexxx
Really old subject…, so, all my apologizes for digging up but, since I also ran into this… maybe this hack can be useful to someone I propose monkey patching here: library(ff) my.as.ffdf.data.frame - function (x, vmode = NULL, col_args = list(), ...) { rnam - attr(x, row.names) if

Re: [R] cumulative sum by group and under some criteria

2013-02-27 Thread Jeff Newmiller
Read The Fine Manual... the document An Introduction to R is supplied with R, and section 10 discusses functions. (Macros are not supported.) Depending on what you want to parameterize, a review of indexing and lists (section 2.7, 5.3, and 6) is likely to be needed as well. This is a valuable

[R] Scraping data from website---Error in htmlParse: error in creating parser

2013-02-27 Thread Isaac Petersen
I'm trying to scrape football projections from accuscore.com for the different positions (right now the projections are set to zeros, but that will change). I can get the QB projections, but I can't get the projections for any of the other positions (e.g., RB). How can I get the RB projections?

Re: [R] upgrading r-base

2013-02-27 Thread Rolf Turner
On 02/28/2013 10:12 AM, Dave Mitchell wrote: Yes, I've added the appropriate repository to my sources.list file. I'm sorry, I should've mentioned I've followed everything in the tutorial you posted. Has anyone had issues the tutorial at http://cran.r-project.org/bin/linux/ubuntu/README

Re: [R] positioning of R windows

2013-02-27 Thread Duncan Murdoch
On 13-02-27 5:33 PM, Glenn Stauffer wrote: I have 2 (related, I think) questions about positioning of windows within R. 1. I often work with a second monitor and sometimes like to arrange 1 or more plot windows on the second monitor, while keeping the console on the primary monitor (so I

Re: [R] locating boxplot in bwplot (lattice)

2013-02-27 Thread Elaine Kuo
Hello, I used group in dotplot to classify diet by colors. Elaine On Mon, Feb 25, 2013 at 6:27 AM, Elaine Kuo elaine.kuo...@gmail.com wrote: Hello sorry that I did not make the letter clearly stated. Now I have 21 boxplots (No. 1, No. 2No. 21 from the left to the right)(lattice). I

[R] GMM for dynamic mdels: what if never passes Sargan test?

2013-02-27 Thread Tomas Note
Hi! I am looking for some insight with this situation: what to do or how to analyze when our models fitted with pgmm never pass Sargant test? With my current dataset, I've been fitting different models and with all possible combinations of lagged instruments, with all possible lag order

Re: [R] a similar question

2013-02-27 Thread arun
Dear Elisa, Try this: dat1- read.table(text=  V1    V2 1 1.939064 1.791503 2   1.670409 1.508740 3   2.641346   NA 4   2.772702   NA 5   3.401987   NA 6   2.323481 1.965391 7   2.135438 1.724173 8   2.404821   NA 9   3.273616   NA 10  2.058073   NA 11  2.711462   NA 12 

[R] predict.smooth.Pspline function not found

2013-02-27 Thread zoe richards
I have a simple question that irritatingly I haven't been able to figure out on my own. It seems that some functions from the Pspline package are successfully installed while others are not. The code with which I'm working is more complicated, but the following highlights my problem. If I run

Re: [R] repeating commands with varying arguments

2013-02-27 Thread David Winsemius
This is no longer a question for which the Subject is accurate. Please do not continue using inaccurate subject lines. On Feb 27, 2013, at 9:38 AM, Zjoanna wrote: Hi, I need to change one or several parameters and run the same code several times, how to create a macro with parameters in R?

Re: [R] predict.smooth.Pspline function not found

2013-02-27 Thread David Winsemius
On Feb 27, 2013, at 4:29 PM, zoe richards wrote: I have a simple question that irritatingly I haven't been able to figure out on my own. It seems that some functions from the Pspline package are successfully installed while others are not. The code with which I'm working is more

Re: [R] Efficient way to perform linear regressions

2013-02-27 Thread Nicole Ford
This page will tell you how to delete rows: https://stat.ethz.ch/pipermail/r-help/2007-November/146220.html I have used lm() with matrices, however, there maybe a more efficient method. I don't have the need for matrix functions, often. Hopefully, someone can direct you, if there is a more

Re: [R] Getting the correct factor level as Dunnett control in glht()

2013-02-27 Thread Andrew Koeser
Fantastic! Thanks, Don. I saw contrMat() and base option, but for whatever reason I didn't see how/if they fit together. Your help is greatly appreciated. Cheers, Andrew On 02/27/2013 03:07 PM, MacQueen, Don wrote: I think you can probably specify the base level using the contrMat()

Re: [R] Efficient way to perform linear regressions

2013-02-27 Thread Nicole Ford
I am sorry I realized your asking how to extract elements I hope this will -at least- put you in the right direction until someone else can help. http://data.princeton.edu/R/linearModels.html ~Nicole Ford Ph.D. Student Graduate Assistant/ Instructor Department of Government and

Re: [R] predict.smooth.Pspline function not found

2013-02-27 Thread David Winsemius
On Feb 27, 2013, at 6:18 PM, David Winsemius wrote: On Feb 27, 2013, at 4:29 PM, zoe richards wrote: I have a simple question that irritatingly I haven't been able to figure out on my own. It seems that some functions from the Pspline package are successfully installed while others are

Re: [R] merging or joining 2 dataframes: merge, rbind.fill, etc.?

2013-02-27 Thread Dennis Murphy
Hi: The other day I ran 100K simulations, each of which returned a 20 x 4 data frame. I stored these in a list object. When attempting to rbind them into a single large data frame, my first thought was to try plyr: library(plyr) bigD - ldply(L, rbind) # where L is the list object I quit at

Re: [R] positioning of R windows

2013-02-27 Thread Prof Brian Ripley
On 27/02/2013 22:33, Glenn Stauffer wrote: I have 2 (related, I think) questions about positioning of windows within R. 1. I often work with a second monitor and sometimes like to arrange 1 or more plot windows on the second monitor, while keeping the console on the primary monitor (so I

Re: [R] predict.smooth.Pspline function not found

2013-02-27 Thread Prof Brian Ripley
On 28/02/2013 00:29, zoe richards wrote: I have a simple question that irritatingly I haven't been able to figure out on my own. It seems that some functions from the Pspline package are successfully installed while others are not. The code with which I'm working is more complicated, but the

[R] Negative Binomial Regression - glm.nb

2013-02-27 Thread Martin Spindler
Dear all, I would like to ask, if there is a way to make the variance / dispersion parameter $\theta$ (referring to MASS, 4th edition, p. 206) in the function glm.nb dependent on the data, e.g. $1/ \theta = exp(x \beta)$ and to estimate the parameter vector $\beta$ additionally. If this is

Re: [R] Negative Binomial Regression - glm.nb

2013-02-27 Thread Prof Brian Ripley
On 28/02/2013 07:27, Martin Spindler wrote: Dear all, I would like to ask, if there is a way to make the variance / dispersion parameter $\theta$ (referring to MASS, 4th edition, p. 206) in the function glm.nb dependent on the data, e.g. $1/ \theta = exp(x \beta)$ and to estimate the