Re: [R] function for rowMedian?

2006-01-22 Thread Philippe Grosjean
Prof Brian Ripley wrote: Interchange 1 and 2 (see ?apply: Andy was answering the subject line, not that in the body). However, Max asked also for column medians of a data frame, for which use sapply(DF, median) By the way, what is the preferred code for column-wise calculation on *all

[R] Error in 1:object$rank : NA/NaN argument

2006-01-22 Thread Steffen Katzner
can anybody help with the following error message: Error in 1:object$rank : NA/NaN argument I get it with comparisons of single means in an ANOVA. Example data below. Thanks, Steffen seven subjects participated in each of 6 conditions (intervals). subject = factor(rep(c(1:7), each = 6))

Re: [R] function for rowMedian?

2006-01-22 Thread Prof Brian Ripley
On Sun, 22 Jan 2006, Philippe Grosjean wrote: Prof Brian Ripley wrote: Interchange 1 and 2 (see ?apply: Andy was answering the subject line, not that in the body). However, Max asked also for column medians of a data frame, for which use sapply(DF, median) By the way, what is the

Re: [R] Making a markov transition matrix

2006-01-22 Thread Bill.Venables
That solution for the case 'with gaps' merely omits transitions where the transition information is not for a single time step. (Mine can be modified for this as well - see below.) But if you know that a firm went from state i in year y to state j in year y+3, say, without knowing the

[R] Rank Product

2006-01-22 Thread Nadege Nana
Hello Guys, I'm using the package RankProduct to determine the differential expression of genes in 2 classes. The importance of the thing is to know: - How can I determine which class is the class of up-regulated genes and which to the down regulated gene -

[R] White Noise

2006-01-22 Thread Laura Quinn
I'm wanting to create a series of near-identical matrices via the addition of white noise to my starting matrix. Is there a function within R which will allow me to do this? Thank you Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT

[R] Application of R and MNP

2006-01-22 Thread Andy Wong
Dear all, I'm a new user of R and MNP. Would anybody advise me what I have done wrong to the input or data. When I add the R7, it said that there is an error SWP:singular matrix. I can add up to R6 only. Copy of the R console is attached for your reference. Thanks. Andy mywork.pdf

Re: [R] Application of R and MNP

2006-01-22 Thread John Fox
Dear Andy, You appear to have 7 observations and 8 explanatory variables in the model. You'd be in trouble even if this were a linear model fit by least squares. Moreover, each observation has a different value of the response variable -- that, is the response has 7 levels. Did you really intend

[R] Difference between two correlation coefficients

2006-01-22 Thread Alexandre Santos Aguiar
Hi, I've been interested in testing differences between correlation coefficients and as a newcomer to R it occured to me building a library to perform such tests. However, before enganging on the project I need to know if there are such library functions already available and if so which they

Re: [R] White Noise

2006-01-22 Thread jim holtman
Is this what you want by adding a random number to the values? x - matrix(1:9, ncol=3) x [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 x + runif(9, -.1, .1) [,1] [,2] [,3] [1,] 0.9577315 3.927673 6.953332 [2,] 2.0530684 5.072495 8.076258 [3,]

Re: [R] White Noise

2006-01-22 Thread Ted Harding
On 22-Jan-06 Laura Quinn wrote: I'm wanting to create a series of near-identical matrices via the addition of white noise to my starting matrix. Is there a function within R which will allow me to do this? Thank you Laura Quinn The short ansdwer is: Yes, just do it as you descibe! For

[R] NAs in optim

2006-01-22 Thread Hannu Kahra
Hi, I am trying to maximize a utility function using optim. I have a problem with optim, since some of the values in the caw, mom, me and btm matrixes in the code bellow are missing. Is there a handy way just to skip the missing values in the loop? g - 5 retp - NULL object - function (x) {

[R] Solve for x in Ax=B with vectors, not matrices

2006-01-22 Thread Lapointe, Pierre
Hello R-helpers, What I have: I am working with vectors not matrice: #Basic equations A -c(-20,-9,-2) x -c(0.17,0.22,0.61) B - crossprod(A,x) # R matrix multiplication works with vectors A%*%x==B# Is true... Question: If x is unknown and A and B are known, how do I solve for x in R?

[R] regression with nestedness

2006-01-22 Thread Jeffrey Stratford
Dear R-users, I set up an experiment where I put up bluebird boxes across an urbanization gradient. I monitored these boxes and at some point I pulled a feather from a chick and a friend used spectral properties (rtot, a continuous var) to index chick health. There is an effect of sex that I

Re: [R] Solve for x in Ax=B with vectors, not matrices

2006-01-22 Thread Ted Harding
On 22-Jan-06 Lapointe, Pierre wrote: Hello R-helpers, What I have: I am working with vectors not matrice: #Basic equations A -c(-20,-9,-2) x -c(0.17,0.22,0.61) B - crossprod(A,x) # R matrix multiplication works with vectors A%*%x==B # Is true... Question: If x is unknown and A

Re: [R] lme model specification

2006-01-22 Thread Spencer Graves
If you are now presenting subjects with pairs, have you considered multidimensional scaling and possibly Bradley-Terry models extensions? RSiteSearch(multidimensional scaling) and RSiteSearch(Bradley-Terry) both seemed to contain potentially useful information. best

Re: [R] change lattice panel background color

2006-01-22 Thread Paul Murrell
Hi Waichler, Scott R wrote: I can't find a way to change just the panel background color in lattice. I would like NA regions in levelplot() to appear black. I've tried the trellis.par.set() stuff, but it it makes the background of the whole graphic black. Here's an approach using a simple

[R] Execute a list of R instructions from a file

2006-01-22 Thread pau carre
Hello, I want to do the following: First, generate an R code in a file from an external program, then send the name of the file to R using sockets, finally let R to open that file and to execute the R code. I just wanted to know if there is any function in R that reads a file an executes the R

Re: [R] Execute a list of R instructions from a file

2006-01-22 Thread Gabor Csardi
source(file.txt) or even: source(http://my.server.com/my/r/commands;) Gabor On Sun, Jan 22, 2006 at 11:02:05PM +0100, pau carre wrote: Hello, I want to do the following: First, generate an R code in a file from an external program, then send the name of the file to R using sockets, finally

Re: [R] Making a markov transition matrix

2006-01-22 Thread Charles and Kimberly Maner
Ajay--you seem to have gotten your question answered regarding putting your dataframe in the correct format, etc. If you haven't already, you might want to check out the MSM package for multi-state Markov and hidden Markov models in continuous time. It's been quite useful for some of my work

Re: [R] Latest revision of lme4 requires 'Matrix' = 0.995.2 but that version is not available on CRAN

2006-01-22 Thread Søren Højsgaard
I see that Matrix, lme4 and SASmixed in zip format have been 'rolled back' to the previous versions - which I have now installed. Running library(SASmixed) data(Demand) example(Demand) gives Demand fm1Demand - lmer(log(d) ~ log(y) + log(rd) + log(rt) + log(rs) + (1 | State) + (1

[R] formatC slow? (or how can I make this function faster?

2006-01-22 Thread hadley wickham
I'm trying to convert a matrix of capture occasions to format that an external program can read. The job is to basically take a row of matrix, like smp[1,] [1] 1 1 0 1 1 1 0 0 0 0 and convert it to the equivalent string 110111 I'm having problems doing this in a speedy way. The simplest

Re: [R] Latest revision of lme4 requires 'Matrix' = 0.995.2 but that version is not available on CRAN

2006-01-22 Thread John Logsdon
I've just hit this problem as well and as I am slumming it on XP at the moment, I don't have the compilation tools to use the .tar.gz version. I also notice that the numbering format has changed. Is this intentional? Best wishes John John Logsdon Try to make

[R] will vectorization help in this case?

2006-01-22 Thread Nachiketa Sahoo
Hi all, I am doing a array marginalization over one dimension in the following manner: === for(l in 1:L) { flst=list(Pzu, Pzi, array(Puzu[,as.character(r[[l,u]])], dim=dim(Puzu)[1], dimnames=dimnames(Puzu)[1]),

[R] Fwd: will vectorization help in this case?

2006-01-22 Thread Nachiketa Sahoo
Hi all, The previous post had some html formatting and did not go through. So, here it is again in plain text. I am doing a array marginalization over one dimension in the following manner: === for(l in 1:L) { flst=list(Pzu, Pzi,

Re: [R] NAs in optim

2006-01-22 Thread Prof Brian Ripley
This is NAs in your own code, not in optim! Please use a truthful subject. Consider the use of sum(na.rm=TRUE) rather than your inner loop. On Sun, 22 Jan 2006, Hannu Kahra wrote: Hi, I am trying to maximize a utility function using optim. I have a problem with optim, since some of the

Re: [R] formatC slow? (or how can I make this function faster?

2006-01-22 Thread Prof Brian Ripley
First, your timings seem slow: even my laptop is using 0.4 secs. So the simple solution is to use a better computer. I would just write such things in C. The following runs in 0.01sec on my machine (timed by looping over it) system.time(.Call(Cpaste, smp)) using #include R.h #include

Re: [R] Latest revision of lme4 requires 'Matrix' = 0.995.2 but that version is not available on CRAN

2006-01-22 Thread Uwe Ligges
Søren Højsgaard wrote: I see that Matrix, lme4 and SASmixed in zip format have been 'rolled back' to the previous versions - which I have now installed. Running library(SASmixed) data(Demand) example(Demand) gives Demand fm1Demand - lmer(log(d) ~ log(y) + log(rd) + log(rt)