Re: [R] break loop with keypress

2014-08-06 Thread William Simpson
at the value of the same variable and break > when the value changes. > > On Tue, Aug 5, 2014 at 6:13 AM, William Simpson > wrote: >> This works, but it is not quite what I need: >> >> par(mar=rep(0,4)) >> >> while(1) >> { >> img1<-matrix(r

[R] break loop with keypress

2014-08-05 Thread William Simpson
This works, but it is not quite what I need: par(mar=rep(0,4)) while(1) { img1<-matrix(runif(2500),50,50) dev.hold(); image(img1,useRaster=TRUE); dev.flush() img2<-matrix(runif(2500),50,50) dev.hold(); image(img2,useRaster=TRUE); dev.flush() } I would like to do this: while(!kbhit())

Re: [R] bmp() shifts the image (Windows XP)

2012-01-02 Thread William Simpson
I have figured out what I wanted to do using pixmap. Pixmap writes .pgm files which I will batch convert to .bmp using Irfanview. Thanks for your help. Cheers, Bill On 1/2/12, William Simpson wrote: > Duncan, I checked out as.raster as you suggested. However, I can't > find inf

Re: [R] bmp() shifts the image (Windows XP)

2012-01-02 Thread William Simpson
elp! Bill On 1/1/12, Duncan Murdoch wrote: > On 12-01-01 9:05 AM, William Simpson wrote: >> When using bmp() under Windows XP, I find that the saved image is a >> shifted version of the correct image. Try this: > > The image() function isn't designed to be able to d

[R] .Rprofile and help startup

2012-01-02 Thread William Simpson
Today I wanted to get R help to start up in text mode under Windows XP. I had my own notes on how to do that. The method described there didn't work. I checked on R-help. No helpful messages on the subject. Therefore I post here in the hope that it helps someone else (or myself, when I forget and s

Re: [R] bmp() shifts the image (Windows XP)

2012-01-02 Thread William Simpson
Thanks Duncan for your help. Bill On 1/1/12, Duncan Murdoch wrote: > On 12-01-01 9:05 AM, William Simpson wrote: >> When using bmp() under Windows XP, I find that the saved image is a >> shifted version of the correct image. Try this: > > The image() function isn't

[R] bmp() shifts the image (Windows XP)

2012-01-01 Thread William Simpson
When using bmp() under Windows XP, I find that the saved image is a shifted version of the correct image. Try this: n<-5 fn<-"01.bmp" x<-matrix(runif(n*n),nrow=n) image(x,col=gray(0:255/255),axes=F,frame.plot=F) bmp(filename = fn,width = n, height = n, units = "px") par(mar=c(0,0,0,0),pty="s") ima

Re: [R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread William Simpson
Thanks for the replies. I was just thinking that, for a two variable example, doing X<-cbind(x1,x2,x1*x2) lm(y~X) would work. So maybe that's what I'll do. This also allows me to pick and choose which interactions to include. Cheers Bill On Sun, Dec 5, 2010 at 8:19 PM, William S

[R] lm() and interactions in model formula for x passed as matrix

2010-12-05 Thread William Simpson
Suppose I have x variables x1, x2, x3 (however in general I don't know how many x variables there are). I can do X<-cbind(x1,x2,x3) lm(y ~ X) This fits the no-interaction model with b0, b1, b2, b3. How can I get lm() to fit the model that includes interactions when I pass X to lm()? For my example

Re: [R] glm binomial loglog (NOT cloglog) link

2010-09-24 Thread William Simpson
I was looking at different link functions for binomial glms recently for the same reason as you (more zeros than ones). I did a bit of reading up on the various link functions and IIRC, you can use the cloglog link on your data, just turn your 0's into 1's and vice versa. This was stated in the one

Re: [R] Optimization problem

2010-06-18 Thread William Simpson
I don't see why one would want to pretend that the function is continuous. It isn't. The x variable devices is discrete. Moreover, the whole solution space is small: the possible solutions are integers in the range of maybe 20-30. Bill On Fri, Jun 18, 2010 at 9:00 AM, José E. Lozano wrote: > >>>

[R] Optimization problem

2010-06-17 Thread William Simpson
Sorry, thought you wanted to find lowest value of x that produced maximum value of y. I see now that is not the case. I think you have to decide on what amount of improvement per device you judge to be 'minimal'. Then the algorithm uses the value of y that occurs at the point where this criterion

Re: [R] trigonometric regression

2010-06-17 Thread William Simpson
Thanks, Bill! Bill On Thu, Jun 17, 2010 at 5:12 PM, William Dunlap wrote: > > You can also define a function that keeps the cos > and sin terms together so anova(fit) shows > one entry for the (cos,sin) pair.  E.g., define > the following function >  cs <- function(x, freq)cbind(cos=cos(x*freq)

Re: [R] Optimization problem

2010-06-17 Thread William Simpson
min(devices[percentages==max(percentages)]) Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contain

Re: [R] trigonometric regression

2010-06-17 Thread William Simpson
Got it now. I do anova(lm(y~ 1),lm(y~ cf+sf)) Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contai

Re: [R] trigonometric regression

2010-06-17 Thread William Simpson
var(y)*length(y) I mean. (SSE) Bill On Thu, Jun 17, 2010 at 1:34 PM, William Simpson wrote: > Yes,  I want the same test as is done for b[1] and b[2] in the summary > table -- for H0: b[]==0. > > OK, do F-test on full model with cf and sf vs reduced model with intercept > on

Re: [R] trigonometric regression

2010-06-17 Thread William Simpson
Thu, Jun 17, 2010 at 11:18 AM, Duncan Murdoch wrote: > William Simpson wrote: >> >> Suppose I do a trigonometric regression >> fit<-lm(y~ cf + sf) >> where cf and sf are the cos and sine components. >> >> b<-coef(fit) >> I have the fitted sine

[R] trigonometric regression

2010-06-17 Thread William Simpson
Suppose I do a trigonometric regression fit<-lm(y~ cf + sf) where cf and sf are the cos and sine components. b<-coef(fit) I have the fitted sine component b[2] and the cos component b[3]. Doing summary(fit) gives me the p-values and SEs for b[2] and b[3]. But I want the amplitude of the fitted wa

Re: [R] Fwd: nonlinearity and interaction

2010-05-14 Thread William Simpson
On Fri, May 14, 2010 at 5:54 PM, Bert Gunter wrote: > 1. As this is not an R question, this is probably not an appropriate list > for posting. You might wish to consider a list specifically devoted to > statistics and data analysis. > > Well I think it is an R question to the extent that I'm usin

Re: [R] Fwd: Fwd: nonlinearity and interaction

2010-05-14 Thread William Simpson
Thanks for telling me. Sorry. Don't know why my posts are not showing up here at gmail. Never happened before. Thought they had been lost in the aether. Bill On Fri, May 14, 2010 at 4:43 PM, David Winsemius wrote: > > On May 14, 2010, at 10:42 AM, William Simpson wrote: > > I

[R] Fwd: Fwd: nonlinearity and interaction

2010-05-14 Thread William Simpson
I don't know why my posts aren't showing up on my email acct. I will send again. -- Forwarded message ------ From: William Simpson Date: Fri, May 14, 2010 at 3:00 PM Subject: Re: [R] Fwd: nonlinearity and interaction To: Cc: r-help@r-project.org On Fri, May 14, 2010

Re: [R] Fwd: nonlinearity and interaction

2010-05-14 Thread William Simpson
On Fri, May 14, 2010 at 1:47 PM, Thomas Levine wrote: > Creating the 5 indicator variables will be easy if you post your code > and sample data. This may also allow people to help with the first > problem you were having. Here you go. Fragment of data file with 4000 or so pts: RawTime Time Oxpc

[R] Fwd: nonlinearity and interaction

2010-05-14 Thread William Simpson
[posted this at 9:25 and still hasn't appeared on the list at 13:26] I have the following set-up. 6 values of a continuous variable (let's say light intensity) are presented to a system. The input is presented as a random series of blocks lasting (say) 5 sec each.                  

[R] nonlinearity and interaction

2010-05-14 Thread William Simpson
I have the following set-up. 6 values of a continuous variable (let's say light intensity) are presented to a system. The input is presented as a random series of blocks lasting (say) 5 sec each. etc time -> The output is mea

Re: [R] scatterplot matrix question

2010-01-02 Thread William Simpson
OK thanks David >> Thanks very much, Uwe. I will try this (on artificial data). I think >> reshape() requires a library [reshape?]. > > No. In fact, the reshape package does not have a reshape function. > > -- > > David Winsemius, MD > Heritage Laboratories > West Hartford, CT > > __

Re: [R] scatterplot matrix question

2010-01-02 Thread William Simpson
> Now that we are able to help with some more detailed view of your data > (although you could have helped helping by making it easier for us to import > your data into R), the answer is: I am preparing for the data analysis, writing the code (knowing I may have to modify it later) while the data a

Re: [R] scatterplot matrix question

2010-01-02 Thread William Simpson
On Sat, Jan 2, 2010 at 4:55 PM, Charles C. Berry wrote: > On Sat, 2 Jan 2010, William Simpson wrote: > >> I would like a scatterplot matrix and a correlation matrix for the >> following set-up. >> The data (dataframe d) are like this: >> >> angle resp &g

[R] scatterplot matrix question

2010-01-02 Thread William Simpson
I would like a scatterplot matrix and a correlation matrix for the following set-up. The data (dataframe d) are like this: angle resp -90 182 -60 137 -30 ...etc 0 30 60 90 ...etc I would like each cell in the matrix to be the scatterplot of the responses for each pair of angles (

Re: [R] fft and filtering puzzle

2009-11-28 Thread William Simpson
Yep, that was it. Needed to remove neg freq from opposite end of s[] coef<- 1-(((1:n)>8-1) & ((1:n)<8+1) | (((1:n)>(n-6)-1) & ((1:n)<(n-6)+1)) ) Sorry to bother you. Cheers Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/li

Re: [R] fft and filtering puzzle

2009-11-28 Thread William Simpson
n Sat, Nov 28, 2009 at 9:53 AM, William Simpson wrote: > I am puzzled by a filtering problem using fft(). I don't blame R. > > I have a waveform y consisting of the sum of 2 sinewaves having freqs f1 and > f2. > I do s = fft() of y. > Remove s's spike at freq=f2

[R] fft and filtering puzzle

2009-11-28 Thread William Simpson
I am puzzled by a filtering problem using fft(). I don't blame R. I have a waveform y consisting of the sum of 2 sinewaves having freqs f1 and f2. I do s = fft() of y. Remove s's spike at freq=f2 Do inverse fft on s. The resulting waveform still has a lot of f2 in it! But the filtering should have

Re: [R] name of a name

2009-11-19 Thread William Simpson
this, > > > d <- data.frame(a=1:4, b=3:6) > > var <- "a" > > mean(d[var]) > > ## or, if you are not aware of > ## fortune("parse") > > xx <- paste("d$",var, sep="") > mean(eval(parse(text=xx))) > > HTH, >

[R] name of a name

2009-11-19 Thread William Simpson
I have quite a complicated problem that's hard to describe. Suppose I have a dataframe d. I want to access the vector d$var, where var is one of the variables in d. Just take for granted that there's a good reason I want to do this as follows. var<-"DeOxyA" xx<-paste("d$",var, sep="") mean(xx) [1

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
OK thanks, I look at sleep and get it Bill On Fri, Oct 23, 2009 at 12:21 PM, Peter Dalgaard wrote: > William Simpson wrote: >>> As I understand it, they don't come in pairs anyway. >> Correct. >> >>> For the same reason >>> a data frame is just

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
Thanks Jim. BTW the times in x and y are in ascending order (time of occurrence). If I do it this way, how do I actually read the data in and store in the file? Toy code, please. Bill > > Hi Bill, > > xy<-list(x=1:10,y=1:100) > > Note that this cheerfully ignores how you are going to figure out

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
> As I understand it, they don't come in pairs anyway. Correct. > For the same reason > a data frame is just the wrong kind of data structure. If you don't want > separate data files, you can use one file with two columns where the > second column is (say) 1 for the x and 2 for the y. Could you ex

Re: [R] data file with columns of unequal length

2009-10-23 Thread William Simpson
The way you do it is to compute the cross-intensity function (you can google this; a key name is David Brillinger). The general problem is that of system identification for point processes. Bill On Fri, Oct 23, 2009 at 10:31 AM, Jim Lemon wrote: > On 10/23/2009 07:58 PM, William Simpson wr

[R] data file with columns of unequal length

2009-10-23 Thread William Simpson
I am running an expt that presents a point process input x and measures a point process output y. The times of each event are recorded. The lengths of the data records of x and y are necessarily different, and can be different by a factor of 10. I would like to save these data after each experiment

Re: [R] three related time series with different resolutions

2009-10-21 Thread William Simpson
I wasn't clear: x and z are pulse *trains* with irregular gaps between pulses. > > x is a rectangular pulse 4 sec long. Its onset and offset are known > with sub-millisecond precision. The onset varies irregularly -- it > doesn't fall on neat 1/2 sec or sec boundaries for example. > > y is a sampl

Re: [R] three related time series with different resolutions

2009-10-21 Thread William Simpson
PS I think one way to get the average waveforms I want from the analysis is using cross-correlation, but again the multiple scale problem is present. On Wed, Oct 21, 2009 at 9:56 AM, William Simpson wrote: > I have three time series, x, y, and z, and I want to analyse the > relations b

[R] three related time series with different resolutions

2009-10-21 Thread William Simpson
I have three time series, x, y, and z, and I want to analyse the relations between them. However, they have vastly different resolutions. I am writing to ask for advice on how to handle this situation in R. x is a stimulus, and y and z are responses. x is a rectangular pulse 4 sec long. Its onset

Re: [R] correlation between two 2D point patterns?

2009-08-31 Thread William Simpson
> > Chuck > > On Sun, 30 Aug 2009, William Simpson wrote: > >> Suppose I have two sets of (x,y) points like this: >> >> x1<-runif(n=10) >> y1<-runif(n=10) >> A<-cbind(x1,y1) >> >> x2<-runif(n=10) >> y2<-runif(n=10) >>

[R] correlation between two 2D point patterns?

2009-08-29 Thread William Simpson
Suppose I have two sets of (x,y) points like this: x1<-runif(n=10) y1<-runif(n=10) A<-cbind(x1,y1) x2<-runif(n=10) y2<-runif(n=10) B<-cbind(x2,y2) I would like to measure how similar the two sets of points are. Something like a correlation coefficient, where 0 means the two patterns are unrelate

Re: [R] another matrix problem

2009-07-05 Thread William Simpson
; Try this (ignore the warning): >> >> k <- 3 >> matrix(1:5, 9, k)[1:5, ] >> >> >> On Sun, Jul 5, 2009 at 8:54 AM, William >> Simpson wrote: >>> I want a function that takes an input vector, the number of columns >>> and returns a m

[R] another matrix problem

2009-07-05 Thread William Simpson
I want a function that takes an input vector, the number of columns and returns a matrix as follows. x<- 1:5 foo(x, nc=3) 1 5 4 2 1 5 3 2 1 4 3 2 5 4 3 Thanks again for any help. Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] matrix problem

2009-07-05 Thread William Simpson
Thanks everyone for your help! Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducib

Re: [R] matrix problem

2009-07-04 Thread William Simpson
= 4) > > HTH, > > Jorge > > > On Sat, Jul 4, 2009 at 11:59 AM, William Simpson > wrote: >> >> Thanks everyone for the help. >> >> I should have said that I want to do this generally, not as a one-off. >> So I want a function to do it. Like this

Re: [R] matrix problem

2009-07-04 Thread William Simpson
Thanks everyone for the help. I should have said that I want to do this generally, not as a one-off. So I want a function to do it. Like this tp<-function(x, nr, nc) { matrix( c(x,rep(0, nr-length(x)+1)), nrow=nr, ncol=nc) } tp(x=c(1,2), nr=5, nc=4) This one looks good -- the warning message i

[R] matrix problem

2009-07-04 Thread William Simpson
Can anybody please tell me a good way to do the following? Given a vector, number of rows and number of columns, return a matrix as follows. Easiest to give an example: x=c(1,2), nrow=5, ncol=4 return the matrix: 1 0 0 0 2 1 0 0 0 2 1 0 0 0 2 1 0 0 0 2 Thanks very much for any h

Re: [R] noisy quantisation; Bernoulli scheme

2009-05-05 Thread William Simpson
If I am right, the original version was a sinusoidally-modulated (nonstationary) Bernoulli process. I want 3 possible values, not 2, which makes it a "Bernoulli scheme" http://en.wikipedia.org/wiki/Bernoulli_scheme Not sure how to the create a sinusoidally modulated Bernoulli scheme with values 0,

Re: [R] noisy quantisation

2009-05-05 Thread William Simpson
If this helps, here is what I have currently mean.p<- .5 contrast<-1 amp<- contrast*mean.p freq<- 3 n<- 100 p<-amp*cos(2*pi*freq*(1:n)/n ) + mean.p plot(p) dens<-as.numeric(runif(1:n)https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guid

[R] noisy quantisation

2009-05-05 Thread William Simpson
The following creates a point process version of a sinewave (maybe there's a better way): p<-amp*cos(2*pi*freq*(1:n)/n ) + 0.5 as.numeric(runif(1:n)https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minim

Re: [R] broken example: lme() + multcomp() Tukey on repeated measures design

2009-04-22 Thread William Simpson
Thanks for the helpful replies. I will try updating R and see how it goes. MASS, nlme, multcomp are all the most recent. Bill On Tue, Apr 21, 2009 at 3:12 PM, William Simpson wrote: > I am trying to do Tukey HSD comparisons on a repeated measures expt. > I found the following example on

[R] broken example: lme() + multcomp() Tukey on repeated measures design

2009-04-21 Thread William Simpson
I am trying to do Tukey HSD comparisons on a repeated measures expt. I found the following example on r-help and quoted approvingly elsewhere. It is broken. Can anyone please tell me how to get it to work? I am using R 2.4.1. > require(MASS) ## for oats data set > require(nlme) ## for lme() > req

[R] lme for between-within anova

2009-04-21 Thread William Simpson
I have the following between-within anova: aovn1 <- aov(amplitude ~ stereo*site*stimulus + Error(subject/(site*stimulus)), stereon1) This works fine. BUT I need to do Tukey HSD multiple comparisons, and the aov() approach won't work. So I am trying the method posted on r-help: lmen1 <- lme(amplitu

[R] line wrap in R console under windows

2009-04-21 Thread William Simpson
I would like the R console to wrap lines at 80 cols. It does not do so, even though I have used the Rgui Configuration Editor to set the Console cols at 80 and the Pager cols at 80. Please tell me how to set it up so I have word wrap. Just to be clear: in older/other R versions, console input is

Re: [R] plot with pairwise joined points

2009-02-26 Thread William Simpson
Thanks very much Rolf, Dimitris, & Greg! Bill On Thu, Feb 26, 2009 at 8:56 PM, Rolf Turner wrote: > > On 27/02/2009, at 9:46 AM, William Simpson wrote: > >> I would like to do as follows >> plot(a,b) >> points(c,d,pch=19) >> >> Now join with a line

[R] plot with pairwise joined points

2009-02-26 Thread William Simpson
I would like to do as follows plot(a,b) points(c,d,pch=19) Now join with a line segment point a[1], b[1] to c[1], d[1]; a[2], b[2] to c[2], d[2] ... a[n], b[n] to c[n], d[n] All corresponding points from the two data sets are joined by line segments. Thanks very much for any tips on how to do th

[R] scatterplot and correlation for weird data format

2009-02-16 Thread William Simpson
I have data in a format like this: namessexsex viewnum rating rt ahl4f m f 56 -1082246 ahl4f m f 74 85 1444 ahl4f m f 52 151 1595 ahl4f m f 85 1 1447

Re: [R] glm binomial loglog (NOT cloglog) link

2009-01-24 Thread William Simpson
I wish to write a new link function for a GLM. R's glm routine does not supply the "loglog" link. I modified the make.link function adding the code: }, loglog = { linkfun <- function(mu) -log(-log(mu)) linkinv <- function(eta) exp(-exp(-eta)) mu.eta <- function(eta)

[R] glm binomial loglog (NOT cloglog) link

2009-01-23 Thread William Simpson
I would like to do an R glm() with family = binomial(link="loglog") Right now, the cloglog link exists, which is nice when the data have a heavy tail to the left. I have the opposite case and the loglog link is what I need. Can someone suggest how to add the loglog link onto glm()? It would be lov

Re: [R] convert dataframe to matrix for cmdscale

2008-12-10 Thread William Simpson
9 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote: > Try this: > > x$zMean <- ave(x$z, >apply(x[,1:2], 1, function(x)paste(sort(x), > collapse = "")), >FUN = mean) > > xtabs(zMean ~ x + y, data = x

Re: [R] convert dataframe to matrix for cmdscale

2008-12-10 Thread William Simpson
On re-reading ?cmdscale I see that I can also use cmdscale(d) on a full matrix rather than just the lower triangle. d: a distance structure such as that returned by 'dist' or a full symmetric matrix containing the dissimilarities. So how to get a full symmetric matrix from a dataframe l

[R] convert dataframe to matrix for cmdscale

2008-12-10 Thread William Simpson
I have a dataframe like this (toy example): x y z "a" "a" 0 "a" "b" 1 "a" "c" 2 "b" "a" .9 "b" "b" 0 "b" "c" 1.3 "c" "a" 2.2 "c" "b" 1.1 "c" "c" 0 The observations are from a matrix like this: c 2.2 1.1 0.0 b 0.9

Re: [R] intercept of 3D line? (Orthogonal regression)

2008-09-02 Thread William Simpson
> > and under regular assumptions about ei's end di's we get a standard > regression problem (note that b is unknown to you but is constant). > > > --- On Tue, 2/9/08, William Simpson <[EMAIL PROTECTED]> wrote: > >> From: William Simpson <[EMAI

[R] intercept of 3D line? (Orthogonal regression)

2008-09-01 Thread William Simpson
I posted before recently about fitting 3D data x, y, z where all have error attached. I want to predict z from x and y; something like z = b0 + b1*x + b2*y But multiple regression is not suitable because all of x, y, and z have errors. I have plotted a 3D scatterplot of some data using rgl. I see

[R] convert princomp output to equation for plane?

2008-08-27 Thread William Simpson
I want to fit something like: z = b0 + b1*x + b2*y Since x, y,and z all have measurement errors attached, the proper way to do the fit is with principal components analysis, and to use the first component (called loadings in princomp output). My dumb question is: how do I convert the princomp out

Re: [R] g(x,y) = f(x,y) - e(x)- e(y)?

2008-04-26 Thread William Simpson
Thanks everyone for the help. Greg, I posted the equation from Prof Brillinger's paper. To me it is not clear how or why to subtract a vector from a matrix (since they have diff dimensions). That's why I posted my question to the experts here! Anyway, I have some answers now. Cheers Bill On Wed

Re: [R] g(x,y) = f(x,y) - e(x)- e(y)?

2008-04-23 Thread William Simpson
Thanks Phipp very much for your help. I had meant, given that I'd computed the matrix f[x,y] and the vector e[x], how to take the difference. What is confusing is how to subtract a vector from a matrix. I don't want the recycling rule. Cheers Bill On Tue, Apr 22, 2008 at 9:53 AM, Philipp Pagel <[

[R] g(x,y) = f(x,y) - e(x)- e(y)?

2008-04-22 Thread William Simpson
Hi everyone, The following is mysterious to me. David Brillinger (famous statistician at Berkeley) has an equation in a paper that is essentially g(x,y) = f(x,y) - e(x)- e(y) These are continuous functions. I am not sure how to do this with the discrete equivalents in R. Please tell me how to do w

Re: [R] matrix problem

2008-04-21 Thread William Simpson
Thanks very much Petr and Rold for your helpful replies. Cheers Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, mi

Re: [R] another matrix question

2008-04-21 Thread William Simpson
Thanks Julien & Rolf for your help. The double commas were just typos. Bill __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commen

[R] another matrix question

2008-04-21 Thread William Simpson
Hi everyone, I would like to do the following. Given matrix m and matrix n, I would like to compute mn[i,,j]= m[i,,j] + n[i,,j] if either of these elements is 0. (In other words, whichever number is nonzero.) Else I want mn[i,,j]=(m[i,,j] + n[i,,j])/2 I need a fast method. Thanks very much for a

[R] matrix problem

2008-04-21 Thread William Simpson
Hi Everyone, I am running into a problem with matrices. I use R version 2.4.1 and an older version. The problem is this: m<-matrix(ncol=3,nrow=4) m[,1:3]<-runif(n=4) That does what I expect; it fills up the rows of the matrix with the data vector > m [,1] [,2] [,3] [1,] 0.208

[R] read complicated file

2007-11-15 Thread William Simpson
Dear R experts, I have been given data files in the following configuration and have been puzzling about how to read them in. First I will give a snippet of the beginning of file: Data File: W Para File: GABOR_0.gor v 10.6, Date : 29/10/2007 Time : 13:33 3.00 5.000 Noise SD(deg): 15.