Re: [R] crazy loop error.

2011-01-26 Thread Petr Savicky
On Tue, Jan 25, 2011 at 08:58:31AM +, Prof Brian Ripley wrote: [...] If k may be 0, then it is better to use for (n in seq(length=k)) since seq(length=0) has length 0. Since you keep mentioning that, it is actually much better to use seq_len(k) (and seq_along(x) instead of your

[R] Compilation errors when installing gee

2011-01-26 Thread adam_pgsql
Hi, I am trying to install gee on our server but I get the error below. I do not have root on this machine so no control on how R was installed itself. It looks like it cannot find blas libs, the only ones i can find on the machine are: /usr/lib64/libblas.so.3 - libblas.so.3.0.3

[R] 2 functions with same name - what to do to get the one I want

2011-01-26 Thread pdb
There seems to be 2 functions call ecdf... http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html http://127.0.0.1:11885/library/stats/html/ecdf.html How do I get the one ecdf {Hmisc} to run instead of the ecdf {stats} A pointer in the right direction would be greatly appreciated.

Re: [R] 2 functions with same name - what to do to get the one I want

2011-01-26 Thread Dennis Murphy
Hi: It's in your message: :) Hmisc:::ecdf(...) indicates use of the ecdf function in package Hmisc. HTH, Dennis On Wed, Jan 26, 2011 at 2:38 AM, pdb ph...@philbrierley.com wrote: There seems to be 2 functions call ecdf... http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html

Re: [R] Integration of two lines

2011-01-26 Thread Xavier Robin
Hans W Borchers wrote : First define a function from those points: fx - approxfun(x, f_x) fy - approxfun(y, f_y) f - function(x) abs(fx(x)-fy(x)) and now you can apply integrate() or trapz(): xx - sort(c(x, y)) yy - f(xx) trapz(xx, yy) trapz() should

Re: [R] 2 functions with same name - what to do to get the one I want

2011-01-26 Thread pdb
Thanks for the quick response, but that doesn't seem to help What do I need to do to get it to work? Hmisc:::ecdf(...) Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'ecdf' not found -- View this message in context:

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-26 Thread Matthew Dowle
Note that a key is not actually required, so it's even simpler syntax : dX = as.data.table(X) dX[,length(unique(z)),by=x,y] x y V1 [1,] 1 1 2 [2,] 1 2 2 [3,] 2 3 2 [4,] 2 4 2 [5,] 3 5 2 [6,] 3 6 2 or passing list() syntax to the 'by' is exactly the same :

Re: [R] 2 functions with same name - what to do to get the one I want

2011-01-26 Thread Dennis Murphy
The function in Hmisc is Ecdf(): u - rnorm(100) Hmisc:::Ecdf(u) D. On Wed, Jan 26, 2011 at 2:58 AM, pdb ph...@philbrierley.com wrote: Thanks for the quick response, but that doesn't seem to help What do I need to do to get it to work? Hmisc:::ecdf(...) Error in get(name, envir =

[R] Bivariate polynomials in R

2011-01-26 Thread Alaios
Have you ever worked in R with bivariate polynomials? How did you implement simple operators like addition/multiplication? I found a package called multipol that seems to support these kinds of operators but I do keep receiving error. Check for example the following snippet of code (you can

Re: [R] Compilation errors when installing gee

2011-01-26 Thread Prof Brian Ripley
This is nothing to do with gee (which I maintain). It seems what you installed a binary version of R, and hence do not have the files it refers to for source package installation. You appear to need to install the blas-devel RPM. Questions about binary installations of R are best asked on

[R] How to call subset in a for loop?

2011-01-26 Thread Aditya Bhagwat
Dear all, I have a data frame 'myDf', in which one of the fields 'myField' can have several possible values. To extract the observations for which it has value A, I can do: subset(myDf, myField=A) However, when I try to do this within a loop, it doesn't work, it returns everything, and not a

[R] hwo to speed up aggregate

2011-01-26 Thread analys...@hotmail.com
I have df quantity branch client date name 110 1 1 2010-01-01 one 220 2 1 2010-01-01 one 330 3 2 2010-01-01 two 415 4 1 2010-01-01 one 510 5 2 2010-01-01 two 620 6 3

[R] merge tables in a loop

2011-01-26 Thread clemens karwautz
I’m running a loop opening one file after another. setwd(D:/Documents and Settings/trflp) a-list.files() results.diversity-data.frame(matrix(0,ncol=7,nrow=length(a))) names(results.diversity)-c(file,simpson,shannon,eveness) x-length(a) for (i in 1:x){ trflp-read.table(a[i],header=T,sep=\t) …

[R] text labels in Trellis plot

2011-01-26 Thread Markus Damian
Dear all, I need to generate plots in which the points of the plot are replaced by text labels, such as dog and cat. The usual way of specifying the plotting symbol with pch works only if the labels are single characters, as far as I know. So, plot(runif(3), pch=c(A, B, C)) will work OK, but

[R] How to get percent contribution of each factor of 1st component from Principal Component Regression (PCR)

2011-01-26 Thread Sean
Hi, I run Principal Component Regression (PCR) on my data and I got some components. Hoever, explvar(pcr.stdize) only shows the explained variation of each component. How can I get the contribution of each factor in each component, say 1st component? For example, I have five variables and

Re: [R] How to call subset in a for loop?

2011-01-26 Thread Henrique Dallazuanna
Try this: split(myDF, myDF$myField) On Wed, Jan 26, 2011 at 8:18 AM, Aditya Bhagwat bhagwatadi...@gmail.comwrote: Dear all, I have a data frame 'myDf', in which one of the fields 'myField' can have several possible values. To extract the observations for which it has value A, I can do:

Re: [R] Train error:: subscript out of bonds

2011-01-26 Thread Neeti
What I have understood in CARET train() method is that train() itself does the model selection and tune the parameter. (please correct me if I am wrong). That was my first motivation to select this package and method for fitting the model. And use the parameter to e1071 svm() method and compare

[R] a problem with is.na

2011-01-26 Thread René Holst
Hello, I have observed the following odd behavior of is.na( ) and hope someone can give me an explanation Example: X1=rep(1:2,5)[-1] X2=rep(1:5,rep(2,5))[-1] y= runif(9) y[3]=NA xtabs(y~x1+x2) Now xtabs(is.na(y)~x1+x2) says that cell 2,2 is NA x2 x1 1 2 1 0 0 2 0 1 3 0 0 4 0 0 5

[R] [R-pkgs] New package versions for distr- and robast- families

2011-01-26 Thread Dr. Peter Ruckdeschel
New versions 2.3 of our distr-family of packages are now available on CRAN. (i.e.; startupmsg, SweaveListingUtils, distr, distrEx, distrDoc,

Re: [R] hwo to speed up aggregate

2011-01-26 Thread Dennis Murphy
If you have a large data frame, one option is package data.table. Try the following: library(data.table) dt - data.table(df) dt[, list(qsum = sum(quantity)), by ='client, date, name'] client date name qsum [1,] 1 2010-01-01 one 45 [2,] 1 2011-01-01 one 4500 [3,] 2

Re: [R] a problem with is.na

2011-01-26 Thread Henrique Dallazuanna
There isn't combination of c(1, 1), so is NA: tapply(y, list(X1, X2), sum) On Wed, Jan 26, 2011 at 9:04 AM, René Holst r...@constat.dk wrote: Hello, I have observed the following odd behavior of is.na( ) and hope someone can give me an explanation Example: X1=rep(1:2,5)[-1]

[R] mvoutlier

2011-01-26 Thread Claudia Paladini
Dear R-users, I used x.out=sign1(data,makeplot=TRUE) from the package mvoutlier to detect multivariate outliers. I would like to label the points in the resulting plot with the row names of my data set. But none of my attempts does lead to a result. Can anybody help me, please?

Re: [R] hwo to speed up aggregate

2011-01-26 Thread Henrique Dallazuanna
Try this: unique(transform(df, quantity = ave(quantity, client, date, name, FUN = sum), branch = NULL)) On Wed, Jan 26, 2011 at 8:39 AM, analys...@hotmail.com analys...@hotmail.com wrote: I have df quantity branch client date name 110 1 1 2010-01-01 one 2

Re: [R] a problem with is.na

2011-01-26 Thread Martyn Byng
Hi, This isn't an issue with is.na, you get the same if you use aa = c(1,1,0,1,1,1,1,1,1) bb = abs(aa - 1) xtabs(aa~x1+x2) xtabs(bb~x1+x2) it is because you do not have any data in (1,1), i.e. there is no case where x1 = 1 and x2 = 1 so xtabs is putting a zero in that cell Hope this helps

Re: [R] Sweave: \Sexpr{} inside ?

2011-01-26 Thread Duncan Murdoch
On 11-01-25 8:22 PM, zerfetzen wrote: Hi, Is it possible in Sweave to put \Sexpr{} inside? This is a bad example, but here goes: results=hide Age- 5 @ x- \Sexpr{Age} @ I'm trying to get it to display x- 5, rather than x- Age. It's probably so obvious I'm going to feel sorry

Re: [R] MAtrix addressing

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 2:47 AM, Alaios wrote: The reason is the following image http://img545.imageshack.us/i/maptoregion.jpg/ In the picture above you will find the indexes for each cell. Also you will see that I place that matrix inside a x,y region that spans from -1 to 1. I am trying to

[R] barchart panel.text add label value and percent

2011-01-26 Thread Christophe Bouffioux
Hello everybody, i need some help to display text as label in my barchart the label is the combination of x value + text text= calculated percentage = per it display properly the x value but, wrongly repeats the text of the fisrt level LangueTXT factor on the second any solution? Thanx very much

Re: [R] 2 functions with same name - what to do to get the one I want

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 5:38 AM, pdb wrote: There seems to be 2 functions call ecdf... http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html Apparently that used to be its name and that some time in the intervening 10 years the name was changed to Ecdf. The Statlib repository has

Re: [R] mvoutlier

2011-01-26 Thread stephen sefick
I would look into ggplot2. I use this quite frequently to do what you are talking about, and also for most of my plotting. Hadley has done a wonderful job with this package. kindest regards, Stephen On Jan 26, 2011, at 3:48 AM, Claudia Paladini wrote: Dear R-users, I used

[R] Projecting data onto a NMS plot

2011-01-26 Thread cystis
Hello all and thanks for the help. I am analyzing a dataset using MetaMDS and I would like to project some extra samples onto the plot such that the extra samples do not play a role in defining the axes. I have been thinking of different ways of doing this and I was wondering if anyone had a

[R] Problem with setMethod in R package

2011-01-26 Thread Pascal A. Niklaus
Dear all, My apologies for re-posting this question, but I have not found any solution to my problem so far. I also think that my post may have been overseen due to the posting time and high traffic on this list. I experience a problem in implementing a S4 class in a package and would

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-26 Thread Hadley Wickham
On Wed, Jan 26, 2011 at 5:27 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: Here are two more candidates, using the plyr and data.table packages: library(plyr) ddply(X, .(x, y), function(d) length(unique(d$z)))  x y V1 1 1 1  2 2 1 2  2 3 2 3  2 4 2 4  2 5 3 5  2 6 3 6  2 The

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-26 Thread Tal Galili
Hello Prof Brian Ripley, Yihui and Tom, Thank you for your suggestions. It seemed to have made some differences in the error massages - but rggobi still fails to load. Steps taken: 1) I removed the old GTK (through the uninstall interface) 2) I ran library(RGtk2) which downloaded the new

[R] Fwd: MAtrix addressing

2011-01-26 Thread David Winsemius
Begin forwarded message: From: David Winsemius dwinsem...@comcast.net Date: January 26, 2011 8:32:30 AM EST To: Alaios ala...@yahoo.com Subject: Re: [R] MAtrix addressing On Jan 26, 2011, at 7:58 AM, Alaios wrote: Unfortunately right now is convoluted... by I was trying to find some

Re: [R] Problem with setMethod in R package

2011-01-26 Thread Martin Morgan
On 01/26/2011 05:08 AM, Pascal A. Niklaus wrote: Dear all, My apologies for re-posting this question, but I have not found any solution to my problem so far. I also think that my post may have been overseen due to the posting time and high traffic on this list. I experience a problem in

Re: [R] Help Derivate for Nonlinear Growth Models

2011-01-26 Thread Ben Bolker
acocac acocac at gmail.com writes: Hi!! Im doing my graduated work in Onion Curves Growth with Nonlinear Models, I'm amateur in R so i have doubt how i put or program next models, http://r.789695.n4.nabble.com/file/n3236748/96629508.png Also, i cant derivate for Gauss Model, and

Re: [R] Train error:: subscript out of bonds

2011-01-26 Thread Max Kuhn
Sort of. It lets you define a grid of candidate values to test and to define the rule to choose the best. For some models, it is each to come up with default values that work well (e.g. RBF SVM's, PLS, KNN) while others are more data dependent. In the latter case, the defaults may not work well.

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-26 Thread Prof Brian Ripley
Your GTK+ installation is not being found: check your PATH. On Wed, 26 Jan 2011, Tal Galili wrote: Hello Prof Brian Ripley, Yihui and Tom, Thank you for your suggestions.  It seemed to have made some differences in the error massages - but rggobi still fails to load. Steps taken: 1) I

Re: [R] How to call subset in a for loop?

2011-01-26 Thread David Reiner
you were caught by the '=' versus '==' error ;-) and Henrique's elegant one-liner avoids the problem altogether. -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Henrique Dallazuanna Sent: Wednesday, January 26, 2011 6:00

Re: [R] coxme and random factors

2011-01-26 Thread Terry Therneau
--- begin inclusion --- Response variable: survival (death) Factor 1: treatment (4 levels) Factor 2: sex (male / female) Random effects 1: person nested within day (2 people did the experiment over 2 days) Random effects 2:

Re: [R] lattice draw.key(): position of key in panels

2011-01-26 Thread Boris.Vasiliev
Good morning, This problem was already addressed in a previous post: https://stat.ethz.ch/pipermail/r-help/2009-February/187244.html In the call to draw.key() use 'vp=viewport(x=unit(0.1,npc),y=unit(0.1,npc))'. Prior to calling viewport() make sure grid package is loaded. Apologies for

Re: [R] Failing to install {rggobi} on win-7 R 2.12.0

2011-01-26 Thread Tal Galili
I checked it using: Sys.getenv(PATH) And the output includes the PATH to the GTK2 installation (it's the last item in the following list): C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Common Files\\Ulead

Re: [R] Train error:: subscript out of bonds

2011-01-26 Thread Neeti
Thank you so much for your reply. In my case it is giving error in some seed value for example if I set seed value to 357 this gives an error. Does train have some specific seed range? -- View this message in context:

Re: [R] barplot with varaible-width bars

2011-01-26 Thread Bill Pikounis
Hi Larry, If I understand correctly, your barplot() call dispatches to the method function barplot.default() to do the work. Looking at the definition of that function and your specific call, it seems that around line 51 of barplot.default(), the value of the width argument is truncated: width

Re: [R] plot with 2 y axes

2011-01-26 Thread Greg Snow
Why do you need the line to overlay the bars? Which bars are touched by the line is just a quirk of scaling and could easily change with the scales. All the overlay does is to make it harder to read, why not jut have 2 panels aligned on the x-axis but with the line plot above the bar plot?

[R] Greek letters in CairoPDF

2011-01-26 Thread Eduardo de Oliveira Horta
Hello there, Straight to the point: it seems that CairoPDF from package Cairo cannot handle greek letters from expression(). For example, eta = seq(from=-pi, to=pi, length=100) f = sin(eta)^2 pdf(file = temp_pdf.pdf) plot(eta, f, type=l, main=expression(f(eta)==sin(eta)^2),

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
I am using: R version 2.11.1 (2010-05-31) It is good to know that it works in 2.12.1 Jim -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 5:57 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal

Re: [R] write.table -- maintain decimal places

2011-01-26 Thread Jim Moon
Great. Thank you, Peter! -Original Message- From: Peter Ehlers [mailto:ehl...@ucalgary.ca] Sent: Tuesday, January 25, 2011 7:26 PM To: Jim Moon Cc: r-help@r-project.org Subject: Re: [R] write.table -- maintain decimal places On 2011-01-25 17:22, Jim Moon wrote: Thank you for the

Re: [R] Counting number of rows with two criteria in dataframe

2011-01-26 Thread Ryan Utz
Hadley and Dennis: THANK YOU THANK YOU! This is exactly what I was looking for. Ryan On Wed, Jan 26, 2011 at 5:27 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: Here are two more candidates, using the plyr and data.table packages: library(plyr) ddply(X, .(x, y), function(d)

[R] Making up a graph and its equation which better fits two groups of data

2011-01-26 Thread Jimmy Martina
Dear R-folks: I have a group of data ('x' and 'y' axis), but I'd like to know how to draw a graph which would fits my data in a better way, I also need its equation. Could you give me any R-rutine ideas?. I thank you in advance for your kind support.

Re: [R] plot with 2 y axes

2011-01-26 Thread kirtau
I hope this is what you are looking for. you will have to add your own colors and such. year = c(1966:2008) tempur = c(2.9,4.5,1.9,1,2.9,4.3,3.9,4.3,4.9,4.4,4.5,2,2.8,-.4,2.3,3,.3,1.7,3.3,.8,-1.1,.8,4.9,5.2,4.9,1.5,3.7,3.6,3.2,4.8,2.3,2.5,5.2,5.3,4.9,3.2,3.6,3.9,4.8,4.3,3.7,5.8,4.9) indx =

[R] build interval

2011-01-26 Thread Rustamali Manesiya
Hello, I have some question on chron I currently doing this t1 - chron(,11:30:00) t2 - chron(,11:45:00) tt - seq(t1,t2,by=times(00:00:01)) tt has 901 values (15 minutes * 60 secs) and then x1 - rnorm(1:901) x2 - rnorm(1:901) x3 - rnorm(1:901) df - data.frame(tt, x1, x2, x3) I would like

[R] removing outlier function / dataset update

2011-01-26 Thread kirtau
Hi, I have a few lines of code that will remove outliers for a regression test based on the studentized residuals being above or below 3, -3. I have to do this multiple times and have attempted to create a function to lessen the amount of copying, pasting and replacing. I run into trouble with

[R] How to calculate p-value for Kolmogorov Smirnov test statistics?

2011-01-26 Thread saray
Although I saw this issue being discussed many times before, I still did not find the answer to: why does R can not calculate p-values for data with ties (i.e. - sample with two or more values the same)? Can anyone elaborate some details about how does R calculate the p- values for the

[R] Combing forest plots

2011-01-26 Thread Ross, Stephanie
Hi All, I am trying to combine two forest plots on the same page using the forestplot function in the rmeta package. Once I use the par() function to combine my plots on the same page, I find that my two plots are overlaying each other. Does anyone have any suggestions on how to fix this?

[R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Hello all, I wish to extract the terms from an rpart object. Specifically, I would like to be able to know what is the response variable (so I could do some manipulation on it). But in general, such a method for rpart will also need to handle a . case (see fit2) Here are two simple examples:

[R] Inconsistencies in the rpart.object help file?

2011-01-26 Thread Tal Galili
Hello all, I'm was going through the help for ?rpart.object And noticed some inconsistencies, Some might be a mistake in the help file and some might be my misunderstanding. The help in the section: value - frame (first paragraph), states that: yval, the fitted value of the response at each

Re: [R] How to calculate p-value for Kolmogorov Smirnov test statistics?

2011-01-26 Thread David Winsemius
The answers to these questions can be found either by looking at the code or by reviewing what has been said about this in prior postings to R-help. -- David. On Jan 26, 2011, at 10:40 AM, saray wrote: Although I saw this issue being discussed many times before, I still did not find the

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
Take a look at the output of terms(fit2) In particular tm - terms(fit2) attr(tm, response) is 1 if there is a response and variables - as.list(attr(tm, variables))[-1] variables[[1]] gives the response expression if there is one. Bill Dunlap Spotfire, TIBCO Software wdunlap

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Henrique Dallazuanna
Try this: all.vars(terms(fit1)) all.vars(terms(fit2)) On Wed, Jan 26, 2011 at 3:33 PM, Tal Galili tal.gal...@gmail.com wrote: Hello all, I wish to extract the terms from an rpart object. Specifically, I would like to be able to know what is the response variable (so I could do some

Re: [R] removing outlier function / dataset update

2011-01-26 Thread Ista Zahn
Hi, x and y are being picked up from your global environment, not from the x and y in dataset. Here is a version that seems to work: rm.outliers = function(dataset,var1, var2) { dataset$varpredicted = predict(lm(as.formula(paste(var1, var2, sep= ~ )), data=dataset)) dataset$varstdres =

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Thanks Henrique, exactly what I was looking for. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Train error:: subscript out of bonds

2011-01-26 Thread Max Kuhn
No. Any valid seed should work. In this case, train() should on;y be using it to determine which training set samples are in the CV or bootstrap data sets. Max On Wed, Jan 26, 2011 at 9:56 AM, Neeti nikkiha...@gmail.com wrote: Thank you so much for your reply. In my case it is giving error in

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Another (similar) question, If I now want to know the name of the data argument used, is there an easy way for me to access it? I'm trying to use something like: eval(parse(text = all.vars(terms(fit1))[1])) Which (of course) wouldn't work, since the response variable is only available in the

[R] adding error bars

2011-01-26 Thread ogbos okike
Dear all, I am trying to add error bars on a boxplot but have encountered an error as indicated below. Is there a package I need to install or a library I have to load before this goes please. Thanks for any idea. Ogbos x-replicate(20,rnorm(50)) boxplot(x,notch=TRUE,main=Notched boxplot with

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
Note that all.vars(terms(fit)) only looks at the formula in the terms object and throws away all the analysis done by rpart's call to terms(formula,data). Here is a contrived example of that approach failing: ageThreshold - 50 fit3 - rpart(Kyphosis==present ~ (AgeageThreshold) + log(Number,

Re: [R] adding error bars

2011-01-26 Thread Joshua Wiley
Hi, You will find package sos has some handy functions for searching for functions/packages: ### install.packages(sos) require(sos) findFn(error.bars) ### Perhaps the psych package has the error.bars() function you are thinking of? As a side

Re: [R] how to get loglik parameter from splm package?

2011-01-26 Thread Millo Giovanni
;^) you're right: we'll add it soon. Keep an eye on R-forge. All the best, Giovanni -- original message Message: 89 Date: Tue, 25 Jan 2011 17:14:00 -0800 (PST) From: zhaowei zao_...@msn.com To: r-help@r-project.org Subject: Re: [R] how to get loglik parameter from

Re: [R] adding error bars

2011-01-26 Thread David Winsemius
Harrell's wiki/website has material on so-called dynamite plots http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/DynamitePlots Ben Bolker has a page on them as well: http://emdbolker.wikidot.com/blog:dynamite -- David. On Jan 26, 2011, at 1:26 PM, Joshua Wiley wrote: Hi, You will

[R] using popbio, reduce number of digits in image2 plot

2011-01-26 Thread Tali
Hello All. I am using the image2 plot function in the popbio package to create 6 elasticity analyses. I am trying to reduce the number of significant digits that displays -- from 3 digits to 2. I tried rounding my original matrices, but one is comprised primarily of zeros, and the cut / breaks

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Henrique Dallazuanna
Try this: as.character(as.list(fit1$call)$data) On Wed, Jan 26, 2011 at 4:12 PM, Tal Galili tal.gal...@gmail.com wrote: Another (similar) question, If I now want to know the name of the data argument used, is there an easy way for me to access it? I'm trying to use something like:

[R] hmm.discnp hidden markov model

2011-01-26 Thread Qasim Javed
Hi all, I am using a discrete Hidden Markov Model with discrete observations in order to detect a sequence of integers. I am using the hmm.discnp package. I am using the following code: signature - c(-89, -98, -90, -84, -77, -75, -64, -60, -58, -55, -56, -57, -57, -63, -77, -81, -82, -91, -85,

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread Tal Galili
Exactly what I needed Henrique, Thank you. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English)

Re: [R] Extracting the terms from an rpart object

2011-01-26 Thread William Dunlap
I would leave off the as.character(). With it you get things like: f - rpart(Kyphosis ~ ., kyphosis[-3]) as.list(f$call)$data kyphosis[-3] as.character(as.list(f$call)$data) [1] [kyphosis -3 Expressions like quote(kyphosis[-3]) are much easier to analyze as expressions that

[R] how could I choose subvector of a vector?

2011-01-26 Thread Akram Khaleghei Ghosheh balagh
Hello ; How could I choose subvector of a vctor. for example if v=c(1,2,5,0,1), how could I chose the (1,2) or (1,2,5). thanks; [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Creating a new variable from existing ones

2011-01-26 Thread Melanie Zoelck
Hi, I am relatively new to R and have a question regarding code. I have a data set which has data organised by location (site names, which are factors). I now want to add a new variable Region (this will be non numerical, as it will be names). Each region will contain locations. So for

Re: [R] how could I choose subvector of a vector?

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 2:42 PM, Akram Khaleghei Ghosheh balagh wrote: Hello ; How could I choose subvector of a vctor. for example if v=c(1,2,5,0,1), how could I chose the (1,2) or (1,2,5). ?[ v[ c(1,2,5) ] thanks; [[alternative HTML version deleted]]

Re: [R] Creating a new variable from existing ones

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 2:06 PM, Melanie Zoelck wrote: Hi, I am relatively new to R and have a question regarding code. I have a data set which has data organised by location (site names, which are factors). I now want to add a new variable Region (this will be non numerical, as it will be

Re: [R] how could I choose subvector of a vector?

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 2:48 PM, David Winsemius wrote: On Jan 26, 2011, at 2:42 PM, Akram Khaleghei Ghosheh balagh wrote: Hello ; How could I choose subvector of a vctor. for example if v=c(1,2,5,0,1), how could I chose the (1,2) or (1,2,5). ?[ v[ c(1,2,5) ] I didn't notice at first

[R] applying a set of rules to each row

2011-01-26 Thread KATSCHKE, ADRIAN CIV DFAS
All, I would like to apply a set of rules to each row of the sample data set below. The rule sets are the guidelines for determining an individual's date for retirement eligibility. The rules are found in this document, http://www.opm.gov/feddata/RetirementPaperFinal_v4.pdf. I am only interested

[R] print() required sometimes in interactive use of console

2011-01-26 Thread Giles Crane
Surprising behavior: Most R users are aware that print() must be used inside functions to gain output on the console. Apparently, print() is sometimes required when interactively using the console. For example, the followingmay be entered into the R console with different results. sample(1:8,8)

Re: [R] applying a set of rules to each row

2011-01-26 Thread Bert Gunter
If I understand you correctly, you want ?ifelse, which works on the full logical vectors of rules applied to the variables, not ifelse, which works on only a single logical. -- Bert Gunter On Wed, Jan 26, 2011 at 12:18 PM, KATSCHKE, ADRIAN CIV DFAS adrian.katsc...@dfas.mil wrote: All, I

Re: [R] print() required sometimes in interactive use of console

2011-01-26 Thread Duncan Murdoch
On 26/01/2011 3:27 PM, Giles Crane wrote: Surprising behavior: Most R users are aware that print() must be used inside functions to gain output on the console. Apparently, print() is sometimes required when interactively using the console. For example, the followingmay be entered into the R

Re: [R] applying a set of rules to each row

2011-01-26 Thread KATSCHKE, ADRIAN CIV DFAS
Yes. That is exactly what I would like to have running. Here is the first attempt I made at using a nested ?ifelse statement for one of the retirement plans. The variables are all there but with different names. ageYOSstart is ageFedStart, SCDCivLeave is srvCompDT. I haven't gotten this

Re: [R] applying a set of rules to each row

2011-01-26 Thread David Winsemius
I remember something about the degree of nesting of ifelse calls being limited to 7 deep (???) that makes me worry about this approach. You may want to look at the arules package or the data.table package or the sqldf package for approaches that are specifically constructed with this sort

Re: [R] NA replacing

2011-01-26 Thread andrija djurovic
Thanks Dennis this is what I was looking for. On Wed, Jan 26, 2011 at 4:14 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: Here's one approach: f - function(df) { rs - with(na.exclude(df), tapply(y, strata, sum)/tapply(x, strata, sum)) u - transform(subset(df, is.na(y)), y = x

[R] Can not invoke maxent() of library(dismo) in Mac OSX

2011-01-26 Thread Mao Jianfeng
Dear R-helpers, I can not invoke maxent() in Mac OSX. Could you give me any directions on that? Thank you in advance. Here is my info: # (1) the error me - maxent(predictors, occtrain, factors='biome') me - maxent(predictors, occtrain, factors='biome') Error in .jcall(mxe, S, fit, c(autorun,

Re: [R] applying a set of rules to each row

2011-01-26 Thread Bert Gunter
... or perhaps just break things up with assignments and do it in stages. -- Bert On Wed, Jan 26, 2011 at 12:52 PM, David Winsemius dwinsem...@comcast.net wrote: I remember something about the degree of nesting of ifelse calls being limited to 7 deep (???)  that makes me worry about this

Re: [R] Sweave: \Sexpr{} inside ?

2011-01-26 Thread zerfetzen
Thanks Duncan, that helps. It successfully displays what I'm looking for, but it is not executing it. In a previous code chunk, it notes the time it took to run something, and in the successive code chunk, it runs something else where the previous time is now a parameter, but I'd like it to

[R] baseline hazard function

2011-01-26 Thread Simon Kiss
Dear colleagues, I have the following dataset. It is modelled on the data included in Box-Seteffenheiser and Jones Event History Modelling Using the following code, I try to find the baseline hazard function haz_1-muhaz(bpa$time, bpa$censored, subset=(bpa$year==2010 | bpa$ban==1), min.time=1,

[R] [R-pkgs] RGtk2Extras package for dataframe editing and easy dialog creation

2011-01-26 Thread Taverner, Thomas
Dear useRs, This is to announce the RGtk2Extras R package is available on CRAN in version 0.5.1. This package provides useful extras for R programmers who wish to create graphic user interfaces. It is based on GTK, using Michael Lawrence's RGtk2 package and John Verzani's gWidgets, and some

Re: [R] Sweave: \Sexpr{} inside ?

2011-01-26 Thread Duncan Murdoch
On 11-01-26 3:43 PM, zerfetzen wrote: Thanks Duncan, that helps. It successfully displays what I'm looking for, but it is not executing it. In a previous code chunk, it notes the time it took to run something, and in the successive code chunk, it runs something else where the previous time is

Re: [R] Making up a graph and its equation which better fits two groups of data

2011-01-26 Thread Greg Snow
Your faith in our ability to read your mind is apparently much higher than our actual ability to do so. What is the nature of your data? what question are you trying to answer? What type of equation do you want? What do you mean by better? Better than what? Maybe the esp package (pre-alpha)

[R] Trouble variable scoping a function writing with get()

2011-01-26 Thread Pat Schmitz
I am having trouble with variable scoping inside/outside functions. I want to use get() to grab a named and quoted variable as an input to a function, however the function can't find the variable when it is entered into the function call, only when it is named in the main environment. I

Re: [R] Trouble variable scoping a function writing with get()

2011-01-26 Thread Bert Gunter
It's looking for an object named b in the frame of the function. There is none. You need to specify get(response, pos = parent.frame()) ## or maybe even get(response, pos= globalenv()) HOWEVER, this is **exactly** why you shouldn't do this! Instead of passing in the name of the object, pass in

[R] boxplot - code for labeling outliers - any suggestions for improvements?

2011-01-26 Thread Tal Galili
Hello all, I wrote a small function to add labels for outliers in a boxplot. This function will only work on a simple boxplot/formula command (e.g: something like boxplot(y~x)). Code + example follows in this e-mail. I'd be happy for any suggestions on how to improve this code, for example:

Re: [R] boxplot - code for labeling outliers - any suggestions for improvements?

2011-01-26 Thread Greg Snow
For the last point (cluttered text), look at spread.labels in the plotrix package and spread.labs in the TeachingDemos package (I favor the later, but could be slightly biased as well). Doing more than what those 2 functions do becomes really complicated really fast. -- Gregory (Greg) L.

Re: [R] merge tables in a loop

2011-01-26 Thread MacQueen, Don
Not sure exactly what you mean by, “ writing a table with several rows per file”. If what you want to do is write output to an external file, adding to it as your loop progresses, then look at the functions sink() cat() And their ‘file’ and ‘append’ arguments. If what you want to do is

[R] Colour area under density curve

2011-01-26 Thread David Hervas Marin
Hello, I have this code to plot a certain normal distribution and represent the pnorm value for a certain x: x-300 xx - seq(2.5,7.5, by=0.1) yy - dnorm(xx,5.01,0.77) d-signif(pnorm(log(x), 5.01,0.77),4) xpts - round(exp(0:8)) par(bg = antiquewhite) plot(xx,yy, type=l, col=blue, lwd=2, xaxt=n,

[R] Find the empty element in a factor array

2011-01-26 Thread Wendy
Hi all, I have a factor array, and some of the elements are empty. How would I return the index number of the empty elements. For example, test-factor(c('A','','B','C','E')) test [1] A B C E Levels: A B C E I would like the result equal to 2. Thank you, Wendy -- View this message in

  1   2   >