[R] file.link fails on NTFS

2012-12-07 Thread Oliver Soong
Windows 7 64-bit, R 2.15.2 i386. Working directory is on an NTFS drive. > writeLines("", "file.txt") > file.link("file.txt", "link.txt") Warning in file.link("file.txt", "link.txt") : cannot link 'link.txt' to 'link.txt', reason 'The system cannot find the file specified' No link is created.

[R] imputation in mice

2012-12-07 Thread Elizabeth Fuller Bettini
Hello! If I understand this listserve correctly, I can email this address to get help when I am struggling with code. If this is inaccurate, please let me know, and I will unsubscribe. I have been struggling with the same error message for a while, and I can't seem to get past it. Here is the iss

Re: [R] Fwd: Simulation of spatial Log-Gaussian Cox process in Spatstat

2012-12-07 Thread Rolf Turner
On 08/12/12 07:35, George Limitsios wrote: Hello, I have fitted a Log-Gaussian Cox Process on my data but when I try to use "simulate.kppm" of the spatstat package I get this error: Error in rLGCP(model = model, mu = mu, param = param, ..., win = win) : The spatial domain of the pixel image

Re: [R] Incorrect DST time changes in DateTimeClasses

2012-12-07 Thread Andrew Digby
Thanks for confirming that it's a wider problem. I thought that /etc/localtime on my machine was the Olsen database, but presumably not, since the DST changes are correct in that file. Unless R is reading that file incorrectly? I've ended up using chron (which ignores time zones and DST) and a

Re: [R] upgrade to 2.15.2 can't load stats package

2012-12-07 Thread David Winsemius
On Dec 7, 2012, at 10:21 AM, Jake Burkhead wrote: today i upgraded from 2.12 to 2.15.2 on ubuntu 12.04 and now i get this message whenever i try to start R. Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/lib/R/library/stats/libs/ stats.so': /usr/lib/

[R] Score residuals with glm()

2012-12-07 Thread Frank Harrell
Is there a way to compute score residuals from glm() fits (my current example is Poisson regression)? I'm referring to the types of residuals used in computing the sandwich covariance matrix estimator. The sandwich package will compute the Huber-White sandwich estimator but I need to use the clus

Re: [R] Error using constrOptim in constraint definition

2012-12-07 Thread William Dunlap
Try setting options(error=recover) before the offending call to constrOptim. When you hit the error you can inspect the objects in constrOptim that cause the problem. E.g., > constrOptim(theta=1:3, f=function(x)sum((x-1.5)^2), > grad=function(x)2*(x-1.5), ui=cbind(c(1,1,1), c(1.75,1.3,2)),

Re: [R] Polychor() - why does it take that long?

2012-12-07 Thread John Fox
Dear Torvon, First, the number of observations is pretty much irrelevant, since polychoric correlations are computed from the contingency table for the variables. Second, it's not obvious to me what data[c(s1,s2)] might be since this is not how one would normally call polychor(). That is, called

[R] Error using constrOptim in constraint definition

2012-12-07 Thread Stefano de Pretis
Hello, I'm trying to run constrOptim. It returns to me an error about the fact that constraints arguments (ui and ci) are non compatibles: > optout= constrOptim(startparams, f=ImpulseSS, grad=grImpulse, ui=UI, ci=CI, > data=gexp[k,], t=t) Error in ui %*% theta : non-conformable arguments I wo

[R] Polychor() - why does it take that long?

2012-12-07 Thread Torvon
Hello. Using the polychor function > polychor(data[c(s1,s2)] ) for polychoric correlations of two ordinal variables in R takes a long time for N=7000 (20 minutes+) and significantly slows down my computer. Now, I have a pretty old computer, but it takes about 20 seconds for MPLUS to print out the

[R] Conditional inference forest error: levels in factors do not match

2012-12-07 Thread Ana Davidson
#Conditional inference forest ("Party" package) error message states that levels in factors of new data do not match original data, but they do... #create conditional inference forest oc_listed.fit1 <- cforest(Listed~ HabMode,controls=cforest_unbiased(ntree=500), data=oc.complete) #use predi

[R] inserting jpg

2012-12-07 Thread Santiago Guallar
I’m trying to insert 8 jpg files with the main moon phases in a plot using read.image. My code:   ## Images   library(ReadImages) c1 = read.jpeg( '1c.jpg' ) c2 = read.jpeg( '2c.jpg' ) c3 = read.jpeg( '3c.jpg' ) d1 = read.jpeg( '1d.jpg' ) d2 = read.jpeg( '2d.jpg' ) d3 = read.jpeg( '3d.jpg' ) f

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
On 07-12-2012, at 18:01, arun wrote: > > > HI, > > I can see ?runif(), ?rnorm() without a set seed. Good eyesight! Correct. Oops. Inserting set.seed(413) at the start I now get this # > benchmark(eta1 <- f1(X, B, x, sem1), eta2 <- f2(X, B, x, sem1), eta3 <- f3(X, B, x, sem1), # +

Re: [R] Vectorizing integrate()

2012-12-07 Thread Prof J C Nash (U30A)
I found mixed (and not always easy to predict) results from the byte-code compiler. It seems necessary to test whether it helps. On some calculations, it is definitely worthwhile. JN On 12-12-07 01:57 PM, Berend Hasselman wrote: On 07-12-2012, at 19:37, Spencer Graves wrote: On 12/7/2012

[R] upgrade to 2.15.2 can't load stats package

2012-12-07 Thread Jake Burkhead
today i upgraded from 2.12 to 2.15.2 on ubuntu 12.04 and now i get this message whenever i try to start R. Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/usr/lib/R/library/stats/libs/stats.so': /usr/lib/liblapack.so.3gf: undefined symbol: ATL_chemv any sugge

Re: [R] Vectorizing integrate()

2012-12-07 Thread arun
Hi, Using David's function: fun <- function(u, m, s) 1/ (1 + exp(- (B[1] + B[2] *   (m + u * dnorm(u, 0, s)  res<-mapply(function(i) integrate(fun,-Inf,Inf,m=x[i],s=sem1[i])$value,1:nrow(X)) res # [1] 0.5212356 0.6214989 0.5306124 0.5789414 0.3429795 0.6972879 0.5952949  #[8] 0.7531899

Re: [R] Vectorizing integrate()

2012-12-07 Thread arun
HI, I can see ?runif(), ?rnorm() without a set seed. A.K. - Original Message - From: David L Carlson To: 'arun' ; "'Doran, Harold'" Cc: 'R help' ; 'David Winsemius' Sent: Friday, December 7, 2012 11:54 AM Subject: RE: [R] Vectorizing integrate() Must be a cut and paste issue. All th

Re: [R] how to add a column from another dataset with "merge"

2012-12-07 Thread arun
Hi, You could use sort=FALSE in ?merge() d1<-data.frame(id=c(9,8,6,5,4,3,1)) d2<-data.frame(id=c(9,8,6),age=c(46,56,52))  d<-merge(d1,d2,all.x=TRUE,sort=FALSE) #or library(plyr) join(d1,d2,by="id",type="full") #  id age #1  9  46 #2  8  56 #3  6  52 #4  5  NA #5  4  NA #6  3  NA #7  1  NA A.K. -

[R] fft and wavenumber

2012-12-07 Thread sara martino
Hi I need to compute the fft of an image A with dimension (Nx,Ny) and are not sure on how to compute the wavenumber. I have done like that but i am not sure i am computing the wavenumber in the correct way..can someone help? sara image.plot(x,y,A) dx = diff(x)[1] dy = diff(y)[1]      ## Th

[R] Fwd: Simulation of spatial Log-Gaussian Cox process in Spatstat

2012-12-07 Thread George Limitsios
Hello, I have fitted a Log-Gaussian Cox Process on my data but when I try to use "simulate.kppm" of the spatstat package I get this error: Error in rLGCP(model = model, mu = mu, param = param, ..., win = win) : The spatial domain of the pixel image ‘mu’ does not cover the simulation window ‘win

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
On 07-12-2012, at 19:37, Spencer Graves wrote: > On 12/7/2012 9:40 AM, Berend Hasselman wrote: >>> >>> benchmark(eta1 <- f1(X, B, x, sem1), eta2 <- f2(X, B, x, sem1), eta3 <- >>> f3(X, B, x, sem1), >> + eta4 <- f4(X, B, x, sem1), eta5 <- f5(X, B, x, sem1), eta6 <- >> f6(X, B, x, sem1

Re: [R] Vectorizing integrate()

2012-12-07 Thread Spencer Graves
On 12/7/2012 9:40 AM, Berend Hasselman wrote: On 07-12-2012, at 18:12, Spencer Graves wrote: Has anyone suggested using the byte code compiler "compiler" package? An analysis by John Nash suggested to me that it may be roughly equivalent to vectorization; see "http://rwiki.sciviews.or

[R] Problem with ggmap

2012-12-07 Thread Axel Urbiz
Dear List, I run the code below on my Mac and works fine. On Win 7 64-bit, I’m getting the error message at the bottom.In both cases, I’m using R 2.15.2. Any clue? v1 = c(43.6, 43.8, 44.2); # Latitude for added points v2 = c(-80, -79.5, -79.0); # Longitude for added points v

Re: [R] Vectorizing integrate()

2012-12-07 Thread Berend Hasselman
On 07-12-2012, at 18:12, Spencer Graves wrote: > Has anyone suggested using the byte code compiler "compiler" package? > An analysis by John Nash suggested to me that it may be roughly equivalent to > vectorization; see > "http://rwiki.sciviews.org/doku.php?id=tips:rqcasestudy&s=compile

Re: [R] Vectorizing integrate()

2012-12-07 Thread Spencer Graves
Has anyone suggested using the byte code compiler "compiler" package? An analysis by John Nash suggested to me that it may be roughly equivalent to vectorization; see "http://rwiki.sciviews.org/doku.php?id=tips:rqcasestudy&s=compiler";. If that has been suggested, please excuse

Re: [R] Vectorizing integrate()

2012-12-07 Thread David Winsemius
On Dec 7, 2012, at 7:14 AM, Doran, Harold wrote: David et al Thanks, I should have made the post more complete. I routinely use apply functions, but often avoid mapply() as I find it so non- intuitive. In this instance, I think the situation demands I change that position, though. Repro

Re: [R] Vectorizing integrate()

2012-12-07 Thread David L Carlson
Must be a cut and paste issue. All three agree on the results but they are different from those in arun's message: > B <- c(0,1) > sem1 = runif(10, 1, 2) > x <- rnorm(10) > X <- cbind(1, x) > eta <- numeric(10) > for(j in 1:nrow(X)){ + fun <- function(u) 1/ (1 + exp(- (B[1] + B[2] * (x[j] + u

Re: [R] Negative Binomial GAMM - theta values and convergence

2012-12-07 Thread Simon Wood
Hi Raeanne, gamm fits using PQL, which doesn't always converge, however looking at your data, a couple of things stand out... 1. Trying a Tweedie seemed to give nicer residual plots than the negative binomial, and also converges with gamm. e.g. SB.gam3<-gam(count~offset(vol_offset)+ s(Dep

Re: [R] Converting character to numeric: Error: (list) object cannot be coerced to type 'double'

2012-12-07 Thread Vikram Bahure
Thanks a lot. That was helpful. My apologize, as both "cmie.dts" and 'f" are same. On Fri, Dec 7, 2012 at 8:46 PM, Rui Barradas wrote: > Hello, > > It's the column that you want to convert, not the data.frame. > > f1 <- as.numeric(f$INE001A01036) > > Hope this helps, > Rui Barradas > Em 07-12-2

Re: [R] Vectorizing integrate()

2012-12-07 Thread David L Carlson
How about? > fun <- function(u, m, s) 1/ (1 + exp(- (B[1] + B[2] * + (m + u * dnorm(u, 0, s) > eta <- sapply(1:nrow(X), function(i) integrate(fun, + -Inf, Inf, m=x[i], s=sem1[i])$value) > eta [1] 0.3018974 0.6780813 0.4804123 0.4845773 0.3886028 0.3336432 0.2541276 [8] 0.6894951

Re: [R] Converting character to numeric: Error: (list) object cannot be coerced to type 'double'

2012-12-07 Thread Rui Barradas
Hello, It's the column that you want to convert, not the data.frame. f1 <- as.numeric(f$INE001A01036) Hope this helps, Rui Barradas Em 07-12-2012 14:23, Vikram Bahure escreveu: Dear R users, I am facing a pretty a unusual problem while converting character to numeric. Any input would be appre

Re: [R] Vectorizing integrate()

2012-12-07 Thread Doran, Harold
David et al Thanks, I should have made the post more complete. I routinely use apply functions, but often avoid mapply() as I find it so non-intuitive. In this instance, I think the situation demands I change that position, though. Reproducible code for the current implementation of the functio

Re: [R] Converting character to numeric: Error: (list) object cannot be coerced to type 'double'

2012-12-07 Thread Sarah Goslee
Hi, You need to use as.numeric on the column, not the entire data frame. On Fri, Dec 7, 2012 at 9:23 AM, Vikram Bahure wrote: > Dear R users, > > I am facing a pretty a unusual problem while converting character to > numeric. Any input would be appreciated. > > Below is the code and error face

[R] Converting character to numeric: Error: (list) object cannot be coerced to type 'double'

2012-12-07 Thread Vikram Bahure
Dear R users, I am facing a pretty a unusual problem while converting character to numeric. Any input would be appreciated. Below is the code and error faced: --- *> str(cmie.dts)* *'data.frame': 4397 obs. of 1 variable:* * $ INE001A01036: chr "1482181740.000

[R] apply a function at: dateX, dateX+1, dateX+2, ....

2012-12-07 Thread Tagmarie
Dear knowing people, Dennis Murphy helped me a lot with my first loop last week. Thanks again - I could have made more than 10 "Thank-You cakes" in the time it saved me! But now I want to complicate the thing. My ideas didn't work. Let's see if anyone is smarter ;-) The following packages are n

[R] Statistica .stw file import

2012-12-07 Thread S Ellison
Can anyone point me to an R package that will read data from a .stw file originally created in Statistica version 5 or version 6? (Our IT department has killed the legacy Statistica installation we held for days like this ... ;-( ) S Ellison

Re: [R] how to add a column from another dataset with "merge"

2012-12-07 Thread Pete Brecknock
kiotoqq wrote > I want to add a shorter column to my dataset with the function "merge", > it > should be filled with NAs wo be as long as the other colums, like this: > > idage > 946 > 856 > 6 52 > 5 NA > 4 NA > 3 NA > 1 NA > > i did this: > pa1 <- merge(pa1, an1, by="mergeid

Re: [R] Assigning cases to groupings based on the values of several variables

2012-12-07 Thread arun
HI, In your method2 and method3, you are using the groupings data.  If that is the case, is it possible for you to use ?merge() or ?join() from library(plyr)  join(mydata,groupings,by=c("sex","age"),type="inner")  #  sex age mygroup #1    m   1   1 #2    m   2   2 #3    m   3   3 #4  

Re: [R] Assigning cases to groupings based on the values of several variables

2012-12-07 Thread Dimitri Liakhovitski
Wow, Arun I think I really like this solution. It allows me to create irregular groupings and is very parsimonious. Thank you very much! Dimitri On Fri, Dec 7, 2012 at 8:09 AM, arun wrote: > HI, > > In your method2 and method3, you are using the groupings data. If that is > the case, is it possi

Re: [R] Assigning cases to groupings based on the values of several variables

2012-12-07 Thread Dimitri Liakhovitski
My example data indeed looks regular, but in reality neither the data nor the assignments are regular. E.g., sometimes all females would land in one grouping and males of different ages will land in different groupings. So, I am afraid the "with" solution won't work. Dimitri On Fri, Dec 7, 2012 at

Re: [R] Assigning cases to groupings based on the values of several variables

2012-12-07 Thread Duncan Murdoch
On 12-12-07 7:27 AM, Dimitri Liakhovitski wrote: Dear R-ers, my task is to simple: to assign cases to desired groupings based on the combined values on 2 variables. I can think of 3 methods of doing it. Method 1 seems to me pretty r-like, but it requires a lot of lines of code - onerous. Since

Re: [R] points3d and ordirgl

2012-12-07 Thread Duncan Murdoch
On 12-12-06 7:20 PM, Aaron Wells wrote: Hello all, I have been using the function ordirgl to plot 3D dynamic ordinations. The ordirgl function works just fine. IN fact, I was even able to write a function that allows me to identify points in the 3D plot: identify.rgl<-function(env_var,ord,dim1,

Re: [R] Problem with special characters

2012-12-07 Thread R. Michael Weylandt
Very much an OS / GUI specific question: can you give more detail about your setup? MIchael Weylandt On Friday, December 7, 2012, Renato De Leone wrote: > I have the following problem: > I am using igraph and entering a graph from an external (.txt) file using > > read.graph("a.txt","ncol") > >

[R] Problem with special characters

2012-12-07 Thread Renato De Leone
I have the following problem: I am using igraph and entering a graph from an external (.txt) file using read.graph("a.txt","ncol") In a.xtx the name of the nodes contains special characters (such Polish names, etc). In the R console, the visualization of the names is not correct and I am loo

[R] loop for calculating 1-se in rpart

2012-12-07 Thread Andrew Halford
Hi Listers I need to calculate and then plot a frequency histogram of the best tree calculated using the 1-se rule. I have included some code that has worked well for me in the past but it was only for selecting the minimum cross-validation error. I include the code for my model, some relevant out

Re: [R] Colors according to value (Excel-Export)

2012-12-07 Thread Mat
i tried it this way. With this Code the Row "Difference" gets complete green. But i want the color change to red according to a different value. highlight_other<-out.ex1[(out.ex1$AUFTR_NAME=="Difference"),]$LFD2 zellen_other<-paste(paste("A",highlight_other,sep=""),paste("S",highlight_other,sep=""

Re: [R] Colors according to value (Excel-Export)

2012-12-07 Thread Mat
here is one: i have this in my excel sheet PT_IST Projekt A 1,1 Projekt B1,15 Projekt C 1,2 Difference 1,15 This number is ge

[R] R CMD SHLIB

2012-12-07 Thread Justin.Hughes
Hello r-helpers, I am new to Rtools and would like to build dll's from fortran subroutines for use within R. I have had no luck compiling the following simple fortran code; c sample subroutine to include for R subroutine multiply(ax,bx,cx) implicit none integer ax,bx,cx

[R] points3d and ordirgl

2012-12-07 Thread Aaron Wells
Hello all, I have been using the function ordirgl to plot 3D dynamic ordinations. The ordirgl function works just fine. IN fact, I was even able to write a function that allows me to identify points in the 3D plot: identify.rgl<-function(env_var,ord,dim1,dim2,dim3) { tmp<-select3d(button