Re: [R] Time out for a R Function

2010-12-06 Thread Prof Brian Ripley
On Tue, 7 Dec 2010, Santosh Srinivas wrote: Hello Group, I have an R-function that works fine for most part but sometime runs into a long loop! (I'm lazy and short on time to debug right now so want to do something easy) For my purpose, it is ok to make few errors is there a way I can put

Re: [R] Time out for a R Function

2010-12-06 Thread Henrik Bengtsson
See also R help thread 'Wait for keystroke or timeout': http://www.mail-archive.com/r-help@r-project.org/msg97742.html /H On Mon, Dec 6, 2010 at 9:11 PM, Michael Bedward wrote: > Below is a toy function with one way of doing it. There are bound to > be better ways :) > > function(niter = 10, ti

Re: [R] R cmd batch with parameters

2010-12-06 Thread Ryan Garner
http://projects.uabgrid.uab.edu/r-group/wiki/CommandLineProcessing -- View this message in context: http://r.789695.n4.nabble.com/R-cmd-batch-with-parameters-tp3075376p3075587.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-p

Re: [R] Controlling print width settings for 'print' on command line

2010-12-06 Thread Joshua Wiley
Hi Matt, I'm not certain if this will work with PuTTy, but in general (and on Konsole/other terminals I've run R in) you can set it with the "width" argument of options() see: ?options I believe it is 80 by default, so something like: options(width = 160) might be about right. Cheers, Josh

Re: [R] Controlling print width settings for 'print' on command line

2010-12-06 Thread Matthew Pettis
Worked perfect, thank you very much! Matt On Mon, Dec 6, 2010 at 11:53 PM, Joshua Wiley wrote: > Hi Matt, > > I'm not certain if this will work with PuTTy, but in general (and on > Konsole/other terminals I've run R in) you can set it with the "width" > argument of options() see: > > ?options >

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread Sunny Srivastava
Thank you for the help. Much appreciated. On Mon, Dec 6, 2010 at 9:12 PM, Hadley Wickham wrote: > It's easiest to see what's going on if you use eval.quoted directly: > > eval.quoted(.(cyl), mtcars) > eval.quoted(.("cyl"), mtcars) > eval.quoted(.(as.name("cyl")), mtcars) > > But you shouldn't ne

[R] Controlling print width settings for 'print' on command line

2010-12-06 Thread Matthew Pettis
Hi, I'm using R interactively from a PuTTy command line, and when I print a dataframe (default, but just entering the name of the data frame), the display is using only half of the available horizontal width in which to print columns. How to I tell R how many columns it can/should use for printin

Re: [R] Time out for a R Function

2010-12-06 Thread Michael Bedward
Below is a toy function with one way of doing it. There are bound to be better ways :) function(niter = 10, time.out = 3) { pretend.task <- function() { Sys.sleep(0.5) } start <- proc.time() for (iter in 1:niter) { pretend.task() cur <- proc.time() - start if (c

Re: [R] Need help Upgrading to R version >=v2.11 on Ubuntu Hardy Heron (8.04 LTS)

2010-12-06 Thread Matthew Pettis
Sorry, solved by me RTFM... The directions pertaining to what I needed to do are found here: http://cran.r-project.org/bin/linux/ubuntu/ Sorry to bother y'all, Matt On Mon, Dec 6, 2010 at 10:57 PM, Matthew Pettis wrote: > Hi, > > I'd like to use ggplot2, which I think works best on some R releas

[R] Need help Upgrading to R version >=v2.11 on Ubuntu Hardy Heron (8.04 LTS)

2010-12-06 Thread Matthew Pettis
Hi, I'd like to use ggplot2, which I think works best on some R release >=v2.11 or so. However, with Ubuntu Hardy Heron 8.04 LTS, 'aptitude' packages show me only a version for 2.6. Can I install more recent version on this Ubuntu version, and if so, what is the most painless way to do this (is

Re: [R] less than full rank contrast methods

2010-12-06 Thread Frank Harrell
Given a non-singular fit, the contrast function in the rms package will allow you to request multi-dimensional contrasts some of which are redundant. These singular contrasts are automatically ignored. One use for this is to test for differences in longitudinal trends between two of three treatm

[R] Is there any function can perform "outer lapply" ?

2010-12-06 Thread Julian TszKin Chan
I built my own "outer lapply " as attached code. Is there any R build-in function can do the same jobs ? Thanks oapply<-function(X,Y,FUN, ..., MoreArgs = NULL, SIMPLIFY = TRUE, USE.NAMES = TRUE){ x=rep(X,each=length(X)) y=rep(Y,times=length(Y)) mapply(FUN,x,y, MoreArgs =

Re: [R] Using nlminb for maximum likelihood estimation

2010-12-06 Thread Ben Bolker
Joonas - as_trix85 hotmail.com> writes: > > > I'm trying to estimate the parameters for GARCH(1,1) process. > Here's my code: > > loglikelihood <-function(theta) { > > h=((r[1]-theta[1])^2) > p=0 > > for (t in 2:length(r)) { > h=c(h,theta[2]+theta[3]*((r[t-1]-theta[1])^2)+theta[4]*h[t-1]) >

Re: [R] ggplot2: Controlling line width of panel borders

2010-12-06 Thread Dennis Murphy
Hi: You might find this link useful: https://github.com/hadley/ggplot2/wiki/%2Bopts%28%29-List ...and apropos your choice of plot, http://emdbolker.wikidot.com/blog:dynamite Cheers, Dennis On Mon, Dec 6, 2010 at 2:46 PM, Henning Wildhagen wrote: > Dear R-users, > > i encountered some problems

[R] Using nlminb for maximum likelihood estimation

2010-12-06 Thread Joonas - as_trix85
I'm trying to estimate the parameters for GARCH(1,1) process. Here's my code: loglikelihood <-function(theta) { h=((r[1]-theta[1])^2) p=0 for (t in 2:length(r)) { h=c(h,theta[2]+theta[3]*((r[t-1]-theta[1])^2)+theta[4]*h[t-1]) p=c(p,dnorm(r[t],theta[1],sqrt(h[t]),log=TRUE)) } -sum(p) } The

Re: [R] How can I refer to actual (n) and previous (n-1) elements in a vector?

2010-12-06 Thread Dennis Murphy
Hi: This is called a 'rolling sum', for which there is a very convenient function called rollapply() in the zoo package. You first need to convert v to a zoo object (in this case, an indexed vector): library(zoo) > rollapply(zoo(v), 2, FUN = sum) 1 2 3 4 5 6 7 8 9 9 14 9 2 4 12 14 11

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread Hadley Wickham
It's easiest to see what's going on if you use eval.quoted directly: eval.quoted(.(cyl), mtcars) eval.quoted(.("cyl"), mtcars) eval.quoted(.(as.name("cyl")), mtcars) But you shouldn't need to do any syntactic hackery because the default method automatically parses the string for you: eval.quoted

[R] Time out for a R Function

2010-12-06 Thread Santosh Srinivas
Hello Group, I have an R-function that works fine for most part but sometime runs into a long loop! (I'm lazy and short on time to debug right now so want to do something easy) For my purpose, it is ok to make few errors is there a way I can put a timeout on a function and the r-process neede

Re: [R] Downloading a .csv through a .jsp url with variable parameters - R code or package?

2010-12-06 Thread Arsenio Staer
So i realized putting this raw.untr <- as.data.frame(read.csv(file='...jsp?y=2008&m=09&d=30', header = TRUE, as.is = TRUE)) reads the file prefectly, so i was wondering how can i create a set of dataframes each with observations for one day (say for 3 years with 250 days of data each year =

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread Sunny Srivastava
Hi Hadley: I was trying to use ddply using the format . (var1) for splitting. I thought . ( as.name(grp) ) would do the same thing. But it does not. I was just trying to know my mistake. I am sorry if it is a basic question. Thank you and others for your reply. Best Regards, S. On Mon, Dec 6,

[R] followup to "pass operator to function"

2010-12-06 Thread Carl Witthoft
In case anyone even remembers that thread, there was a little problem w/ some of the solutions provided because here and there are unary rather than binary operators or functions. So, I took two of the responses and fixed them up: dc<-function(op='+',...) do.call(op,list(...)) or dcc<-funct

[R] Apparent problem with coxph

2010-12-06 Thread lhunsicker
Good evening, folks: I am trying to run a bootstrap on a CoxPH regression. I have set up a 1,000 x 1,000 matrix of "cases" and am running 1,000 analyses of 1,000 cases each. The loop keeps breaking because of an error, and I have more or less isolated the problem to a call of the coxph functi

Re: [R] How to formulate constraint like abs(x) = y in constrOptim (or other)

2010-12-06 Thread Ravi Varadhan
Hi Benjamin, If you just had abs(x_i) < c_i, it will reduce to linear inequalities, but your constraint cannot be reduced to that. You might try "alabama" or "Rsolnp" packages. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of Ge

[R] ggplot2: Controlling line width of panel borders

2010-12-06 Thread Henning Wildhagen
Dear R-users, i encountered some problems when trying to adjust the line width of the axes and stripes in a plot created with ggplot2. I use the "barley" dataset of the lattice package to illustrate my problem: library(ggplot2) library(lattice) barley[["SD"]] <- 5 limits <- aes(ymax=barley$yie

[R] Please help with write.foreign(SPSS)

2010-12-06 Thread He
Dear all, I get stuck when i try to export the data into SPSS format/file using "write.foreign()" Do you know how to do it exactly? What i have done is 1) First i type the following code in R: df<-data.frame(id,year,res1) names(df)<-c("idcode","year","resarrvl") write.foreign(df,"z:/daten/res.da

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread Hadley Wickham
On Mon, Dec 6, 2010 at 3:58 AM, Sunny Srivastava wrote: > Dear R-Helpers: > > I am using trying to use *ddply* to extract min and max of a particular > column in a data.frame. I am using two different forms of the function: > > > ## var_name_to_split is a string -- something like "var1" which is t

Re: [R] Cutting Matrix

2010-12-06 Thread jim holtman
With the result of the 'cut' you can get a direct index for the values: > x <- runif(20) > x [1] 0.26550866 0.37212390 0.57285336 0.90820779 0.20168193 0.89838968 0.94467527 0.66079779 0.62911404 [10] 0.06178627 0.20597457 0.17655675 0.68702285 0.38410372 0.76984142 0.49769924 0.71761851 0.991906

Re: [R] Appearance of Forest Plot

2010-12-06 Thread Joshua Wiley
Hi, Can you give a reproducible example of what you did? My intuition is that you could do it using par(), but I am not sure what package metabin() is from (certainly none of the ones that load by default), and I have even less idea how you created a forest plot (there are many ways in R). If yo

[R] Appearance of Forest Plot

2010-12-06 Thread steph306
Hi All, I have conducted a meta analysis using the metabin function. I want to plot 5 subgroups on the same forest plot. I have managed to do this using the byvar argument but when i plot the forest plot in R graphics I am unable to view the very top and very bottom of the image. It is as though

Re: [R] Troubles in plotting to a postscript file (not to png)

2010-12-06 Thread Paul Murrell
Hi I think the problem is that the viewer you are using for the PS file cannot find the ComputerModern fonts that are referenced in the PS file. If you use something like ghostscript to process the file you can see this happening ... [pmur...@stat18 Temp]$ gs plot_example.ps ESP Ghostscript

[R] Help with plit plot design in logit model

2010-12-06 Thread Dilan Paranagama
Hi, I'm trying to fit a logit model to a set of data that was collected under a split plot scheme. The structure of the data is Whole plot factors: Watering Frequency (2 levels: Hi/Lo) and Fertilizer type (3 factors A/B/C) Subplot factor: slope type (2 factors up/down) Response: Proportion of

[R] R cmd batch with parameters

2010-12-06 Thread AniaK
hello! I'm trying to make a very simple calculation using R that would called from bash with two parameters, the names of the input and output files. the first one is just an 4 by 100 numerical table- the function finds the index of the maximal elements in each columns and writes it into the outpu

Re: [R] waldtest and nested models - poolability (parameter stability)

2010-12-06 Thread Achim Zeileis
On Mon, 6 Dec 2010, Roberto Patuelli wrote: Dear Achim, Thanks a lot for the superquick reply! Somehow with your suggestion I can get around the problem, but of course I run into other problems, such as this: waldtest(inv.log.leva.base, inv.log.leva, test = "Chisq", vcov = sandwich) Error

Re: [R] waldtest and nested models - poolability (parameter stability)

2010-12-06 Thread Roberto Patuelli
Dear Achim, Thanks a lot for the superquick reply! Somehow with your suggestion I can get around the problem, but of course I run into other problems, such as this: waldtest(inv.log.leva.base, inv.log.leva, test = "Chisq", vcov = sandwich) Error in bread. %*% meat. : non-conformable argument

Re: [R] waldtest and nested models - poolability (parameter stability)

2010-12-06 Thread Achim Zeileis
On Mon, 6 Dec 2010, Roberto Patuelli wrote: Dear All, I'm trying to use waldtest to test poolability (parameter stability) between two logistic regressions. Because I need to use robust standard errors (using sandwich), I cannot use anova. anova has no problems running the test, but waldtest

Re: [R] read ESRI file geodatabase feature classes

2010-12-06 Thread Michael Sumner
No there is no open software to read ESRI "file geodatabases" (the .gdb ones). If it's not .gdb but .mdb ("personal geodatabase", built on Microsoft Access database) then you can read it with generic tools (such as RODBC package) or with an appropriate build of GDAL as part of the rgdal package.

Re: [R] mgcv package plot superimposing smoothers

2010-12-06 Thread Jannis
Hi Jef, I would extract the information about the smoothers and plot them using standard plotting routines. After Mtest <- gam(outcome ~ s(age, by=as.numeric(gender==0)) + s(age,by=as.numeric(gender==1))+factor(Gender)) run something similar to: smoothers <- predict(s,type='terms') and you

Re: [R] use pcls to solve least square fitting with constraints

2010-12-06 Thread Ben Bolker
Baoqiang Cao gmail.com> writes: > I have a least square fitting problem with linear inequality > constraints. pcls seems capable of solving it so I tried it, > unfortunately, it is stuck with the following error: > > M <- list() > > M$y = Dmat[,1] > > M$X = Cmat > > M$Ain = as.matrix(Amat) > > M$

[R] waldtest and nested models - poolability (parameter stability)

2010-12-06 Thread Roberto Patuelli
Dear All, I'm trying to use waldtest to test poolability (parameter stability) between two logistic regressions. Because I need to use robust standard errors (using sandwich), I cannot use anova. anova has no problems running the test, but waldtest does, indipendently of specifying vcov or not

Re: [R] getting the exact p value

2010-12-06 Thread Joshua Wiley
Hi, It depends on the function used to calculate it---each has their own way of extracting particular values. Here's an example for t.test: x <- rnorm(10, 100, .1); y <- x - 100 t.test(x, y)$p.value You could find this yourself by looking at the documentation for t.test() ?t.test The heading

Re: [R] Cutting Matrix

2010-12-06 Thread Marty_H
In this case I only get three values back. My intention was to get every value between 10% and 90% i.e. let's say i have a matrix 1 2 3 4 5 6 7 8 9 10 11 12 i only want the values above 10% and under 90%. Maybe i should try it with a loop. -- View this message in context: http://r.789695.n4.

[R] Loglinear models for missing data

2010-12-06 Thread fbielejec
Dear, I have the data in the following form: >head(matrices_m) Location Variable Value Week 1 Africa Africa21 4 weeks 2 Asia Africa 0 4 weeks 3 Canada Africa17 4 weeks 4China Africa29 4 weeks 5 Europe AfricaNA 4 weeks 6Japan Africa68 4 week

[R] read ESRI file geodatabase feature classes

2010-12-06 Thread Al Kirschbaum
Hello- Does anyone know if R can read in ESRI file geodatabase feature classes, directly from the file geodatabase? I currently have to export the data out of Arc, to a csv file, then read the csv file. I'd like to bypass this step and read directly from the file geodatabase. Thanks for your help

[R] getting the exact p value

2010-12-06 Thread kayj
I was wondering if there is a way to get an exact p-value at times where R gives me just a range . for example t.test(x,y) p-value < 2.2e-16 thanks, -- View this message in context: http://r.789695.n4.nabble.com/getting-the-exact-p-value-tp3075107p3075107.html Sent from the R help mailing l

Re: [R] Perl "cut" equivalent in R

2010-12-06 Thread Steve Lianoglou
>> if(FALSE) { >> stuff your don't want executed >>          } >> > > Switching a block of code off/on with editing a single character > may be done using 0/1 instead of FALSE/TRUE. Or even F/T -- Steve Lianoglou Graduate Student: Computational Systems Biology  | Memorial Sloan-Kettering Cancer

Re: [R] book about "support vector machines"

2010-12-06 Thread Steve Lianoglou
Hi, On Fri, Dec 3, 2010 at 10:23 AM, manuel.martin wrote: > Dear all, > I am currently looking for a book about support vector machines for > regression and classification and am a bit lost since they are plenty of > books dealing with this subject. I am not totally new to the field and > would l

Re: [R] Sparse matrix performance question

2010-12-06 Thread scott white
Btw, forgot to mention I am using the standard Matrix package and I am running version 2.10.1 of R. On Mon, Dec 6, 2010 at 11:04 AM, scott white wrote: > I have a very sparse square matrix which is < 20K rows & columns and I am > trying to row standardize the matrix for the rows that have non-mis

Re: [R] package ca/rgl for ubuntu?

2010-12-06 Thread Manderscheid Katharina
thanks a lot, duncan for that super-fast reply and help! i could install rgl via synaptic and afterwards ca in R directly. and it works! :-) have a nice evening, kat Von: Duncan Murdoch [murdoch.dun...@gmail.com] Gesendet: Montag, 6. Dezember 2010 19:55 An

[R] Sparse matrix performance question

2010-12-06 Thread scott white
I have a very sparse square matrix which is < 20K rows & columns and I am trying to row standardize the matrix for the rows that have non-missing value as follows: row_sums <- rowSums(M,na.rm=TRUE) nonzero_idxs <- which(row_sums>0) nonzero_M <- M[nonzero_idxs,]/row_sums[nonzero_idxs] M[nonzero_idx

Re: [R] package ca/rgl for ubuntu?

2010-12-06 Thread Duncan Murdoch
On 06/12/2010 1:45 PM, Manderscheid Katharina wrote: hi, for some unknown reason i cannot install the package ca in R running in a ubuntu mint system. i keep getting the following error message: You need the development package for OpenGL or MesaGL to install rgl. I don't know Ubuntu so I do

[R] package ca/rgl for ubuntu?

2010-12-06 Thread Manderscheid Katharina
hi, for some unknown reason i cannot install the package ca in R running in a ubuntu mint system. i keep getting the following error message: configure: error: missing required header GL/gl.h ERROR: configuration failed for package ‘rgl’ * removing ‘/home/kat/R/i486-pc-linux-gnu-library/2.12/rgl’

Re: [R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-06 Thread Mike Williamson
Ista, Thanks for this method, it works! Unfortunately 'R' still spits everything out to std out, but the variable as you describe below grabs only the final output variable, similar to how functions or scripts work internally within 'R'. Thanks! Kjetil, Thanks also for your input, but

Re: [R] less than full rank contrast methods

2010-12-06 Thread Greg Snow
Have you tried setting singular.ok=TRUE in the call to lm? This will start with the full set of contrasts, but only fit those that it is able to. Otherwise you can set specific contrasts or subsets using the C (note case) or contrasts functions. -- Gregory (Greg) L. Snow Ph.D. Statistical Dat

Re: [R] Cutting Matrix

2010-12-06 Thread jim holtman
You can use quantile and cut: > x <- runif(1000) > x.cut <- cut(x, c(-Inf, quantile(x, prob=c(.1, .9)), Inf), > labels=c('lo','mid','hi')) > table(x.cut) x.cut lo mid hi 100 800 100 > On Mon, Dec 6, 2010 at 12:53 PM, Marty_H wrote: > > I have got a matrix with 100 values. > Is there a easy w

Re: [R] Tukey Test, lme, error: less than two groups

2010-12-06 Thread Lilith
Hi Steven, thank you again so much for your help and for the transformation of the data. In fact I knew that there are these empty lines in the data. I couldn't take them off with the program I have. I tried to solve this problems with using the "levels". You are right, the statistical tests a

Re: [R] How to formulate constraint like abs(x) = y i n constrOptim (or other)

2010-12-06 Thread Hans W Borchers
Benjamin B. googlemail.com> writes: > Hello list reader, > > I am trying to form some constraints for an optimization I am working on. > I think I have understand the use of the constraints in matrix form. I use > them like: > > [...] > > Now I would like to formulate a constraint like > > Su

Re: [R] Optimize multiple variable sets

2010-12-06 Thread Hans W Borchers
peter dalgaard gmail.com> writes: > > On Dec 6, 2010, at 15:15 , Jonathan P Daily wrote: > > > Correct me if I'm wrong, but isn't the minimal x value in your example > > the same regardless of what positive coefficient you apply to x? If that > > is the case, you would expect the same min(x) for

Re: [R] Quadratic programming with semi-definite matrix

2010-12-06 Thread Hans W Borchers
Andreas Jensen gmail.com> writes: > Hello. > > I'm trying to solve a quadratic programming problem of the form min > ||Hx - y||^2 s.t. x >= 0 and x <= t using solve.QP in the quadprog > package but I'm having problems with Dmat not being positive definite, > which is kinda okay since I expect it

[R] Cutting Matrix

2010-12-06 Thread Marty_H
I have got a matrix with 100 values. Is there a easy way to cut the upper 10% (every value which is above 90%) and the lower 10% of my matrix-values away and create a new matrix with all the rest. Thx for your help Marty -- View this message in context: http://r.789695.n4.nabble.com/Cutting-Ma

Re: [R] book about "support vector machines"

2010-12-06 Thread Mark Leeds
hi: i don't know that book but there's another pretty new book on svms by lutz hamel. It's pretty gentle but very nice, especially if you have ZERO background on svms. there's also another one titled "an introduction to svms" by cristianini and shawne-taylor that's also quite good but much more de

Re: [R] Optimize multiple variable sets

2010-12-06 Thread Ravi Varadhan
Let us look at the objective function: f(x) = x^2 + Si * x, where Si is the sum of the i-th column. This function has a stationary point at x = -Si/2, and the second derivative is 2, so it is a minimum. Now, the column sums of your data matrix are all positive. So, your minimum has to be negati

Re: [R] book about "support vector machines"

2010-12-06 Thread David Reinke
My favorite book on SVM is Learning with Kernels by Scholkopf and Smola. You might also want to consider a relevance vector machine, which is a more recent development. RVM is Bayesian-based and usually produces a sparser representation than a SVM. Check out Mike Tipping's web site at http://www

Re: [R] How can I refer to actual (n) and previous (n-1) elements in a vector?

2010-12-06 Thread Sarah Goslee
Hi Marianne, You have to be very careful with subsetting when doing something like that - that's where you went wrong with your original construct. This version works: > v<-c(3,6,8,1,1,3,9,5,6,3) > a <- numeric(length(v)-1) > for (i in 2:length(v)) {a[i-1] <- v[i-1] + v[i]} > a [1] 9 14 9 2 4

Re: [R] How can I refer to actual (n) and previous (n-1) elements in a vector?

2010-12-06 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Nordlund, Dan (DSHS/RDA) > Sent: Monday, December 06, 2010 9:21 AM > To: r-help@r-project.org > Subject: Re: [R] How can I refer to actual (n) and previous (n-1) > elements in a v

Re: [R] How can I refer to actual (n) and previous (n-1) elements in a vector?

2010-12-06 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Marianne Stephan > Sent: Monday, December 06, 2010 9:13 AM > To: r-help@r-project.org > Subject: [R] How can I refer to actual (n) and previous (n-1) elements > in a vector? > >

[R] How can I refer to actual (n) and previous (n-1) elements in a vector?

2010-12-06 Thread Marianne Stephan
Hello, How can I apply a function on a vector that refers to actual (n) and previous elements in the vector (e.g. n-1)? For example: I would like to calculate the sum of (n-1) + n for each element of a vector and get a vector as a result. Besides others I tried this: v<-c(3,6,8,1,1,3,9,

[R] use pcls to solve least square fitting with constraints

2010-12-06 Thread Baoqiang Cao
Hi, I have a least square fitting problem with linear inequality constraints. pcls seems capable of solving it so I tried it, unfortunately, it is stuck with the following error: > M <- list() > M$y = Dmat[,1] > M$X = Cmat > M$Ain = as.matrix(Amat) > M$bin = rep(0, dim(Amat)[1]) > M$p=qr.solve(as.

Re: [R] as.xts error

2010-12-06 Thread Joshua Ulrich
On Mon, Dec 6, 2010 at 5:57 AM, Gabor Grothendieck wrote: > On Mon, Dec 6, 2010 at 6:52 AM, Ted Zeng (曾振兴) wrote: >> >> Dear all, >> >> I am using the as.xts function to transfer a data frame to the xts >> >> The following is the code and result: >> >> a<-read.csv("price.csv") >> a$Date<-as.POSIX

Re: [R] help getting data in correct format

2010-12-06 Thread Benjamin B.
When I try to read data from excel, I save it in csv-format and read the files via: fileData <-read.csv(fkFileName, header = fkHasHeader, stringsAsFactors=FALSE, sep=fkSep) where fkSep is depending on your localization of excel (I think). For some columns that don’t get the correct data format

[R] How to formulate constraint like abs(x) = y in constrOptim (or other)

2010-12-06 Thread Benjamin B.
Hello list reader, I am trying to form some constraints for an optimization I am working on. I think I have understand the use of the constraints in matrix form. I use them like: constr_mat<- -diag(2) constr_vec<- rep(-0.05,2) constr_mat<- rbind(constr_mat, diag(2)) constr_vec<- c(constr_vec, re

Re: [R] Can't read data coded in Cyrillic

2010-12-06 Thread Jeff Newmiller
I suspect that R is reading the data just fine, but is not displaying it as you want to see it. Read the R Windows FAQ 3.3. "Dan Winetsky" wrote: >To whom it may concern, > >I have a database (an SPSS .sav file) with some vectors containing >strings >of words in Cyrillic. My console, however,

[R] less than full rank contrast methods

2010-12-06 Thread Max Kuhn
I'd like to make a less than full rank design using dummy variables for factors. Here is some example data: when <- data.frame(time = c("afternoon", "night", "afternoon", "morning", "morning", "morning", "morning", "afternoon", "afternoon"),

[R] npRmpi memory error

2010-12-06 Thread Chris Carleton
Hi List, I'm using npRmpi to run some density equality tests and place the output into a matrix. I've put together some crude functions for the purpose, but I'm receiving the following error when npdeneqtest() reached the bootstrap; FATAL ERROR: Memory allocation failure (type DBL_VECTOR). Progra

[R] help getting data in correct format

2010-12-06 Thread John Haart
Dear All, I am having trouble getting my data into R as i need it! I am used to using read.delim("") to open .txt files to do work on. The function i am using requires a matrix like the one below. My data is from excel and then saved as a txt file. I have tried the usual read.delim("") approa

[R] Connect SQL Oracle server

2010-12-06 Thread razmigd
Hi, I use Oracle sql developer to connect to a server. I would like to connect to the server directly from R by using odbcConnect("DB name") function. I am trying to make first the connection below Control Pannel->Datasource (ODBC). Which software should I select here? Which one is suitable for O

Re: [R] Optimize multiple variable sets

2010-12-06 Thread Jonathan P Daily
I suppose I should have been more clear. I saw that her interval did not include the actual minimum, but I was asking if (and if, why) she was expecting the minimum x value to be different for each run. If the y value were returned the same on each run that would be puzzling. As for the returne

[R] From ts to xts

2010-12-06 Thread Giuseppe Vittucci
I have the following problem. After having created an xts importing data from a csv with: data <- read.csv(mib.csv, header = TRUE, dec = ".", sep="\t") dates <- as.POSIXct(strptime(data[,1],format="%m/%d/%Y")) mib <- xts(data[,c(2:6)],order.by=dates)) I work out weekly log returns: p <- apply.we

[R] Change intervals in apply.weekly

2010-12-06 Thread Giuseppe Vittucci
I am using the function apply.weekly() from the xts package and I realized that for the program the week starts Tuesday. So for instance, with a series like this: Close 2006-07-03 3.00 2006-07-04 36738.00 2006-07-05 36207.00 2006-07-06 36534.00 2006-07-07 36434.00 2006-07-10 36588.00

Re: [R] Optimize multiple variable sets

2010-12-06 Thread peter dalgaard
On Dec 6, 2010, at 15:15 , Jonathan P Daily wrote: > Correct me if I'm wrong, but isn't the minimal x value in your example the > same regardless of what positive coefficient you apply to x? If that is > the case, you would expect the same min(x) for each iteration. > > i.e. in the interval [0

Re: [R] Optimize multiple variable sets

2010-12-06 Thread Jonathan P Daily
Correct me if I'm wrong, but isn't the minimal x value in your example the same regardless of what positive coefficient you apply to x? If that is the case, you would expect the same min(x) for each iteration. i.e. in the interval [0,1] the minimum x value of x^2 + x is the same as x^2 + 10

Re: [R] lattice: strip panel function question

2010-12-06 Thread Maarten van Iterson
Thanks Chris Campbell, I didn't though about that. Cheers, Maarten On Mon, 2010-12-06 at 10:08 +, Chris Campbell wrote: > data$subjectID <- paste(data$groups, data$subjects) # create a > character > label > > xyplot(responses~time|subjectID, groups = groups, data = data, > aspect="xy")

[R] Optimize multiple variable sets

2010-12-06 Thread sandra lag
Hi, I usually use optimize function for ML Estimation. Now I´ve got a data frame with many sets, but I can´t save estimates each time I run the code for each data set (I´m using a for loop with my loglikelihood function and works ok but when I apply another for loop to: optimize(my.loglikeliho

[R] R CMD SHLIB Error

2010-12-06 Thread Giud
Hi! I'm a new programmer in R Last week i wrote many function in C and i used R CMD SHLIB to make dll. Since friday i have this error: cygwin warning: MS-DOS style path detected: C:\PROGRA~1\R\R-211~1.1/bin/SHLIB.sh Preferred POSIX equivalent is: /cygdrive/c/PROGRA~1/R/R-211~1.1/bin/SHLIB.s

Re: [R] Tinn-R 2.3.7.0 released

2010-12-06 Thread Steve_Friedman
I am also finding the link between TINN - R (2.3.7.0) and R (2.12.0 2010 - 10 - 15) to be problematic. source(.trPaths[5], echo=TRUE, max.deparse.length=150) Error in source(.trPaths[5], echo = TRUE, max.deparse.length = 150) : object '.trPaths' not found Steve Friedman Ph. D. Ecologist /

[R] Error with Rserv

2010-12-06 Thread Joel
Hi I get this error with Rserve: eval failedeval failed, request status: R parser: syntax erroreval failed, request status: R parser: input incompleteorg.rosuda.REngine.Rserve.RserveException: eval failed at org.rosuda.REngine.Rserve.RConnection.eval(RConnection.java:233) at se.

Re: [R] Help with GAM (mgcv)

2010-12-06 Thread Stressed1985
Ye Thank you so much, finally i have something to look at. Just got to interpret the bloomin' thing now! -- View this message in context: http://r.789695.n4.nabble.com/Help-with-GAM-mgcv-tp3074165p3074414.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Help with GAM (mgcv)

2010-12-06 Thread Simon Wood
OK, try... model3=gam(Symptoms~as.factor(txerad)+as.factor(maritalStatus),family=binomial,data=data2) or model3=gam(data2$Symptoms~as.factor(data2$txerad)+as.factor(data2$maritalSt atus),family=binomial) ... both types of construction work with the current mgcv:gam (and with glm). Your constructi

Re: [R] Help with GAM (mgcv)

2010-12-06 Thread Stressed1985
Ok, i just tried this: library(mgcv) model3=gam(data2$Symptoms~as.factor(data2$txerad)+as.factor(data2$maritalStatus),family=binomial,data=data2) And im still getting this error! Error in dl[[i]] : subscript out of bounds -- View this message in context: http://r.789695.n4.nabble.com/Help-w

Re: [R] as.xts error

2010-12-06 Thread Gabor Grothendieck
On Mon, Dec 6, 2010 at 6:52 AM, Ted Zeng (曾振兴) wrote: > > Dear all, > > I am using the as.xts function to transfer a data frame to the xts > > The following is the code and result: > > a<-read.csv("price.csv") > a$Date<-as.POSIXct(a$Date) > > str(a) > 'data.frame':   15637 obs. of  2 variables: >

Re: [R] Help with GAM (mgcv)

2010-12-06 Thread Simon Wood
Probably the problem is with trying to smooth maritalStatus, which is a factor variable. Smooths are generally functions of metric variables (i.e. variables that take numerical values, where the ordering is meaningful). You can have random effect smooths and markov random field smooths in more r

[R] as.xts error

2010-12-06 Thread 曾振兴
Dear all, I am using the as.xts function to transfer a data frame to the xts The following is the code and result: a<-read.csv("price.csv") a$Date<-as.POSIXct(a$Date) str(a) 'data.frame': 15637 obs. of 2 variables: $ Date : POSIXct, format: "2010-01-04 09:45:01" "2010-01-04 09:45:02" "2

Re: [R] Runif Help: same variable, 3 different parameters

2010-12-06 Thread Duncan Murdoch
On 05/12/2010 10:13 PM, pythonomics wrote: So I am working on an economic model and I need to change the parameters of the runif statement as time goes on. Ex. X<-runif(1:50,0,5) X<-runif(51:100,100,150) X<-runif(100:T, 1,2) Not sure how to go about entering this in to R properly. It's not

[R] Understanding the output from lme anova

2010-12-06 Thread Hedberg Peter
I have a question regarding understanding the output from a nested linnear mixed effect model. My model looks like the following lme(Poaceae~Site+Ditch_block+Tree_cut+as.factor(Dist_start)+(as.factor(Dist_start)*Tree_cut)+((as.factor(Dist_ditch))/Ditch_block),random=~1|Mainplot/Transect/Obsplot) I

[R] Understanding the output from lme.anova

2010-12-06 Thread Hedberg Peter
I have a question regarding understanding the output from a nested linnear mixed effect model. My model looks like the following lme(Poaceae~Site+Ditch_block+Tree_cut+as.factor(Dist_start)+(as.factor(Dist_start)*Tree_cut)+((as.factor(Dist_ditch))/Ditch_block),random=~1|Mainplot/Transect/Obsplot)

Re: [R] Help with GAM (mgcv)

2010-12-06 Thread Stressed1985
Thank you for your reply! It says: This is mgcv 1.5-5 . For overview type `help("mgcv-package")'. Its version: R 2.9.2 And summary(data2) gives: id age bmi siblingsgender Min. : 1.0 Min. :32.19 Min. :16.41 Min. :0.000 Fem

Re: [R] Urgent Help with R calculation correlation coefficient

2010-12-06 Thread Liviu Andronic
On Mon, Dec 6, 2010 at 11:30 AM, Peter Ehlers wrote: > If you have a *tab*-delimited file, then why are your using > read.csv?? > > Try this: > 1. read your data with read.table() or read.delim() > If you're very new to R, try Rcmdr. Data > Import > Text file. Liviu _

[R] make check from R2.12.0.exe installation

2010-12-06 Thread elliott harrison
Hi, I typically install new versions of R on windows using the downloadable executable file rather than the full tar. I need to now document the success of the installation in addition to my preferred procedure of running an old dataset against the new build. I found quickly that this is all

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread jim holtman
Here is another approach to try: > require(data.table) > var <- "g10" > df <- data.table(df) > str(df) Classes ‘data.table’ and 'data.frame': 6 obs. of 5 variables: $ g10: int 1 1 1 10 10 10 $ l1 : num 0.41 0.607 0.64 -1.478 -1.482 ... $ d1 : num 0.918 0.959 0.773 0.474 0.591 ... $ l13: n

Re: [R] [plyr] Question regarding ddply: use of .(as.name(varname)) and varname in ddply function

2010-12-06 Thread Peter Ehlers
On 2010-12-06 01:58, Sunny Srivastava wrote: Dear R-Helpers: I am using trying to use *ddply* to extract min and max of a particular column in a data.frame. I am using two different forms of the function: ## var_name_to_split is a string -- something like "var1" which is the name of a column i

Re: [R] Urgent Help with R calculation correlation coefficient

2010-12-06 Thread Mark Seeto
Try excluding the first column. cor(gse20437[, 2:4]) chintan85 wrote: > > > Tab delimited file looks like this > > Id v1 v2v3 > df 56 9045 > gh 87 9878 > ty 897867 > > I used this code > > > [code] > > gse20437 <- read.csv("C:/Users//Desktop/data/GSE20437_matrix

  1   2   >