[R] Help with Iterator

2010-11-09 Thread zhiji19
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 { +

[R] Calculate Mean from List

2010-11-09 Thread Suphajak Ngamlak
Dear all, I have a list of correlation coefficient matrixes. Each matrix represents one date. For example A[[1]] A B C A 1 0.2 0.3 B 0.2 1 0.4 C 0.3 0.4 1

Re: [R] Row-wise recurive function call

2010-11-09 Thread Santosh Srinivas
Thanks this works. Only, I need to reference in the formula using indexes. -Original Message- From: Dimitris Rizopoulos [mailto:d.rizopou...@erasmusmc.nl] Sent: 09 November 2010 13:22 To: Santosh Srinivas Cc: r-help@r-project.org Subject: Re: [R] Row-wise recurive function call try

Re: [R] Help with Iterator

2010-11-09 Thread Nick Sabbe
I guess what you want is: - change the line : xnew-f(xold,data) into xnew-f(xold,data, itel) - change your mat function to take itel as an extra parameter: mat-function (x, data=NULL, itel) {return (1+x^itel)} That should do the trick (though I haven't checked whether the

Re: [R] how do i plot this hist?

2010-11-09 Thread Jim Lemon
Hi casperyc, While Jim Holtman's solution is quite neat, I thought I would add a multiple histogram to the discussion in case that was what you wanted: library(plotrix) barp(t(x.m[,2:5]),names.arg=x.m[,1],col=rainbow(4)) legend(20,2500,paste(V,2:5,sep=),fill=rainbow(4)) Jim

Re: [R] Calculate Mean from List

2010-11-09 Thread Dimitris Rizopoulos
one way is the following: A - replicate(10, cor(matrix(rnorm(30), 10, 3)), simplify = FALSE) triA - sapply(A, function (m) m[upper.tri(m)]) rowMeans(triA, na.rm = TRUE) I hope it helps. Best, Dimitris On 11/9/2010 9:23 AM, Suphajak Ngamlak wrote: Dear all, I have a list of correlation

Re: [R] : unusual combinations of categorical data

2010-11-09 Thread Jim Lemon
On 11/09/2010 09:25 AM, Alan Chalk wrote: Regarding unusual combinations of factors in categorical data. Are there any R packages that can be used to identify the outliers i.e. unusual combinations in categorical datasets ? Hi Alan, If your factors are dichotomous and you are looking for

[R] Creating a list to store output objects from a recursive loop

2010-11-09 Thread Santosh Srinivas
Dear Group, I am having a function that I am running in a loop that generated two results for each loop The result1 is a zoo object The result2 is a data frame Now I want to put both of them in a list or some structure ... that I can access or output to a file after the loop is done. For e.g.

[R] the formula of quantile regression for panel data, which is correct?

2010-11-09 Thread ywh123
Hi,everyone I have some trouble in understanding the formula. http://r.789695.n4.nabble.com/file/n3033305/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg http://r.789695.n4.nabble.com/file/n3033305/%E6%9C%AA%E5%91%BD%E5%90%8D1.jpg which is correct? best wish. thanks -- View this message in context:

[R] plot graph(quantile regression for panel data)

2010-11-09 Thread ywh123
Hi,everyone I have two group data. x=c(0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9) y=c(1,2,3,4,5,6,7,8,9) and the confidence interval of y [0.9,1.1],[1.9,2.1],[2.9,3.1] [3.9,4.1],[4.9,5.1],[5.9,6.1] [6.9,7.1],[7.9,8.1],[8.9,9.1] How can I get the graph? as follows

[R] convergence message SE calculation when using optim( )

2010-11-09 Thread Lorenzo Cattarino
Hi R-users, I am trying to estimate function parameters using optim(). My count observations follows a Poisson like distribution. The problem is that I wanna express the lambda coefficient, in the passion likelihood function, as a linear function of other covariates (and thus of other

[R] repeatedrepeated measures in ANOVA or mixed model

2010-11-09 Thread Paul Rheeder
dear List I have a dataset with blood measurements at 5 points in TIME (0,30,60,90,120) taken on 3 VISITS (same subjects). the interest is to compare these measurements between Visits, overall and at the different time points. I have problems setting up repeated measures ANOVA with 2 repeated

Re: [R] Help with Iterator

2010-11-09 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of zhiji19 Sent: Tuesday, November 09, 2010 12:02 AM To: r-help@r-project.org Subject: [R] Help with Iterator Dear Experts, The following is my Iterator. When I try to write

[R] Why doesn't ?match keep the original (x) data.frame order?

2010-11-09 Thread Tal Galili
Hello all, Following on my question here ( http://www.mail-archive.com/r-help@r-project.org/msg116075.html), I understand now that when using sort = FALSE the order of the merged data frame is unspecified. But why was it designed this way? Why not keep the original order (when possible)?

Re: [R] repeatedrepeated measures in ANOVA or mixed model

2010-11-09 Thread Tal Galili
Hi Paul, Here are a bunch of tutorials on the topic: http://www.r-statistics.com/2010/04/repeated-measures-anova-with-r-tutorials/ I suggest a more specific question for people to help :) Best, Tal Contact Details:--- Contact

[R] Overdetermined systems

2010-11-09 Thread Maayt
Hello, I have a simple overdetermined system coming from physical measurements. I would like to know if there is a simple way to compute the result of such a system in R. I am aware of the package chebR and the least square methods to provide an optimal solution. But I am really interested in

Re: [R] Add text to a stacked barplot

2010-11-09 Thread Ashraf Yassen
Dear All, Now with data. Any suggestion how to center the text in the filling would be appreciated. Kind regards, Ashraf library(lattice) a-c(100,100,93.57,50,0,0,6.43,50) b-c(1,1,1,1,0,0,0,0) VISIT-c(1,2,3,4,1,2,3,4) VISIT-as.character(VISIT) stuffd-data.frame(FREQ=a, VISIT=VISIT, RES=b)

Re: [R] Creating a list to store output objects from a recursive loop

2010-11-09 Thread Santosh Srinivas
Figured this out this ways I think outPut - list(list(result1),list(result2)) -Original Message- From: Santosh Srinivas [mailto:santosh.srini...@gmail.com] Sent: 09 November 2010 14:21 To: 'r-help@r-project.org' Subject: Creating a list to store output objects from a recursive loop

Re: [R] Row-wise recurive function call

2010-11-09 Thread sayan dasgupta
On Tue, Nov 9, 2010 at 1:58 PM, Santosh Srinivas santosh.srini...@gmail.com wrote: Thanks this works. Only, I need to reference in the formula using indexes. In case you don't want to change references in formula try this try this library(plyr) adply(a,1,playFn) also it easy to parallelize

[R] Lattice: xyplot group title format

2010-11-09 Thread Marcus Drescher
Dear all, if I plot a lattice xyplot like: library(lattice); require(stats); Depth - equal.count(quakes$depth, number=8, overlap=.1) xyplot(lat ~ long | Depth, data = quakes) How can I manipulate the group title format (here: Depth)? Like the font size, position, etc. Best Marcus

[R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Tal Galili
Hello all, I recently discovered the comment command. I see it can only hold a vector of characters. Is there a way (or an alternative), to make it possible to have it keep a list? (for example, to keep different pieces of information like date of creation, information of each variable and so

[R] Installing the latest version of BRugs

2010-11-09 Thread Martyn Byng
Hi, I am trying to install the latest version of the BRugs package on a 32 bit windows machine which, due to the set up, won't allow me to install it via the usual R GUI. Can anyone point me to a link from which I can download the relevant files that allow me to install it manually (most pages

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Henrique Dallazuanna
You can use attributes: attributes(x) - list(CreateDate = Sys.time(), User = Sys.info()['user']) On Tue, Nov 9, 2010 at 8:36 AM, Tal Galili tal.gal...@gmail.com wrote: Hello all, I recently discovered the comment command. I see it can only hold a vector of characters. Is there a way (or

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Mario Valle
Look at the help page, the example does exactly this by putting a two element vector of strings as comment. Hope it helps mario On 09-Nov-10 11:36, Tal Galili wrote: Hello all, I recently discovered the comment command. I see it can only hold a vector of

Re: [R] Error: could not find function extract in package raster

2010-11-09 Thread Roger Bivand
In addition to the good advice given earlier, you may note for the future that the raster authors reply actively on the R-sig-geo list, often within minutes. So questions about the raster package may best be directed to that list. Roger Monica Pisica wrote: Hi, I would like to use the

[R] new column from column in another df

2010-11-09 Thread fugelpitch
If I have a data frame where a species occupies several rows with different phases such as (both col's ar factors): species,phase Populus tremula,1 Populus tremula,2 Populus tremula,3 Calluna vulgaris,1 Calluna vulgaris,2 Betula alba,1 Betula alba,2 Betula alba,3 Primula veris,1 Primula veris,2

Re: [R] Status of the bs Package

2010-11-09 Thread krusty the klown
Hi, the package bs, version 1.0, is available. Yet, I've gote some problems with it, specifically with the maximum likelihood estimation of the parameters \alpha and \beta of Birnbaum-Saunders distribution. Let the following code run: library(bs) alpha-1.5 beta-0.5 n-100 set.seed(1)

Re: [R] Installing the latest version of BRugs

2010-11-09 Thread Uwe Ligges
On 09.11.2010 13:37, Martyn Byng wrote: Hi, Thanks for the reply. As to my second question, I think what I am really asking is: Assuming that everything is the same (version of R, operating system etc), can you just copy the package directory (for examples BRugs) in the R library

[R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Shant Ch
Hi, I want to use a more accurate value of exp(1).  The value given by R is 2.718282. I want a value which has more than 15 decimal places. Can anyone let me know how can I increase the accuracy level. Actually there are some large multipliers of exp(1) in my whole expression, and I want a

Re: [R] Installing the latest version of BRugs

2010-11-09 Thread Martyn Byng
Hi, Thanks for the reply. As to my second question, I think what I am really asking is: Assuming that everything is the same (version of R, operating system etc), can you just copy the package directory (for examples BRugs) in the R library subdirectory between different machines and expect the

Re: [R] Status of the bs Package

2010-11-09 Thread krusty the klown
Perhaps the problem stands on the rbs function which generates random samples from the Birnbaum-Saunders distribution: library(bs) set.seed(1) x-rbs(n=1000,alpha=0.5,beta=1.0) # sample mean mean(x) [1] 1.117749 # expected value beta*(1+alpha^2/2) [1] 2.125 # so different! -- View this

Re: [R] new column from column in another df

2010-11-09 Thread Marianne Promberger
fugelpitch jo...@runtimerecords.net 09-Nov-10 12:28: ...how can I create a new column in the first data frame where growth form is picked up from the second data frame (also factors) and entered into all rows for a species as follows: ?merge eg dat1 - merge(dat1,dat2) Marianne --

[R] tukey.1

2010-11-09 Thread Raphael Fraser
I have been trying to do tukey's test to no avail. This is what I have and the error produced: pen.df = data.frame(blend, treatment, y) source(tukey.1.r) tukey.1(aov.pen, pen.df) Error in tukey.1(aov.pen, pen.df) : the model must be two-way This is a two-way design. Therefore I am confused. Can

Re: [R] Add values of rlm coefficients to xyplot

2010-11-09 Thread PtitBleu
Hello again, Thanks to this forum, I found a lapply command to apply rlm to each Device of the Name column of the df1 data frame (df1 data frame is given in the previous post). I'm now looking for a nice way to create a data frame with the name of the device, the intercept and the slope. I now

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread Nick Sabbe
I doubt this to be true. Try this in R: dmy-rep(1,5) dmy[2:5]-dmy[1:4]+1 This is equivalent to what you propose (even simpler), but it does not, as OP seems to have wanted, fill dmy with 1,2,3,4,5, but, as I had expected, with 1,2,2,2,2. I would be interested in knowing what exactly the

[R] running command before non-interactive job is exited

2010-11-09 Thread Jannis
Dear list members, i am running some R scripts non interactively on a remote cluster. In case of an error this cluster terminates the R job and only sends me some messages. Is there any way to save the workspace before this job is terminated to retrieve some information on why the error is

Re: [R] new column from column in another df

2010-11-09 Thread jim holtman
?merge df1 V1 V2 1 Populus tremula 1 2 Populus tremula 2 3 Populus tremula 3 4 Calluna vulgaris 1 5 Calluna vulgaris 2 6 Betula alba 1 7 Betula alba 2 8 Betula alba 3 9 Primula veris 1 10Primula veris 2 df2 - read.table('clipboard',

Re: [R] Is there a way to have 'comment' keep a list?

2010-11-09 Thread Keith Jewell
I hadn't seen 'comment' before, so don't take my suggestion as authoritative. It looks useful, so I investigated a bit. This technique seems to work and is (perhaps?) easier than names: tlist - list(a=c(1:3), b=7) comment(x) - unlist(sapply(tlist, as.character)) or in one line

Re: [R] Row-wise recurive function call

2010-11-09 Thread David Winsemius
On Nov 9, 2010, at 3:28 AM, Santosh Srinivas wrote: Thanks this works. Only, I need to reference in the formula using indexes. Then you need to use the indices inside plaFn. playFn- function (x){ result = ((x[1]+6*x[2])/(3*x[3])+20)*x[4] return(result) } -Original

[R] Implementation of Functional Link Neural Network

2010-11-09 Thread Shyam Sundaram
Dear Team I am trying to find a reference implementation of the functional link neural network in R-project. the neuralnet package does not have it. Any help in terms of a reference implementation of this variant of neural network ( without hidden layers) will be greatly appreciated. As always

[R] Catmap package and forest plots

2010-11-09 Thread Matthew Law
I am sorry to bother the group with what is probably a simple error on my behalf as I am new to R, but I have been able to find a solution looking online or in the R forums. I have just started using R so I can use the catmap package which allows a meta analysis of both case control and TDT

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Łukasz Ręcławowicz
2010/11/9 Shant Ch sha1...@yahoo.com Can anyone let me know how can I increase the accuracy level. library(Rmpfr) exp(mpfr(1,128)) 1 'mpfr' number of precision 128 bits [1] 2.718281828459045235360287471352662497759 -- Mi³ego dnia [[alternative HTML version deleted]]

Re: [R] Installing the latest version of BRugs

2010-11-09 Thread David Winsemius
On Nov 9, 2010, at 5:38 AM, Martyn Byng wrote: Hi, I am trying to install the latest version of the BRugs package on a 32 bit windows machine which, due to the set up, won't allow me to install it via the usual R GUI. Can anyone point me to a link from which I can download the relevant

Re: [R] Add values of rlm coefficients to xyplot

2010-11-09 Thread David Winsemius
On Nov 9, 2010, at 8:01 AM, PtitBleu wrote: Hello again, Thanks to this forum, I found a lapply command to apply rlm to each Device of the Name column of the df1 data frame (df1 data frame is given in the previous post). I'm now looking for a nice way to create a data frame with the

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Hadley Wickham
Where the value of exp(1) as computed by R is concerned, you have been deceived by what R displays (prints) on screen. The default is to display any number to 7 digits of accuracy, but that is not the accuracy of the number held internally by R:  exp(1)  # [1] 2.718282  exp(1) - 2.718282  

Re: [R] How to extract Friday data from daily data.

2010-11-09 Thread Marianne Promberger
thornbird huachang...@gmail.com 05-Nov-10 20:10: Thank you very much. It worked great with the testdata. I have one more questionto to ask. As my data is incomplete, sometimes Thu is also missing, then I have no other options but to pick Sat instead, and if Sat is also missing, then my best

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Ted Harding
On 09-Nov-10 13:21:10, Shant Ch wrote: Hi, I want to use a more accurate value of exp(1)._ The value given by R is 2.718282. I want a value which has more than 15 decimal places. Can anyone let me know how can I increase the accuracy level. Actually there are some large multipliers of

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread David Winsemius
On Nov 9, 2010, at 8:21 AM, Shant Ch wrote: Hi, I want to use a more accurate value of exp(1). The value given by R is 2.718282. Well, not really. That is what is printed at the console with the default settings for digits. The internal representation is wider: format(exp(1),

[R] time question

2010-11-09 Thread Ralf B
I have this script which I use to get an epoch with accuracy of 1 second (based on R's inability to calculate millisecond-accurate timestamps -- at least I have not seen a straightforward solution :) ): nowInSeconds - as.numeric(Sys.time()) nowInMS - nowInSeconds * 1000 print(nowInSeconds)

[R] help to add a new column filled with value 1

2010-11-09 Thread Mohan L
Dear All, I have a data frame with 5 column and 201 row data. I want to add one more column between column 1 and 2 with value of 1. So the new column has to be the second column filled with 1. Any help will be appreciated. Thanks for your time. Thanks Rg Mohan L

Re: [R] time question

2010-11-09 Thread David Winsemius
On Nov 9, 2010, at 9:18 AM, Ralf B wrote: I have this script which I use to get an epoch with accuracy of 1 second (based on R's inability to calculate millisecond-accurate timestamps -- at least I have not seen a straightforward solution :) ): From help page for Sys.time: Value Sys.time

[R] Qt interfaces to R/ Windows version as well as using PyQT

2010-11-09 Thread Ajay Ohri
Is the project on creating R GUIs using QT interfaces still on? Any plans of using PyQT Regards Ajay Ohri Websites- http://decisionstats.com http://dudeofdata.com Linkedin- www.linkedin.com/in/ajayohri On Tue, Nov 9, 2010 at 8:33 PM, Kari Ruohonen kari.ruoho...@utu.fi wrote: Hi, I

Re: [R] Status of the bs Package

2010-11-09 Thread krusty the klown
Perhaps there's a problem with the function rbs, that generates a random sample from the Birnbaum-Saunders distribution. The rgbs function (package gbs) does it better. Look at these code and results: library(bs) set.seed(1) alpha-0.17 beta-130 x-rbs(n=1000,alpha,beta) # sample mean

[R] help to merge two data frame if name matches

2010-11-09 Thread Mohan L
Dear All, I have two data like this : $cat main.csv name,id,memory,storage mohan,1,100.20,1.10 ram,1,200,100 kumar,1,400,50 xxx,1,100,40 aaa,1,800,45 mount,1,200,80 main - read.csv(file='main.csv',sep=',' , header=TRUE) main nameidmemory storage 1 mohan 1100.2 10 2

Re: [R] the formula of quantile regression for panel data, which is correct?

2010-11-09 Thread Mike Marchywka
Date: Tue, 9 Nov 2010 00:41:26 -0800 From: 523541...@qq.com To: r-help@r-project.org Subject: [R] the formula of quantile regression for panel data, which is correct? Hi,everyone I have some trouble in understanding the formula.

Re: [R] tukey.1

2010-11-09 Thread Sarah Goslee
Including pen.df is a good start, but we likely can't help without more info: Where'd you get tukey.1.r and what's in it? What's aov.pen? On Tue, Nov 9, 2010 at 10:13 AM, Raphael Fraser raphael.fra...@gmail.com wrote: I have been trying to do tukey's test to no avail. This is what I have and

Re: [R] help to merge two data frame if name matches

2010-11-09 Thread Uwe Ligges
On 09.11.2010 16:17, Mohan L wrote: Dear All, I have two data like this : $cat main.csv name,id,memory,storage mohan,1,100.20,1.10 ram,1,200,100 kumar,1,400,50 xxx,1,100,40 aaa,1,800,45 mount,1,200,80 main- read.csv(file='main.csv',sep=',' , header=TRUE) main nameidmemory

[R] library(kernlab) --- unable to load shared library

2010-11-09 Thread Yuliya Matveyeva
Dear R users, I have recently encountered a problem with using the function `library` in order to load the package `kernlab`. My output of sessionInfo() is as follows: R version 2.10.1 (2009-12-14) x86_64-unknown-linux-gnu locale: [1] C attached base packages: [1] stats graphics grDevices

Re: [R] Creating a list to store output objects from a recursive loop

2010-11-09 Thread Uwe Ligges
On 09.11.2010 09:51, Santosh Srinivas wrote: Dear Group, I am having a function that I am running in a loop that generated two results for each loop The result1 is a zoo object The result2 is a data frame Now I want to put both of them in a list Just generate a list of lists, the latter

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Duncan Murdoch
On 09/11/2010 8:21 AM, Shant Ch wrote: Hi, I want to use a more accurate value of exp(1). The value given by R is 2.718282. I want a value which has more than 15 decimal places. Can anyone let me know how can I increase the accuracy level. The value in R is accurate to approximately 15

[R] FCS Files

2010-11-09 Thread fabio87
Hi I've got a problem: I will read FCS 3.0 files with programm r 2.12, package flowViz. But the programm says Fehler in readFCSgetPar(x, $DATATYPE), Parameter (s) $DATATYPE Not contained in 'x'. ^ Fabio -- View this message in context:

Re: [R] : unusual combinations of categorical data

2010-11-09 Thread Michael Friendly
On 11/8/2010 5:25 PM, Alan Chalk wrote: Regarding unusual combinations of factors in categorical data. Are there any R packages that can be used to identify the outliers i.e. unusual combinations in categorical datasets ? Unusual combinations of factors are those that have large residuals in

Re: [R] location of Tisean executables when using RTisean and jumping between linux and windows

2010-11-09 Thread Uwe Ligges
I have quickly looked into the code. It shows that: If you have copied your workspace, then you have also copied the object .TISEANpath along with your workspace and RTisean looks at first at the contents of that object. So just open the workspace, delete the object and save the workspace

Re: [R] Auto-killing processes spawned by foreach::doMC

2010-11-09 Thread Steve Lianoglou
Hi Henrik, Firstly, thanks for keeping an eye out and sharing. On Tue, Nov 9, 2010 at 12:59 AM, Henrik Bengtsson h...@biostat.ucsf.edu wrote: I just stumbled into the 'fork' package (GPL-2).  It allows you do send signals from within R.  Unfortunately it is not available on Windows, but it is

[R] code ok in unix R2.6 , fails in windows R 2.12

2010-11-09 Thread Robert Kinley
hello ... Can anyone help me with this : In R.exe 2.6 , Unix , :- plot.data-model[[i]]$data$conc newdata-seq(min(plot.data),max(plot.data),by=1) model.pred-predict(model[[i]],data.frame(newdata),interval=prediction) matpoints(newdata,model.pred[,c(Lower,Upper)],l,col=blue,lty=1) works OK ...

Re: [R] help to merge two data frame if name matches

2010-11-09 Thread Marianne Promberger
Hi Mohan, Mohan L l.mohanphys...@gmail.com 09-Nov-10 15:17: I want to merge ip,bsent,breceived column to main , If the name in the the main data frame is there in the other data frame . some thinng like this: nameid memory storage ip bsent breceived mohan1100

Re: [R] likelyhood maximization problem with polr

2010-11-09 Thread blackscorpio
Thank you for your answer. I have already tried lrm and it's true that it works better than polr in such a case. Nevertheless lrm does not work with the addterm and dropterm functions (to my knowledge) and I need to use them. Maybe do you know alternate functions that would do the same job and

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Marianne Promberger
Mohan L l.mohanphys...@gmail.com 09-Nov-10 14:25: Dear All, I have a data frame with 5 column and 201 row data. I want to add one more column between column 1 and 2 with value of 1. So the new column has to be the second column filled with 1. Any help will be appreciated. You need two

[R] randomForest parameters for image classification

2010-11-09 Thread Deschamps, Benjamin
I am implementing an image classification algorithm using the randomForest package. The training data consists of 31000+ training cases over 26 variables, plus one factor predictor variable (the training class). The main issue I am encountering is very low overall classification accuracy (a lot of

Re: [R] Several lattice plots on one page

2010-11-09 Thread Abhijit Dasgupta
Another solution is using grid.arrange in the gridExtra package. This works like the par(mfrow=...) command, but for grid-based graphics like lattice and ggplot2 On Nov 8, 2010, at 1:19 PM, Marcus Drescher wrote: Dear all, I am trying (!!!) to generate pdfs that have 8 plots on one page:

Re: [R] Extending the accuracy of exp(1) in R

2010-11-09 Thread Ted Harding
On 09-Nov-10 13:57:08, Hadley Wickham wrote: Where the value of exp(1) as computed by R is concerned, you have been deceived by what R displays (prints) on screen. The default is to display any number to 7 digits of accuracy, but that is not the accuracy of the number held internally by R:

[R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
Hello! I am running a loop. The result of each run of the loop is a data frame. I am merging all the data frames. For exampe: The dataframe from run 1: x-data.frame(a=1,b=2,c=3) The dataframe from run 2: y-data.frame(a=10,b=20,d=30) What I want to get is: merge(x,y,all.x=T,all.y=T) Then I

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread Greg Snow
Oops, my version added cc instead of subtracted, it still works if you multiply cc by -1 (except the initial 1). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org

[R] location of Tisean executables when using RTisean and jumping between linux and windows

2010-11-09 Thread Kari Ruohonen
Hi, I wonder if someone could help. I needed to transfer (copy) a workspace file that had been generated in linux (R 2.11) to windows running the same version of R 2.11 (but of course windows binary). Usually, there is no problem in doing this and all objects work as expected. I am often doing

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread Bert Gunter
Erich: (Assuming this is correct), this is very nice. However, I just wanted to point out that if you look at the code for Reduce, you'll find it's implemented with for loops. So the OP's original version using a for loop is likely to be faster (just as it's likely to be faster than my actual

[R] simulation from pareto distn

2010-11-09 Thread cassie jones
Dear all, I am trying to simulate from truncated Pareto distribution. I know there is a package called PtProcess for Pareto distribution...but it is not for truncated one. Can anyone please help me with this? Thanks in advance. Cassie [[alternative HTML version deleted]]

Re: [R] code ok in unix R2.6 , fails in windows R 2.12

2010-11-09 Thread Uwe Ligges
You probably forgot to say that you have also different versions of the package installed! I get on all platforms: drm(formula = response ~ conc, data = assay.data, fct = l4()) Error in drm(formula = response ~ conc, data = assay.data, fct = l4()) : Cluster not specified. Use e.g. y ~ x +

[R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
Hello! I am running a loop (for a range of dates) and in this loop I am reading in different files - based on a date that is part of the file name. However, for some of the dates, I have no file (no way to know which dates). So, when I try to read it in I get an error: Error in file(file, rt) :

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Henrique Dallazuanna
Take a look in ?try and ?tryCatch myfile - tryCatch(read.csv(myfilename), error = invisible) myfile$message On Tue, Nov 9, 2010 at 2:55 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello! I am running a loop (for a range of dates) and in this loop I am reading in

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread William Dunlap
Note that for long vectors the OP's code would go much faster if he preallocated the output vector a to its eventual length. I.e., start with a - numeric(N) instead of a - c() I defined 2 functions that differed only in how a was initialized f0 - function(b, c) { N - length(c)

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Joshua Wiley
Hi Dimitri, I have some doubts whether storing the results of a loop in a data frame and merging it with every run is the most efficient way of doing things, but I do not know your situation. This does what you want, I believe, but I suspect it could be quite slow. I worked around the

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
Thanks a lot, Joshua. You might be right. I am thinking of creating a list (as a placeholder) and then merging the elements of the list. Dimitri On Tue, Nov 9, 2010 at 12:11 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Dimitri, I have some doubts whether storing the results of a loop in a

[R] spatstat error with plotting envelopes for fitted model

2010-11-09 Thread Neba Funwi-Gabga
Hello, I am facing an error when I try to plot envelopes of a fitted model in spatstat. My model is fitted using the Geyer Saturation process as follows: * geyer.fit-ppm(points, ~el+asp, Geyer(r=1, sat=2), covariates=list(el=el, asp=asp))* It fits well, but when I try to plot the envelopes to

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Dimitri Liakhovitski Sent: Tuesday, November 09, 2010 8:56 AM To: r-help Subject: [R] How to program an error into an if-then statement Hello! I am running a loop (for a

Re: [R] How to program an error into an if-then statement

2010-11-09 Thread Dimitri Liakhovitski
Thanks a lot, everybody- it's very helpful! On Tue, Nov 9, 2010 at 12:20 PM, Nordlund, Dan (DSHS/RDA) nord...@dshs.wa.gov wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Dimitri Liakhovitski Sent: Tuesday, November 09,

[R] replaing 1-digit months with 2-digit months in a date

2010-11-09 Thread Dimitri Liakhovitski
Hello again! Sorry, if it's a simple question - I am very bad in working with strings. I have a vector of strings: x-c(2000.1,2000.2,2000.10,2000.12) I'd like to change it so that it the month always has 2 digits, like this: 2000.01,2000.02,2000.10,2000.12 Is it possible? Thanks a lot! --

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Phil Spector
Mohan - Suppose your data frame is named df. Try this: data.frame(df[,1],1,df[,2:5]) - Phil Spector Statistical Computing Facility Department of Statistics

Re: [R] replaing 1-digit months with 2-digit months in a date

2010-11-09 Thread Henrique Dallazuanna
Try this: gsub(\\.(\\d{1}$), .0\\1, x) On Tue, Nov 9, 2010 at 3:28 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Hello again! Sorry, if it's a simple question - I am very bad in working with strings. I have a vector of strings: x-c(2000.1,2000.2,2000.10,2000.12) I'd

Re: [R] library(kernlab) --- unable to load shared library

2010-11-09 Thread Phil Spector
Yuliya - The error message doesn't say that the file doesn't exist -- it says that it contains a symbol which can't be resolved, in this case dgemv_ . A quick google search shows that this is part of the BLAS library. So my guess is that you have installed the BLAS library in some

Re: [R] How to eliminate this for loop ?

2010-11-09 Thread Greg Snow
OK, double oops. I first tested my code with length 100, then upped the number but forgot to up the preallocation part, I should have used a variable there instead so that only one place needed to be changed. My version did have problems when I tried to do a vector of length 10,000, some

[R] Question regarding to replace NA

2010-11-09 Thread Kate Hsu
Dear r-users, Basically, I have a data as follows, data S s1 s2 s3 s4 s5 prob obs num.strata 1 N N N N N N 0.108 32 NA 2 Y N N N N Y 0.0005292 16 NA 3 NNNYN N N N Y N 0.0005292 24 NA 4 NNNYY N N N Y Y 0.0259308 8 1

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Phil Spector
Dimitri - Usually the easiest way to solve problems like this is to put all the dataframes in a list, and then use the Reduce() function to merge them all together at the end. You don't give many details about how the data frames are constructed, so it's hard to be specific about the best way

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Greg Snow
Here are 2 possibilities: cbind( iris[,1, drop=FALSE], 1, iris[,2:5] ) cbind( iris, 1) [ ,c(1,6,2:5) ] -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org

Re: [R] Question regarding to replace NA

2010-11-09 Thread Joshua Wiley
Hi Kate, is.na() does not work on entire data frames. You just need to specify the column, for example: data[is.na(data[, 8]), 8] - 0 if the NAs were in column 8. Best regards, Josh On Tue, Nov 9, 2010 at 9:33 AM, Kate Hsu yhsu.rh...@gmail.com wrote: Dear r-users, Basically, I have a

Re: [R] Merging data frames one of which is NULL

2010-11-09 Thread Dimitri Liakhovitski
Thanks a lot, Phil. I decided to do it via the list - as you suggested, but had to do some gymnastics, which Reduce will greatly help me to avoid now! Dimitri On Tue, Nov 9, 2010 at 12:36 PM, Phil Spector spec...@stat.berkeley.edu wrote: Dimitri -   Usually the easiest way to solve problems

[R] jags error message

2010-11-09 Thread Maas James Dr (MED)
Could anyone give me some clues as to the best way to debug this error message? I think it is from the passing of variables back to R from the jags function which does Bayesian fitting. The curious part for me is that the error messages seem random, yet the input data are always the same.

Re: [R] Calculate Mean from List

2010-11-09 Thread Greg Snow
You could use the Reduce function to get the sum of the matrices, then if there are no missing vales just divide by the number of matrices. If there are missing values then you would probably need to use Reduce again to count the number of non-missing values. Since all the matrices are the

Re: [R] Question regarding to replace NA

2010-11-09 Thread Phil Spector
Kate - As the error message indicates, num.strata is a factor. This can occur when you're reading in data and R encounters a non-numeric value which was not specified in the na.strings= argument to read.table. To do what you want, you'll need to convert it to a character variable first:

Re: [R] help to add a new column filled with value 1

2010-11-09 Thread Henrique Dallazuanna
Try this: as.data.frame(append(iris, 1, after = 2)) On Tue, Nov 9, 2010 at 12:25 PM, Mohan L l.mohanphys...@gmail.com wrote: Dear All, I have a data frame with 5 column and 201 row data. I want to add one more column between column 1 and 2 with value of 1. So the new column has to be the

Re: [R] Question regarding to replace NA

2010-11-09 Thread Joshua Wiley
On Tue, Nov 9, 2010 at 9:39 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi Kate, is.na() does not work on entire data frames. whoops, I did not mean that. is.na() has a data frame method, but there are assignment issues (as you saw) when you use it that way. Josh [snip]

  1   2   >