Re: [R] Extrapolating values from a glm fit

2011-01-26 Thread Ahnate Lim
Even when I try to predict y values from x, let's say I want to predict y at x=0. Looking at the graph from the provided syntax, I would expect y to be about 0.85. Is this right: predict(mylogit,newdata=as.data.frame(0),type="response") # I get: Warning message: 'newdata' had 1 rows but variable

Re: [R] Factor rotation (e.g., oblimin, varimax) and PCA

2011-01-26 Thread Mark Difford
Finn, >> But when I use 'principal' I do not seem to be able to get the same >> results >> from prcomp and princomp and a 'raw' use of eigen: < ...snip... > >> So what is wrong with the rotations and what is wrong with 'principal'? I would say that nothing is wrong. Right at the top of the hel

Re: [R] identifying when one element of a row has a positive number

2011-01-26 Thread Peter Langfelder
Here's a solution., maybe not the most elegant but works. df.r = df1[, c(3:5)]; # restricted data nNonZero = apply(df.r!=0, 1, sum); one = nNonZero==1; oneZero = nNonZero==2; whichOne = apply(df.r[one, ]!=0, 1, which); whichZero = apply(df.r[oneZero, ]==0, 1, which); colNames = colnames(df.r);

[R] identifying when one element of a row has a positive number

2011-01-26 Thread Daisy Englert Duursma
Hello, I am not sure where to begin with this problem or what to search for in r-help. I just don't know what to call this. If I have 5 columns, the first 2 are the x,y, locations and the last three are variables about those locations. x<-seq(1860,1950,by=10) y<-seq(-290,-200,by=10) ANN<-c(3,0,0

Re: [R] Extrapolating values from a glm fit

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 10:52 PM, Ahnate Lim wrote: Dear R-help, I have fitted a glm logistic function to dichotomous forced choices responses varying according to time interval between two stimulus. x values are time separation in miliseconds, and the y values are proportion responses for one

[R] Need help with my homework

2011-01-26 Thread gaja
Hello to all again :) Again, I have an issue with my homework. I was troubling myself for two days, and I still can't get it :( So, if someone can help me, I would be so grateful... HOMEWORK 1. I need to draw function, random walk take the length of walk, and its in 2D. As a result, I have

[R] How do I fix this ?

2011-01-26 Thread eric
Just when I think I'm starting to learn Statement z1 works, statement z doesn't. Why doesn't z work and what do I do to fix it ? Clearly the problem is with the first NA, but I would think it's handled through the loop vectorization. y1 <- rnorm(20, 0, .013) y1 [1] -0.0068630836 -0.01011

[R] Extrapolating values from a glm fit

2011-01-26 Thread Ahnate Lim
Dear R-help, I have fitted a glm logistic function to dichotomous forced choices responses varying according to time interval between two stimulus. x values are time separation in miliseconds, and the y values are proportion responses for one of the stimulus. Now I am trying to extrapolate x value

[R] agnes clustering and NAs

2011-01-26 Thread Dario Strbenac
Hello, In the documentation for agnes in the package 'cluster', it says that NAs are allowed, and sure enough it works for a small example like : > m <- matrix(c( 1, 1, 1, 2, 1, NA, 1, 1, 1, 2, 2, 2), nrow = 3, byrow = TRUE) > agnes(m) Call:agnes(x = m) Agglomerative coefficient: 0.1614168

Re: [R] How do I fix this ?

2011-01-26 Thread Pete Brecknock
Eric Your problem lies in the way cumprod deals with NAs If you look at ?cumprod you will see "An NA value in x causes the corresponding and following elements of the return value to be NA" Not sure what behaviour you want to see on encountering an NA (ignore it, restart the cumprod process, .

[R] pdf greek letter typos

2011-01-26 Thread Eduardo de Oliveira Horta
Hi there, yet on the topic of greek letters and pdf plotting: when I run the following code pdf(file="temp.pdf") mu=seq(from=-pi, to=pi, length=100) plot(mu, sin(mu^2), type="l", xlab=expression(mu%in%(list(-pi,pi))), ylab=expression(sin(mu^2)), main=expression((list(mu,sin(mu

[R] Hilbert Huang Transformation

2011-01-26 Thread Jumlong Vongprasert
Dear All I try to use Hilbert Huang Transformation in R. How I can do. Many Thanks. -- Jumlong Vongprasert Assist, Prof. Institute of Research and Development Ubon Ratchathani Rajabhat University Ubon Ratchathani THAILAND 34000 [[alternative HTML version deleted]] __

Re: [R] binomial dist: obtaining probability of success on each trial

2011-01-26 Thread David Winsemius
On Jan 26, 2011, at 8:07 PM, Folkes, Michael wrote: I'm trying to fathom how to answer two example problems (3.3.2 & 3.3.3) in: Krishnamoorthy. 2006. "handbook of statistical distributions with applications" The first requires calculating single trial probability of success for a binomia

[R] binomial dist: obtaining probability of success on each trial

2011-01-26 Thread Folkes, Michael
I'm trying to fathom how to answer two example problems (3.3.2 & 3.3.3) in: Krishnamoorthy. 2006. "handbook of statistical distributions with applications" The first requires calculating single trial probability of success for a binomial distribution when we know: trial size=20, successes k=4, P(

Re: [R] Colour area under density curve

2011-01-26 Thread Peter Alspach
Tena koe David ?polygon should help you. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David Hervas Marin > Sent: Thursday, 27 January 2011 12:02 p.m. > To: R-Help > Subject: [R] Colour area under

Re: [R] Find the empty element in a factor array

2011-01-26 Thread Peter Alspach
Tena koe Wendy which(test=='') Should do it. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Wendy > Sent: Thursday, 27 January 2011 10:59 a.m. > To: r-help@r-project.org > Subject: [R] Find the empt

Re: [R] removing outlier function / dataset update

2011-01-26 Thread kirtau
First off, thank you for the help with the global environment. I have however attempted to run the code and am now presented with a new error which is "Error in formula.default(eval(parse(text = x)[[1L]])) : invalid formula" and am not sure what to make of it. I have tried a few different work a

[R] Factor rotation (e.g., oblimin, varimax) and PCA

2011-01-26 Thread Finn Aarup Nielsen
A bit of a newbee to R and factor rotation I am trying to understand factor rotations and their implementation in R, particularly the GPArotation library. I have tried to reproduce some of the examples that I have found, e.g., I have taken the values from Jacksons example in "Oblimin Rotati

[R] Quantile regression (rq) and complex samples

2011-01-26 Thread James Shaw
I am new to R and am interested in using the program to fit quantile regression models to data collected from a multi-stage probability sample of the US population. The quantile regression package, rq, can accommodate person weights. However, it is not clear to me that boot.rq is appropriate for

[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 con

[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", lw

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 appe

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. Snow

[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] 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 i

[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 obviously

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) c

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

[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 id

[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.t

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 nume

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 wrote: > 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 t

[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("au

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 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 * rs[s

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] 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 working.

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 cons

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 wrote: > All, > > I would like to apply a s

[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)

[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 i

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 t

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 n

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]] __

[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 example:

[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 https://stat.ethz.ch/mailman/listinfo/r-hel

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 expressio

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) ---

[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

[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 op

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 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: > eval(parse(text =

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 wil

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 To: r-help@r-project.org Subject: Re: [R] how to get loglik parameter from splm package? Me

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 si

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" ~ (Age>ageThreshold) + log(N

[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 er

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 d

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 wrote: > > Thank you so much for your reply. In my case it is giving error in some seed > value f

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] 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 Henrique Dallazuanna
Try this: all.vars(terms(fit1)) all.vars(terms(fit2)) On Wed, Jan 26, 2011 at 3:33 PM, Tal Galili 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 manipulation on it). >

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 ti

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 a

[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

[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: f

[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? T

[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 Kolmogorov

[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] 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

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 = c(1,1.

[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] 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 wrote: > > Hi: > > > > Here are two more candidates, using the plyr and data.table packages: > > > > library(plyr) > > ddply(X, .(x, y), function(d) length(unique

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 respo

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 plac

[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), > xlab=

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? --

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] 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: http://r.789695.n4.nabble.com/Train-error-subscript-out-of-bonds-tp3234510p323

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\\Ulea

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 clut

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] 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 A

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 removed

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. M

Re: [R] Help Derivate for Nonlinear Growth Models

2011-01-26 Thread Ben Bolker
acocac 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 Rich

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 proble

[R] Fwd: MAtrix addressing

2011-01-26 Thread David Winsemius
Begin forwarded message: From: David Winsemius Date: January 26, 2011 8:32:30 AM EST To: Alaios 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 solution. Bring again this picture in fron

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 GTK-ru

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 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 function

[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 apprec

[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 sug

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 x.out=sign

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 rath

[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] 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 wri

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: > > <> > 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

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 Mar

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 o

[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] 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 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] > X2=rep(1:5,rep(2,5))

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

  1   2   >