similar to: Using functions within functions (environment problems)

Displaying 20 results from an estimated 800 matches similar to: "Using functions within functions (environment problems)"

2007 Jan 26
0
R crash with modified lmer code
Hi all, I've now got a problem with some modified lmer code (function lmer1 pasted at end) - I've made only three changes to the lmer code (marked), and I'm not really looking for comments on this function, but would like to know why execution of the following commands that use it almost invariably (but not quite predictably) leads to the R session terminating. Here's the command
2007 May 25
0
Help with complex lme model fit
Hi R helpers, I'm trying to fit a rather complex model to some simulated data using lme and am not getting the correct results. It seems there might be some identifiability issues that could possibly be dealt with by specifying starting parameters - but I can't see how to do this. I'm comparing results from R to those got when using GenStat... The raw data are available on the
2008 Jun 05
0
bug in barplot.default (graphics) (PR#11585)
There seems to be a minor bug in barplot.default when used with log scale w= here one or more values is NA: dat <- matrix(1:25, 5) dat[2,3] <- NA barplot(dat, beside =3D T) #Plots and appropriate barplot with gaps for m= issing data barplot(dat, beside =3D T, log =3D "y") #Error in if (min(height + offset) <=3D 0) stop("log scale error: at least = one 'height +
2006 Nov 01
0
spatstat symbol referencing error
Sparc Solaris 8 SunStudio 11 compilers R-2.3.1 spatstat 1.10-1 R-2.3.1 and spatstat were installed using SunStudio11 compilers on a Sparc Solaris 8 machine. No errors were reported in the compilations, however, when I try to load spatstat I get an error: > library(spatstat) Loading required package: mgcv This is mgcv 1.3-20 Error in dyn.load(x, as.logical(local), as.logical(now)) :
2001 Nov 30
1
graphics device updating (PR#1189)
Hi problem: plot(xxx) results in the graphics device window adding the axes values for what ever xxx is but failing to actually add lines or produce the plot until the consol window is activated and moved over the graphics window. The graphics window then shows what has been plotted. This started happening 4 days ago, up until that time plot(xxx) would produce the plot on the graphics device
2009 Apr 28
1
image3d in misc3d
Hi, I'm trying to make sense of the image3d plots in misc3d. Unfortunately I can't find any authors on the help pages of the function to e-mail directly. In the following toy example, I'm puzzled as to why (1) the positions of the image plot on the axes include negative values when I think I've specified all to be 1:3 and (2) the logic that needs to be adhered to in order to
2005 Dec 22
3
reading long matrix
Hi, I'm needing some help finding a function to read a large text file into an array in R. The data are essentially presence / absence / na data for many species and come as a grid with each species name (after two spaces) at the beginning of the matrix defining the map for that species. An excerpt could therefore be: SPECIES1 999001099 900110109 011101000 901100101 110100019 901110019
2002 Nov 28
0
Netware copy fails
Affected: Various 2.x.x releases of samba on Solaris 2.6/8 and Netware 5.1 SP5. Problem: Unable to copy files from a mapped Netware drive to a mapped samba share on a PC desktop (W2K). Error: Several, but commonly "Cannot copy MYFILE. Access is denied. The source file may be in use" or "An unexpected network error has occurred". Has anyone seen similar? It appears that some
2009 Jul 03
0
Presumably simple question about sorting/ordering
Hi, I'm stuck with a fairly basic re-ordering problem. I want to extract part of a matrix as a vector, and reorder it to match with an erratic sequence of x,y coordinates. Here's an example that shows what I want and how close I've got (but for some reason my mind just can't get the final step at the moment!): #Define a grid: xy100 <- expand.grid(1:10, 1:10) # Define a matrix
2010 Nov 09
2
Help with Iterator
Dear Experts, The following is my "Iterator". When I try to write a new function with itel, I got error. This is what I have: > supDist<-function(x,y) return(max(abs(x-y))) > > myIterator <- function(xinit,f,data=NULL,eps=1e-6,itmax=5,verbose=FALSE) { + xold<-xinit + itel<-0 + repeat { + xnew<-f(xold,data) + if (verbose) { + cat( +
2006 Jan 26
2
Prediction when using orthogonal polynomials in regression
Folks, I'm doing fine with using orthogonal polynomials in a regression context: # We will deal with noisy data from the d.g.p. y = sin(x) + e x <- seq(0, 3.141592654, length.out=20) y <- sin(x) + 0.1*rnorm(10) d <- lm(y ~ poly(x, 4)) plot(x, y, type="l"); lines(x, d$fitted.values, col="blue") # Fits great! all.equal(as.numeric(d$coefficients[1] + m
2001 May 23
1
Passing a string variable to Surv
Hi, I am trying to write a function to automate multiple graph generation. My data looks like: Table of numeric values with the following headers: timeM1 statusM1 xM1 timeM2 statusM2 xM2 timeM3 statusM3 xM3 1 2 3 4 5 6 Where M1,M2, M3 hve no similarity except they have a max string length of 7. Examples are mcw0045, adl0003, lei0101. Now, what I want to do is Function(M1, M2,
2007 Jul 22
1
Package design, placement of legacy functions
I have a function XOLD() from a nearly verbatim port of legacy FORTRAN in a package. I have remplemented this function as XNEW() using much cleaner native R and built-in functions of R. I have switched the package to the XNEW(), but for historical reasons would like to retain the XOLD() somewhere in the package directory structure. An assertion through a README or other will point to
2005 Oct 04
3
Problem reading in external data and assigning data.frames within R
Hey there, I apologize if this is an irritatingly simple question ... I'm a new user. I can't understand why R flips the sign of all data values when reading in external text files (tab delimited or csv) with the read.delim or read.csv functions. The signs of data values also seem to be flipped after assigning a new data.frame from within R (xnew <-- edit(data.frame()). What am
2005 Sep 06
2
Predicting responses using ace
Hello everybody, I'm a new user of R and I'm working right now with the ACE function from the acepack library. I Have a question: Is there a way to predict new responses using ACE? What I mean is doing something similar to the following code that uses PPR (Projection Pursuit Regression): library(MASS) x <- runif(20, 0, 1) xnew <- runif(2000, 0, 1) y <- sin(x) a <- ppr(x, y,
2010 Nov 18
3
sweep by levels of a factor
Hi, I'd appreciate help with this. I have a data matrix with one column, called f in the example below, a factor. I'd like to subtract the means from each of other columns for each level of the factor. That is, in the example, to go from the first matrix below to the second. I know SWEEP will take out means, but I want to do this for each level of the factor. f x 1 2 1
2005 Feb 13
2
row equality.
I think that this is an easy one... I have a matrix where each row is an (x,y,z) triplet. Given a potential (xnew,ynew,znew) triplet I want to know if the matrix already contains a row with the new values (the space already has that point). I can do it using a for loop, but I would like to know if there is anyway in which I can do it without the for loop. I do it now like this (this
2006 Aug 17
2
getting sapply to skip columns with non-numeric data?
getting s-apply to skip columns with non-numeric data? I have a dataframe ?x? of w columns. Some columns are numeric, some are not. I wish to create a function to calculate the mean and standard deviation of each numeric column, and then ?bind? the column mean and standard deviation to the bottom of the dataframe. e.g. tempmean <- apply(data.frame(x), 2, mean, na.rm = T) xnew <-
2011 Jun 14
2
Need script to create new waypoint
Dear help-list members, I am a student at Durham University (UK) conducting a PhD on spatial representation in baboons. Currently, I'm analysing the effect of sampling interval on home range calculations. I have followed the baboons for 234 days in the field, each day is represented by about 1000 waypoints (x,y coordinates) recorded at irregular time intervals. Consecutive waypoints in
2012 Jul 02
0
Fit circle with R
Dear Researchers, I wrote two function to fit a circle using noisy data. 1- the fitCircle() is derived from MATLAB code of * zhak Bucher* from the link http://www.mathworks.com/matlabcentral/fileexchange/5557-circle-fit/content/circfit.m 2- the CircleFitByPratt() from MATLAB code of *Nikolai Chernov *from the link