[R] Converting edgelist to symmetric matrix

2011-04-09 Thread Shafique, M. (UNU-MERIT)
Hi, I have network data in the form of a couple of edgelists containing weights in the format "x,y,weight" whereby x represents row header and y represents column header. All edgelists are based on links among 634 nodes and I need to convert them into a 634*634 weighted matrix. I searched for

[R] look for the package of latent class stochastic frontier

2011-04-09 Thread 李德洗
Dear all, I want to finished my paper by latent class Stochastic Frontier Analysis , but i can not find the package, is there anyone that may help me Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list http

Re: [R] Package mice: Error in if (meth[j] != "") { : argument is of length zero

2011-04-09 Thread Joshua Wiley
On Fri, Apr 8, 2011 at 2:56 PM, Rita Carreira wrote: > > Dear R users, > I am using package mice and I am getting the error " > Error in if (meth[j] != "") { : argument is of length zero." I have tried > using several different versions of R (even the one that will be coming out > this month) to

Re: [R] survival object

2011-04-09 Thread Joshua Wiley
On Sat, Apr 9, 2011 at 7:36 PM, Eugenio Larios wrote: > Hi All, > > I am trying to do a survivorship analysis with library(survival)from a data > set that looks like this: > I followed a bunch of naturally germinated seedlings of an annual plant from > germination to death (none made it to reprodu

Re: [R] Yearly aggregates and matrices

2011-04-09 Thread Gabor Grothendieck
On Sat, Apr 9, 2011 at 11:45 PM, Gabor Grothendieck wrote: > On Sat, Apr 9, 2011 at 5:14 AM, mathijsdevaan wrote: >> Hi, >> >> I need to perform calculations on subsets of a data frame: >> >> DF = data.frame(read.table(textConnection("    A  B  C  D  E  F >> 1 a  1995  0  4  1 >> 2 a  1997  1  1

Re: [R] Yearly aggregates and matrices

2011-04-09 Thread Gabor Grothendieck
On Sat, Apr 9, 2011 at 5:14 AM, mathijsdevaan wrote: > Hi, > > I need to perform calculations on subsets of a data frame: > > DF = data.frame(read.table(textConnection("    A  B  C  D  E  F > 1 a  1995  0  4  1 > 2 a  1997  1  1  3 > 3 b  1995  3  7  0 > 4 b  1996  1  2  3 > 5 b  1997  1  2  3 > 6

[R] survival object

2011-04-09 Thread Eugenio Larios
Hi All, I am trying to do a survivorship analysis with library(survival)from a data set that looks like this: I followed a bunch of naturally germinated seedlings of an annual plant from germination to death (none made it to reproduce, and died in a period of ~60 days after germination.) I also kn

Re: [R] Adding margin text to lattice graphics

2011-04-09 Thread baptiste auguie
Hi, You may want to read about ?viewport in the grid package. They allow you to position graphical elements wherever you want on a page, such as lattice plots and text (grid.text). For a high-level interface, you could try the following, library(gridExtra) library(lattice) p1 = xyplot(1~1) p2 =

[R] Adding margin text to lattice graphics

2011-04-09 Thread Dennis Fisher
Colleagues I am learning lattice graphics (R 2.12.2; OS X). Several days ago, I inquired about adding margin text to lattice graphics. Jim Price offered a useful reply, suggesting that I add: page = function(page) grid.text('words', x = 0.5, y = 0.01) to my call to the function. The e

Re: [R] loop and sapply problem, help need

2011-04-09 Thread jim holtman
try this: > x <- read.table(textConnection(" + mark lcd1 lcd2 lcd3 PR1 PR2 PR3 PR4 + 1 11 22 12 1 2 3 1 + 2 33 44 34 1 2 3 1 + 3 22 44 24 3 1 2 1 + 4 11 33 13 2 2 1 3 + 5 22 11 12 3 2 2 1 "), header = TRUE) > closeAllConnections() > x # before mark lcd1 lcd2 lcd3 PR1 PR2 PR3 PR4 11 11

Re: [R] loop and sapply problem, help need

2011-04-09 Thread Ram H. Sharma
Hi Phil and R users Let me clear my problem. The generating sample is not prime issue here. I am simulating a situation, for which I need to sample. But once I have sampling done, I need to do a conditional decoding. Let me clear it with more clear data example: x <- read.table(textConnection(" m

Re: [R] integration

2011-04-09 Thread cindy Guo
'integrate' does not allow parameter limits. For example, the limits of x is (z/y, Inf) while z and y are unkonwn. On Fri, Apr 8, 2011 at 9:46 PM, Ravi Varadhan wrote: > ?integrate > > > From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On

Re: [R] In need of help with correlations

2011-04-09 Thread Tóth Dénes
I do not know the bioconductor packages you mentioned, but the corr.test function in the psych package, or the rcorr function in the Hmisc package should do the work. Also note that the c() in method=c("pearson") is redundant. Just write method="pearson" instead (or nothing, since this is the defa

Re: [R] Robust Statistics for Outlier Detection

2011-04-09 Thread Bert Gunter
On Sat, Apr 9, 2011 at 7:09 AM, ufuk beyaztas wrote: > Hi Dear All, > > Can someone give me a suggestion about which robust statistics are mosttask > view > appropriate for outlier detection in linear models, and is available with R > ? > No. Do it yourself by going to the "Robust" task view on

Re: [R] loop and sapply problem, help need

2011-04-09 Thread Phil Spector
Ram - I think you'll have to explain what you're trying to do. First, you're creating a 10x10 matrix newd, which could be done a bit more efficiently by using newd = matrix(sample(c(1,2,3,3,),10*length(pvec),replace=TRUE),ncol=10) Notice that calling sapply on a matrix applies the f

[R] loop and sapply problem, help need

2011-04-09 Thread Ram H. Sharma
Dear R experts Sorry for this question M1 <- 1:10 lcd1 <- c(11, 22, 33, 44, 11, 22, 33, 33, 22, 11) lcd2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22) lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12) #generating variables through sampling pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7

[R] In need of help with correlations

2011-04-09 Thread Sean Farris
I am in need of someone's help in correlating gene expression. I'm somewhat new to R, and can't seem to find anyone local to help me with what I think is a simple problem. I need to obtain pearson and spearman correlation coefficients, and corresponding p-values for all of the genes in my dataset

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
This solves the problem. fibs = function() { fibNumbers = 0:1 fib = function(n) { print(n) n[n<1] <- 1 cat("again: ", n, fill=TRUE) ifelse(n <= length(fibNumbers), fibNumbers[n], fibNumbers[n] <- fib(n-1) + fib(n-2)) } } >x <- fibs() >x(5:

Re: [R] Adding text labels to lattice plots with multiple panels

2011-04-09 Thread Jeff Stevens
Hi, Thanks for the work around, Dennis. My actual data set has 64 replicates for each factor level combination (rather than the 3 in the example), so the overplotting is quite messy. Any ideas on how to avoid the overplotting? Jeff On Fri, Apr 8, 2011 at 7:32 PM, Dennis Murphy wrote: > Hi: >

[R] Robust Statistics for Outlier Detection

2011-04-09 Thread ufuk beyaztas
Hi Dear All, Can someone give me a suggestion about which robust statistics are most appropriate for outlier detection in linear models, and is available with R ? Thanks for any idea. -- View this message in context: http://r.789695.n4.nabble.com/Robust-Statistics-for-Outlier-Detection-tp343849

Re: [R] Problem with pairs() in nlme

2011-04-09 Thread Mark Difford
Apr 08, 2011; 11:05pm dgmaccon wrote: >> I get the same error: >> Error in function (classes, fdef, mtable) : >> unable to find an inherited method for function "lmList", for signature >> "formula", "nfnGroupedData" I get no such error. You need to provide more information (platform &c.) ##

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
I attempted to vectorize the preceding as follows. fibs = function() { fibNumbers = 0:1 fib = function(n) { print(n) ifelse(n <= length(fibNumbers), fibNumbers[n], fibNumbers[n] <- fib(n-1) + fib(n-2)) } } Unless I'm misunderstanding what's going on,

Re: [R] best practice(s) for retrieving a local variable from a closure

2011-04-09 Thread Gabor Grothendieck
On Sat, Apr 9, 2011 at 3:27 PM, Barry Rowlingson wrote: > On Sat, Apr 9, 2011 at 6:29 PM, Benjamin Tyner wrote: > >>> The above feels a bit like snooping where I wasn't invited. >>> You could do something like >>>  mq <- function(a) { >>>     force(a) >>>     list(getA = function()a, >>>        

Re: [R] best practice(s) for retrieving a local variable from a closure

2011-04-09 Thread Barry Rowlingson
On Sat, Apr 9, 2011 at 6:29 PM, Benjamin Tyner wrote: >> The above feels a bit like snooping where I wasn't invited. >> You could do something like >>  mq <- function(a) { >>     force(a) >>     list(getA = function()a, >>          setA = function(newA) a <<- newA, >>          fun = function(x)x^

Re: [R] Cointegration test of panel data

2011-04-09 Thread Pete Brecknock
You could try the "urca" package Also, I would maybe have a look a the CRAN Task View on computational econometrics at http://cran.r-project.org/web/views/Econometrics.html HTH Pete -- View this message in context: http://r.789695.n4.nabble.com/Cointegration-test-of-panel-data-tp3438783p34388

[R] Cointegration test of panel data

2011-04-09 Thread Serdar Akin
Hi Does anyone know if there's a package for unit-root and cointegration test in R? Regards Serdar [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

Re: [R] Adding text labels to lattice plots with multiple panels

2011-04-09 Thread Peter Ehlers
On 2011-04-09 06:21, Dennis Murphy wrote: Hi: One hopes that there is a more elegant solution than this bit of ad-hockery. From your posted example: f1<- c(rep(c(rep("a", 3), rep("b", 3), rep("c", 3)), 2)) f2<- c(rep("A", 9), rep("B", 9)) dv<- c(0.9, 0.8, 0.85, 0.6, 0.65, 0.7, 0.8, 0.85, 0.8,

Re: [R] best practice(s) for retrieving a local variable from a closure

2011-04-09 Thread Benjamin Tyner
Thanks Bill and Gabor! William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Benjamin Tyner Sent: Friday, April 08, 2011 6:48 PM To: r-help@r-project.org Subject: [R] best practice(s) for retrieving a local variab

[R] Orthoblique rotation on eigenvectors (SAS VARCLUS)

2011-04-09 Thread Axel Urbiz
Hi All, I'd like to build a package for the community that replicates the output produced by SAS "proc varclus". According to the SAS documentation, the first few steps are: 1. Find the first two principal components. 2. Perform an orthoblique rotation (quartimax rotation) on eigenvectors. 3. Ass

Re: [R] By function

2011-04-09 Thread Liviu Andronic
Hello On Fri, Apr 8, 2011 at 12:38 AM, Raoni Rodrigues wrote: > Hello all! > > I have a data frame with nine variables and 293 cases. (attached goes > the csv file). > The CSV didn't get through so it's difficult to replicate your example. Please post the output of: str(cpue) > I need to calcul

Re: [R] multinom() residual deviance

2011-04-09 Thread Bill.Venables
The residual deviance from a multinomial model is numerically equal (up to round-off error) to that you would get had you fitted the model as a surrogate Poisson generalized linear model. Here is a short demo building on your example > set.seed(101) > df <- data.frame(f = sample(letters[1:3], 5

Re: [R] Adding text labels to lattice plots with multiple panels

2011-04-09 Thread Dennis Murphy
Hi: One hopes that there is a more elegant solution than this bit of ad-hockery. >From your posted example: f1 <- c(rep(c(rep("a", 3), rep("b", 3), rep("c", 3)), 2)) f2 <- c(rep("A", 9), rep("B", 9)) dv <- c(0.9, 0.8, 0.85, 0.6, 0.65, 0.7, 0.8, 0.85, 0.8, 0.95, 0.85, 0.9, 0.65, 0.7, 0.75, 0.85,

Re: [R] Trouble with Sweave and Beamer

2011-04-09 Thread Lorenzo Isella
Hello, And thanks for the prompt reply. I also bumped into this thread shortly after posting http://bit.ly/eLg3QV where it looks like that the "fragile" option gets the job done (at least on my machine for my example), though I do not know (yet) what it stands for. I will post again if I have

Re: [R] glm with multiple vars

2011-04-09 Thread Sascha Vieweg
On 11-04-09 10:34, dirknbr wrote: I am looping through various models with different combinations of independent variables which are stored as columns in x glm(y ~ ??, data=x) How can I pass the colnames of the selected columns of x into ?? seperating them with a + ie I want to generate glm(

Re: [R] Trouble with Sweave and Beamer

2011-04-09 Thread Duncan Murdoch
On 11-04-09 8:25 AM, Lorenzo Isella wrote: Dear All, I am running Debian testing on my box and I installed latex and R from the standard repositories. I am trying my hands at sweave, but somehow I am experiencing problems (I am trying to use beamer and Sweave). Please see the snippet at the end o

Re: [R] Problem Installing rJava on MS Win 7 Platform

2011-04-09 Thread Duncan Murdoch
On 11-04-09 8:00 AM, Stephen P. Molnar wrote: That's true. However, Java is installed on the machine. The installation instructions ask for the Java Development Kit, "JDK". From the messages below, that's not installed. Duncan Murdoch On Thu, 7 Apr 2011 14:40:54 -0400 David Winsemius wr

[R] Trouble with Sweave and Beamer

2011-04-09 Thread Lorenzo Isella
Dear All, I am running Debian testing on my box and I installed latex and R from the standard repositories. I am trying my hands at sweave, but somehow I am experiencing problems (I am trying to use beamer and Sweave). Please see the snippet at the end of the email and saved as report.Rnw. Whe

Re: [R] Problem Installing rJava on MS Win 7 Platform

2011-04-09 Thread Stephen P. Molnar
That's true. However, Java is installed on the machine. On Thu, 7 Apr 2011 14:40:54 -0400 David Winsemius wrote: > He said "Java", not "rJava. > > On Apr 7, 2011, at 11:51 AM, Stephen P Molnar wrote: > > > Thanks for the reply. > > > > Yes, you are quite correct, but: > > > >> install.package

[R] glm with multiple vars

2011-04-09 Thread dirknbr
I am looping through various models with different combinations of independent variables which are stored as columns in x glm(y ~ ??, data=x) How can I pass the colnames of the selected columns of x into ?? seperating them with a + ie I want to generate glm(y ~ x1 + x2, data=x) glm(y ~ x2 + x3,

[R] Yearly aggregates and matrices

2011-04-09 Thread mathijsdevaan
Hi, I need to perform calculations on subsets of a data frame: DF = data.frame(read.table(textConnection("A B C D E F 1 a 1995 0 4 1 2 a 1997 1 1 3 3 b 1995 3 7 0 4 b 1996 1 2 3 5 b 1997 1 2 3 6 b 1998 6 0 0 7 b 1999 3 7 0 8 c 1997 1 2 3 9 c 1998 1 2

Re: [R] R and lazy evaluation

2011-04-09 Thread Russ Abbott
The following doesn't rely on lazy evaluation, but it accomplishes something similar by taking advantage of R's closure capability. >fibs = function() { fibNumbers = 0:1 fib = function(n) { if (n <= length(fibNumbers)) return(fibNumbers[n]) fibNumbers[n] <- fib(n-1) + fib(n-2) retu

[R] How do I make this faster?

2011-04-09 Thread Hasan Diwan
I was on vacation the last week and wrote some code to run a 500-day correlation between the Nasdaq tracking stock (QQQ) and 191 currency pairs for 500 days. The initial run took 9 hours(!) and I'd like to make it faster. So, I'm including my code below, in hopes that somebody will be able to figur

Re: [R] help question

2011-04-09 Thread David Winsemius
On Apr 8, 2011, at 3:20 PM, DEBERGH Patrick wrote: hello I am at the very beginneing of using the R program I just don't understand how one can save a programfile For exemple, if I type in R 23+456 and want to save this file under a ceratin name to reload it later, i just don't get the wa

Re: [R] a strange behavior with ifelse

2011-04-09 Thread Jim Lemon
On 04/09/2011 03:56 AM, wgu wrote: I have used R for years but run into a seemingly simple problem involving 'ifelse'. condensed code like this a=c(2,NA,NA,NA,2,2,NA,2,NA,2) b=c(NA,1,1,NA,2,2,2,2,2,2) #I want to combined a and b into c so that c would be a valid number either a or b is n

[R] For->lapply->parallel apply

2011-04-09 Thread Alaios
Dear all, I would like to ask your help understand the subsequent steps for making my program faster. The following code: Gauslist<-array(data=NA,dim=c(dimx,dimy,dimz)) for (i in c(1:dimz)){ print(sprintf('Creating the %d map',i)); Gauslist[,,i]<-f <- GaussRF(x=x, y=y, model=model, grid=

Re: [R] A question about "txtProgressBar" function

2011-04-09 Thread Berend Hasselman
Li, Yunfei wrote: > > Hi, > > I tried to add a progress bar to my script, but it seems the > "txtProgressBar" function will wipe out what I want to print before it(for > example - the "Hello" in following script), and the parameters "title" and > "label" do not work either. How can I put a title

Re: [R] multinom() residual deviance

2011-04-09 Thread Sascha Vieweg
Hello I am aware of the differences between the two models, excuse me for being imprecise on that in my first posting. My question only regards the "nature" or "structure" of the deviance, and thus whether the residual deviance of the multinomial model is the same residual deviance as reporte