Re: [R] Avoiding a loop

2011-04-08 Thread Juan Carlos Borrás
#Use the indexes of S in a sapply function. N - 10 S - sample(c(0,1), size=N, replace=TRUE) v1 - sapply(c(1:N-1), function(i) S[i]S[i+1]) # Then v2 - (P m) # And I guess you can fill up the rest. Beware of the boundary condition (the NA in v1) Cheers, jcb! ___

Re: [R] Simulation from discrete uniform

2011-04-08 Thread Søren Højsgaard
?sample -Oprindelig meddelelse- Fra: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] På vegne af cassie jones Sendt: 8. april 2011 03:16 Til: r-help@r-project.org Emne: [R] Simulation from discrete uniform Dear all, I am trying to simulate from discrete uniform

Re: [R] Avoiding a loop

2011-04-08 Thread Kenn Konstabel
2011/4/8 Juan Carlos Borrás jcbor...@gmail.com: #Use the indexes of S in a sapply function. N - 10 S - sample(c(0,1), size=N, replace=TRUE) v1 - sapply(c(1:N-1), function(i) S[i]S[i+1]) You can achieve the same v1 using v1.2 - S[2:N-1] S[2:N] .. or if you insist on having NA as the first

[R] random sampling with levels and with replacement

2011-04-08 Thread taby gathoni
Dear all, i have a dataset of about 400 records , with a variable that has  two levels 40 bad and 360 good among other variables,how do i come up  with10 random samples that have the composition of as the main sample  but maintaining the 40 bad 360 good with replacement, i recently discovered

Re: [R] [SOLVED] dotplot as a background for multiple barchart plots (with Lattice)

2011-04-08 Thread Christian Charles
Thanks, The first literal solution does not do what I want: the 'meanplot' was not a background but a smaller object in the middle of the barcharts. The second solution is exactly what I want. I just changed the plotting order and the global ylim in order to have a better plot. Thanks for

[R] Is function compiled code or not?

2011-04-08 Thread Stefan Petersson
Hi, Sorry for my ignorance, but how can I see if a function is 'compiled code' or plain R? E.g. the daisy function from the cluster package. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Regrouping data

2011-04-08 Thread Sandeepa Ramakrishnan
Dear R helpers, Thanks a lot for your kind help. The xtab function suggested by Mr. Henrique Dallazuanna produces following output for me xtabs(values ~ name + period + cy_date, rat_dat) , , cy_date = 31-May-11     period name 29-Mar-11 30-Mar-11 31-Mar-11    A 10.37

Re: [R] Quasipoisson with geeglm

2011-04-08 Thread JANSEN, Ivy
Thanks a lot for the answer. So in fact, without knowing, I was already doing the correct thing ;-) Regards, Ivy -Oorspronkelijk bericht- Van: Søren Højsgaard [mailto:soren.hojsga...@agrsci.dk] Verzonden: donderdag 7 april 2011 17:05 Aan: JANSEN, Ivy; r-help@r-project.org Onderwerp:

Re: [R] R and lazy evaluation

2011-04-08 Thread peter dalgaard
On Apr 8, 2011, at 06:08 , Russ Abbott wrote: Haskell is the prototypical lazy evaluation language. One can compute a Fibonacci sequence by the Haaskell equivalent of the following R code. fibs - c(0, 1, rep(0, 8)) fibs[3:10] - fibs + fibs[-1] This works as follows. fibs = 0, 1, 0,

Re: [R] Avoiding a loop

2011-04-08 Thread Juan Carlos Borrás
Kenn, I find your solution more elegant. 2011/4/8 Kenn Konstabel lebats...@gmail.com: 2011/4/8 Juan Carlos Borrás jcbor...@gmail.com: #Use the indexes of S in a sapply function. N - 10 S - sample(c(0,1), size=N, replace=TRUE) v1 - sapply(c(1:N-1), function(i) S[i]S[i+1]) You can achieve

Re: [R] Avoiding a loop

2011-04-08 Thread Daniel Malter
Hi, this response uses the previous responses with an example: #Assume you have 100 observations n=100 #Simulate a time series of prices error=rnorm(n,0,3) raw.price=rpois(n,100) lag.price=c(rpois(1,100),raw.price[1:99]) price=lag.price+error #Say you want the moving average based on this #and

Re: [R] random sampling with levels and with replacement

2011-04-08 Thread Daniel Malter
If you want perfect equality, split the data in good and bad and sample from the two samples individually. On average, however, random sampling from the entire data will reproduce the proportion of good and bad in the data. hth, Daniel -- View this message in context:

Re: [R] Regrouping data

2011-04-08 Thread Dennis Murphy
Hi: Here's one approach using the reshape package: library(reshape) rat_melt - cast(rat_dat, period ~ name) rat_melt period A B C D 1 29-Mar-11 10.37 12.61 14.08 11.17 2 30-Mar-11 10.46 12.65 14.12 11.15 3 31-Mar-11 10.42 12.62 14.10 11.11 # To get the dates in reverse

Re: [R] Effects - plot the marginal effect

2011-04-08 Thread Tomii
Thank you for your response, but these changes doesn't seem to change anything, outcomes of effect command is still the same - error. Tomas On Fri, Apr 1, 2011 at 5:03 AM, John Fox j...@mcmaster.ca wrote: Dear Tomas, Write the model as mreg01 = lm(enep1 ~ enpres * proximity1), data=a90)

[R] Odp: random sampling with levels and with replacement

2011-04-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.04.2011 09:31:44: Dear all, i have a dataset of about 400 records , with a variable that has two levels 40 bad and 360 good among other variables,how do i come up with10 random samples that have the composition of as the main sample but

Re: [R] random sampling with levels and with replacement

2011-04-08 Thread Andreas Borg
Hi, I am not perfectly sure what you want to do, but here is what I would do to maintain good/bad ratio in the sample (as Daniel posted, split the data and sample from the groups): df - data.frame(V1 = 1:400, V2 = c(rep(good,360), rep(bad,40))) isGood - which(df$V2==good) isBad -

Re: [R] transform() on selective names. Is it possible?

2011-04-08 Thread Juan Carlos Borrás
# The code demonstrating the final version I am going to use is as follows rm(list=ls()) # Beware of this one so it doesn't spoil your workspace N - 100 M - 2 x - matrix(data=rnorm(N*M, 0, 3)-10, ncol=M, nrow=N) y - matrix(c(1,-2,-2,1), ncol=M, nrow=M) z - data.frame(x %*% y) colnames(z) -

Re: [R] metaplot

2011-04-08 Thread cheba meier
Thank you for your reply. forest(log(rr), ci.lb=lci, ci.ub=uci, xlab=Log Relative Risk) Error in sei^2 : 'sei' is missing Regards, Cheba 2011/4/7 Viechtbauer Wolfgang (STAT) wolfgang.viechtba...@maastrichtuniversity.nl Actually, Scott suggested ggplot2, which is available on CRAN:

Re: [R] metaplot

2011-04-08 Thread Viechtbauer Wolfgang (STAT)
What version of the metafor package are you using? The option of directly providing the CI bounds was added in version 1.5-0, so make sure you are using the newest version. Best, -- Wolfgang Viechtbauer Department of Psychiatry and Neuropsychology School for Mental Health and Neuroscience

Re: [R] metaplot

2011-04-08 Thread cheba meier
I have just installed the package as install.packages(metafor) --- Please select a CRAN mirror for use in this session --- . downloaded 403 Kb package 'metafor' successfully unpacked and MD5 sums checked library(metafor) Loading required package: Formula Loading required package: nlme

[R] Very simple question

2011-04-08 Thread Ronaldo Reis Junior
Hi, I have a very simple doubt. Look: teste - c(A,B,C) teste2 - paste(teste[1],teste[2],teste[3],sep=+) teste2 [1] A+B+C How to make it automatic, like I try to use paste(teste,sep=+) but the paste dont get the teste elements separately to join again in a unique element. Exist any

Re: [R] Very simple question

2011-04-08 Thread Mario Valle
paste(teste, collapse=+) ciao! mario On 08-Apr-11 12:44, Ronaldo Reis Junior wrote: teste - c(A,B,C) -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60

Re: [R] Very simple question

2011-04-08 Thread Jim Lemon
On 04/08/2011 08:44 PM, Ronaldo Reis Junior wrote: Hi, I have a very simple doubt. Look: teste - c(A,B,C) teste2 - paste(teste[1],teste[2],teste[3],sep=+) teste2 [1] A+B+C How to make it automatic, like I try to use paste(teste,sep=+) but the paste dont get the teste elements

Re: [R] Is function compiled code or not?

2011-04-08 Thread Paul Hiemstra
On 04/08/2011 09:44 AM, Stefan Petersson wrote: Hi, Sorry for my ignorance, but how can I see if a function is 'compiled code' or plain R? E.g. the daisy function from the cluster package. __ R-help@r-project.org mailing list

Re: [R] random sampling with levels and with replacement

2011-04-08 Thread taby gathoni
Thanks Daniel, Its a long way but it will work. --- On Fri, 4/8/11, Daniel Malter dan...@umd.edu wrote: From: Daniel Malter dan...@umd.edu Subject: Re: [R] random sampling with levels and with replacement To: r-help@r-project.org Date: Friday, April 8, 2011, 10:08 AM If you want

[R] plot.correlogram

2011-04-08 Thread agent dunham
Dear all, I've tried an lm model. I want to check indepence of the residuals, so I was trying the following: library(ape) plot.correlogram(residuals(model1)) I obtain this error: Error en x$p.values : $ operator is invalid for atomic vectors Any idea? Thanks in advance, u...@host.com

Re: [R] Very simple question

2011-04-08 Thread Eik Vettorazzi
Hi, try paste(teste,collapse=+) cheers. Am 08.04.2011 12:44, schrieb Ronaldo Reis Junior: Hi, I have a very simple doubt. Look: teste - c(A,B,C) teste2 - paste(teste[1],teste[2],teste[3],sep=+) teste2 [1] A+B+C How to make it automatic, like I try to use paste(teste,sep=+) but

[R] Variance of random effects: survreg()

2011-04-08 Thread Dr. Pablo E. Verde
I have the following questions about the variance of the random effects in the survreg() function in the survival package: 1) How can I extract the variance of the random effects after fitting a model? For example: set.seed(1007) x - runif(100) m - rnorm(10, mean = 1, sd =2) mu - rep(m,

Re: [R] Very simple question

2011-04-08 Thread Alfredo Alessandrini
Exist any function to associated with paste make this result more automatically. you can try with gsub. Alfredo 2011/4/8 Ronaldo Reis Junior chrys...@gmail.com: Hi, I have a very simple doubt. Look: teste - c(A,B,C) teste2 - paste(teste[1],teste[2],teste[3],sep=+) teste2 [1]

Re: [R] metaplot

2011-04-08 Thread cheba meier
I installed R 2.12 and it works now, thank you Wolfgang. Servus Cheba library(metafor) Error: This is R 2.11.0, package 'metafor' needs = 2.12.0 2011/4/8 cheba meier cheba.me...@googlemail.com I have just installed the package as install.packages(metafor) --- Please select a CRAN mirror

[R] Rpart decision tree

2011-04-08 Thread tudor
Dear useRs: I try to plot an rpart object but cannot get a nice tree structure plot. I am using plot.rpart and text.rpart (please see below) but the branches that connect the nodes overlap the text in the ellipses and rectangles. Is there a way to get a clean nice tree plot (as in the Rpart

Re: [R] Sub/Superscript in plot in a loop

2011-04-08 Thread David Winsemius
On Apr 7, 2011, at 9:46 PM, mavkoup wrote: I have a for loop with counter i and I'm producing plots where I ultimately want to label the axes: Entry a_i from P^q, where a, P and q are just letters, and i is the value of the for loop counter. I've tried various combinations of paste,

Re: [R] Variance of random effects: survreg()

2011-04-08 Thread Dennis Murphy
Hi: I didn't see anything on first blush from the mod1 or summary(mod1) objects, but it's not too hard to compute: names(mod1) [1] coefficients icoef var [4] var2 loglikiter [7] linear.predictors frail fvar [10] dfpenalty

Re: [R] Regrouping data

2011-04-08 Thread Henrique Dallazuanna
Try this: reshape(rat_dat, direction = 'wide', idvar = 'period', timevar = 'name') On Fri, Apr 8, 2011 at 4:44 AM, Sandeepa Ramakrishnan sandeepa_ramakrish...@yahoo.com wrote: Dear R helpers, Thanks a lot for your kind help. The xtab function suggested by Mr. Henrique Dallazuanna

[R] xyplot, groups and colors

2011-04-08 Thread Philipp Pagel
Dear ExpeRts, I am trying to plot a bunch of growth curves and would like to get some more control over groups and line colors than I seem to have. Example: # make some data dat - Orange dat$group - ifelse(dat$Tree%in%c('1','4','5'), 'A', 'B') # plot xyplot(circumference~age, dat,

Re: [R] Effects - plot the marginal effect

2011-04-08 Thread David Winsemius
On Apr 8, 2011, at 4:24 AM, Tomii wrote: Thank you for your response, but these changes doesn't seem to change anything, outcomes of effect command is still the same - error. Tomas On Fri, Apr 1, 2011 at 5:03 AM, John Fox j...@mcmaster.ca wrote: Dear Tomas, Write the model as mreg01 =

Re: [R] Avoiding a loop

2011-04-08 Thread jim holtman
Use 'diff' to determine where the changes are: S - sample(0:1,30,TRUE) S [1] 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 0 1 0 0 0 0 0 1 0 which(diff(S) == -1) [1] 4 9 13 15 18 21 23 29 then use the indices for the other processing. On Thu, Apr 7, 2011 at 10:30 PM, Worik R wor...@gmail.com

Re: [R] xyplot, groups and colors

2011-04-08 Thread David Winsemius
On Apr 8, 2011, at 8:06 AM, Philipp Pagel wrote: Dear ExpeRts, I am trying to plot a bunch of growth curves and would like to get some more control over groups and line colors than I seem to have. Example: # make some data dat - Orange dat$group - ifelse(dat$Tree%in%c('1','4','5'),

Re: [R] xyplot, groups and colors

2011-04-08 Thread Jeremy Hetzel
Philipp, I would do the following with ggplot2: # Set up data require(ggplot2) dat - Orange dat$group - ifelse(dat$Tree%in%c('1','4','5'), 'A', 'B') # Specify the ggplot group aesthetic as Tree g1 - ggplot(data = dat, aes(x = age, y = circumference, group=Tree)) # Specify the geom_point and

Re: [R] Rpart decision tree

2011-04-08 Thread Tal Galili
Hi Tudor, What type of tree did you create? (classification or regression?) Could you give an explanation as to what is not looking nice? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

Re: [R] Windrose Percent Interval Frequencies Are Non Linear! Help!

2011-04-08 Thread Brittain Briber
Hadley - Thanks for your answers.  I didnt think of it that way and what you say makes complete sense.  Truthfully, however, I dont care to maintain an equal area for each increment.  When discussing frequency distributions on the rose, having a diagram with equally spaced intervals would be

Re: [R] Effects - plot the marginal effect

2011-04-08 Thread John Fox
Dear Tomas, On Fri, 8 Apr 2011 10:24:45 +0200 Tomii dioge...@gmail.com wrote: Thank you for your response, but these changes doesn't seem to change anything, outcomes of effect command is still the same - error. It's not really possible to help you with so little information; if you send a

Re: [R] Getting number of students with zeroes in long format

2011-04-08 Thread Jorge Ivan Velez
Hi Chris, Sorry for the late response. The following selects all students that have never been suspended: with(susim, tapply(sus, id_r, function(x) all(x == 0))) 999881 999886 999890 999892 999896 999897 FALSE TRUE TRUE TRUE FALSE TRUE r - with(susim, tapply(sus, id_r, function(x)

[R] Removing not duplicated rows

2011-04-08 Thread Chris82
Hello R users, I have a problem to delete rows in a table which are not duplicated in order of an id number a short example: x - data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10)) x_new - x[which(duplicated(x$id)),] x_new id value 3 2 3 4 2 4 6 3 6 10 610

Re: [R] xyplot, groups and colors

2011-04-08 Thread Dennis Murphy
Hi: This seems to 'work': xyplot(circumference~age, dat, groups=Tree, type='l', col.line = c('red', 'blue', 'blue', 'red', 'red')) After a little more fiddling around, this also works, and seems a bit less kludgy: dat$group2 - factor(dat$group, labels = c('red', 'blue'))

Re: [R] help with arima time series forecasting

2011-04-08 Thread Berend Hasselman
paul4 wrote: Hello all, I am new in R language . I want to forecast a univariate time series by arima model. Could you please help me finding a good document that describes this problem by a simple example and step by step ? ?arima and follow the links in the See also section such as

Re: [R] Removing not duplicated rows

2011-04-08 Thread Jeremy Hetzel
As I understand it, you are trying to subset the data frame to include only rows with a non-unique id. Try this: x - data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10)) id.table - table(x$id) x_new - subset(x, id %in% id.table[id.table 1]) Jeremy

[R] multinom() residual deviance

2011-04-08 Thread Sascha Vieweg
Running a binary logit model on the data df - data.frame(y=sample(letters[1:3], 100, repl=T), x=rnorm(100)) reveals some residual deviance: summary(glm(y ~ ., data=df, family=binomial(logit))) However, running a multinomial model on that data (multinom, nnet) reveals a residual deviance:

Re: [R] Removing not duplicated rows

2011-04-08 Thread Jeremy Hetzel
Sorry, I left out the names() function in the last step. Try this instead: x - data.frame(cbind(id=c(1,2,2,2,3,3,4,5,6,6), value=1:10)) id.table - table(x$id) x_new - subset(x, id %in% names(id.table[id.table 1])) Jeremy __ R-help@r-project.org

[R] Quantile Regression and R

2011-04-08 Thread Sheldrick, Peter (Specialty Casualty UW Support)
Sir or Madam: I am new to R and the use of quantile regeression. In addition, I am a finance person not a true statistcian. Basic regression form is Y = (Coefficient * Variable) + Error Term I have results from a quantile regression where I used the Barro and Roberts method with bootstrapping

[R] Estimates at each iteration

2011-04-08 Thread hello bye
Dear Sir\ Madam  I am trying to maximise a complicated loglikelihood function  via EM algorithm which consists of two step E-step and M-stepand in this case I need to maximize the expected of like lihood function which I get from E- step and take those estimates of parameter to update the

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

2011-04-08 Thread Jeff Stevens
Hi, I am trying to add text to the bottom of a lattice bwplot with multiple panels. I would like to add a label below each boxplot, but the labels do not come from the data. I've tried the following, code: f1 - c(rep(c(rep(a, 3), rep(b, 3), rep(c, 3)), 2)) f2 - c(rep(A, 9), rep(B, 9)) dv -

[R] Time Series Clustering for SAR data

2011-04-08 Thread daveal81
Hi! I'm very new user of R! I need to learn more about! My problems are to create a time series with exiting data and to make an study: 1 ) I have column with DD-MM-YR, to transform from string text to date, and use it as to use as time series, I've made the transformation with command

[R] asking about contour plot with R

2011-04-08 Thread nferreri
I'm working in Rosario, Argentina, trying to plot some contours. I found the function draw.contour created by James Forester at R-bloggers. If you take a look at that function you'll see it's very useful! But I have a problem with it and James is trying to help me (but also asked me to seek for

[R] help question

2011-04-08 Thread DEBERGH Patrick
hello I am at the very beginneing of using the R program I just don't understand how one can save a programfile For exemple, if I type in R 23+456 and want to save this file under a ceratin name to reload it later, i just don't get the way to do it I can save it with the save function;I

[R] problem with my subscription

2011-04-08 Thread Kay Jaja
I have been trying ot post through R-help and it asks me to subscribe. I have subscribed may times but did not get a confirmation. can you check to see what is wrong with my subscription. I can not post on the R-help mailing list at this time. thanks [[alternative HTML

[R] Snow/Snowfall hangs on windows 7

2011-04-08 Thread Anna Ågren
Dear users, I want to set up R to use one R-script directory and one R-library (directory for packages) for many end-users. I try to do this by using one network-share. This works fine as long as we don't use the snowfall package with parallel=TRUE (sfInit(parallel=TRUE, cpus=4,

Re: [R] Removing not duplicated rows

2011-04-08 Thread Chris82
Thanks a lot, Jeremy! It's working perfectly. With best regards -- View this message in context: http://r.789695.n4.nabble.com/Removing-not-duplicated-rows-tp3436600p3436736.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Estimates at each iteration

2011-04-08 Thread Jonathan P Daily
I'm assuming that English is not your first language. In light of that, I would suggest that you post your question in a language that we both speak: R. Please include: 1) E-step and M-step functions. 2) The proposed optim/maxLik call. Mostly because (at least optim) does not have a parameter

Re: [R] lars - lasso problem

2011-04-08 Thread Steve Lianoglou
Hi, On Fri, Apr 8, 2011 at 10:33 AM, gauri j gauri.ja...@gmail.com wrote: hi, I have problem in following code, error is occurred. I have attached my data herewith. and my code is as following, library(lars) Loaded lars 0.9-8 Warning message: package 'lars' was built under R version 2.12.2

Re: [R] Very simple question

2011-04-08 Thread Ronaldo Reis Junior
Thanks That is it really simple. Ronaldo Em 08-04-2011 07:48, Mario Valle escreveu: paste(teste, collapse=+) ciao! mario On 08-Apr-11 12:44, Ronaldo Reis Junior wrote: teste - c(A,B,C) -- 1ª lei - Suas férias começam após a defesa e entrega de sua dissertação.

Re: [R] Rpart decision tree

2011-04-08 Thread Achim Zeileis
On Fri, 8 Apr 2011, tudor wrote: Dear useRs: I try to plot an rpart object but cannot get a nice tree structure plot. I am using plot.rpart and text.rpart (please see below) but the branches that connect the nodes overlap the text in the ellipses and rectangles. Is there a way to get a clean

Re: [R] asking about contour plot with R

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 9:16 AM, nferr...@fceia.unr.edu.ar wrote: I'm working in Rosario, Argentina, trying to plot some contours. I found the function draw.contour created by James Forester at R-bloggers. If you take a look at that function you'll see it's very useful! But I have a problem with it and

Re: [R] Randomisation tests

2011-04-08 Thread Greg Snow
For simple permutation tests I usually just code it up in regular R without worrying about any packages. R is powerful enough that it is simple to do a permutation test in only a few lines ( or sometimes just one long line). And that way you know exactly what it is doing. -- Gregory (Greg)

Re: [R] Windrose Percent Interval Frequencies Are Non Linear! Help!

2011-04-08 Thread Ben Bolker
Brittain Briber brittbriber at yahoo.com writes:   Do you two or anyone else out there happen to know if it is possible to specify the width of the intervals in windrose?  Is there a parameter that I can pass along that would do this?  Below is a reproducible script in which you can see

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread algorimancer
I too am encountering this problem. When I have a large script, if I select all in the editor and then ctrl-r to run, if it encounters a stop() function it simply prints an error message and continues to execute the remainder of the script, as opposed to terminating execution at that line. The

Re: [R] Alignment of lines within barplot bars

2011-04-08 Thread Greg Snow
Look at the updateusr function in the TeachingDemos package. -- 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 [mailto:r-help-bounces@r- project.org] On Behalf Of

Re: [R] help question

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 9:20 AM, DEBERGH Patrick wrote: hello I am at the very beginneing of using the R program I just don't understand how one can save a programfile For exemple, if I type in R 23+456 and want to save this file under a ceratin name to reload it later, i just don't get the way to do

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 11:47 AM, algorimancer wrote: I too am encountering this problem. When I have a large script, if I select all in the editor and then ctrl-r to run, if it encounters a stop() function it simply prints an error message and continues to execute the remainder of the script, as opposed

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread William Dunlap
Put an open brace in the first line of your file and a close brace in the last line. I encourage people with scripts long enough that this is a problem to divide up their work into functions that a shorter script calls. (This is akin to UCSD Pascal on the Osbourne II that refused to deal with a

Re: [R] Fast version of Fisher's Exact Test

2011-04-08 Thread Jim Silverton
Is anyone aware of a fast way of doing fisher's exact test for a series of 2 x 2 tables in R? The fisher.test is really slow if n1=1000 and n2 = 1000. -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] plot layout with several plots ON plot area of previous plot

2011-04-08 Thread Greg Snow
Some of the functions that were the first in the TeachingDemos package were originally written to help me visualize something, so it is not just teachers demoing, but people demoing to themselves. It has become a bit of a misc package with several utilities that are useful in themselves, but

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 12:40 PM, William Dunlap wrote: Put an open brace in the first line of your file and a close brace in the last line. This shares an advantage with the method I suggested: if there's a syntax error somewhere in the script, *nothing* will be executed. It has the disadvantage of

Re: [R] Quantile Regression and R

2011-04-08 Thread Frank Harrell
Dear Peter, Quantile regression is a nice tool but one that requires some statistical training in order to use it and interpret the results properly. I suggest backing up a bit. Frank Sheldrick, Peter (Specialty Casualty UW Support) wrote: Sir or Madam: I am new to R and the use

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread Jonathan P Daily
Would options(error = recover) be of some help? -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty? Does the room, the thing itself have purpose? Or do

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

2011-04-08 Thread Dennis Murphy
Hi: After a number of false starts, I finally consulted Deepayan's book and the example on p. 73, suitably adapted, yielded a solution. Add a variable for the labels and then... df$lab - rep(1:6, each = 3) bwplot(dv ~ f1 | f2, data = df, ylim = c(0.5, 1), panel = function(x, y, ..., subscripts)

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 1:29 PM, Jonathan P Daily wrote: Would options(error = recover) be of some help? No, that will probably be very confusing. The problem is that the Windows GUI uses Ctrl-R as a short form of cut from the editor, paste to the console, and it will paste the whole text regardless

[R] Fwd: The results of your email commands

2011-04-08 Thread Rohit Pandey
Hi R community, I posted a question on using the R maximum likelihood functions a short while ago and got an email saying that some of the content was unprocessed. Hence, I am reposting the question just to be sure (sorry for the multiple emails if both reached you). My question is reagarding

[R] How to check redundancy of variable and reduce data dimension

2011-04-08 Thread Bill Hyman
Dear all, Do you know how to check redundancy of variables and reduce the dimension in R? It seems PCA can do this. Is there any other better way to implement in R? Many thanks! Bill __ R-help@r-project.org mailing list

Re: [R] How to *completely* stop a script after stop()?

2011-04-08 Thread algorimancer
Thank you all for the astoundingly quick responses. I think that the bounding open/closed braces approach sounds like the easiest solution for the moment -- though I look forward to seeing this all automated in a future version of R :) Incidentally, I have indeed encapsulated much of the code as

Re: [R] Fast version of Fisher's Exact Test

2011-04-08 Thread Bert Gunter
1. I am not an expert on this. 2. However, my strong prior would be no, since because it is exact it has to calculate all the possible configurations and there are a lot to calculate with the values of n1 and n2 you gave. -- Bert On Fri, Apr 8, 2011 at 9:43 AM, Jim Silverton

Re: [R] lars - lasso problem

2011-04-08 Thread Steve Lianoglou
Hi, First: Please make sure you CC R-help when responding to messages on the list so that more people can help you, and more people can benefit from help that is provided. You can do so easily by replying with reply-all. Now: Look at the help for the lars function: R ?lars You'll see that `x`

Re: [R] Avoiding a loop

2011-04-08 Thread Niels Richard Hansen
I believe the solutions proposed ignore the recursive nature of the original problem and hence produce wrong solutions. P - c(5, 7, 6.01, 6.01, 7) m - rep(6, 5) S0 - as.numeric(P(m*1.005)) Then the original loop from Worik gives S - S0 for(i in 2:length(S)){ if(S[i]==0 S[i-1] == 1){

Re: [R] Windrose Percent Interval Frequencies Are Non Linear! Help!

2011-04-08 Thread Peter Ehlers
On 2011-04-08 09:26, Ben Bolker wrote: Brittain Briberbrittbriberat yahoo.com writes: Do you two or anyone else out there happen to know if it is possible to specify the width of the intervals in windrose? Is there a parameter that I can pass along that would do this? Below is a

Re: [R] set locale information in R

2011-04-08 Thread Uwe Ligges
Try Sys.setenv(LANGUAGE=Fr) Uwe Ligges On 07.04.2011 10:29, Raji wrote: Hi R-helpers, Is it possible to localise the error messages/warnings that comes from R.My application takes in a locale information.I used the following command to set the locale in R.But in RGui, i still get the

[R] dynamic argument names and values as variables inside a loop

2011-04-08 Thread Christopher Marcum
Greetings All! After much trial and error, and an exhaustive search of the archives, I'm writing to solicit help with a problem. I want to dynamically modify variable names and values as function arguments inside a loop. I have a canned function from a package that takes ellipsis (...)

Re: [R] Rpart decision tree

2011-04-08 Thread tudor
Hi Achim: I will give it a try and let you know how it goes. Thanks. Tudor -- View this message in context: http://r.789695.n4.nabble.com/Rpart-decision-tree-tp3435888p3437212.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] lars - lasso problem

2011-04-08 Thread gauri j
HI, Thank you, I will try this, and let you know about the results. Thanks once again. Gauri 2011/4/8 Steve Lianoglou mailinglist.honey...@gmail.com Hi, First: Please make sure you CC R-help when responding to messages on the list so that more people can help you, and more people can

[R] a strange behavior with ifelse

2011-04-08 Thread wgu
I have used R for years but run into a seemingly simple problem involving 'ifelse'. condensed code like this a=c(2,NA,NA,NA,2,2,NA,2,NA,2) b=c(NA,1,1,NA,2,2,2,2,2,2) #I want to combined a and b into c so that c would be a valid number either a or b is not missing

[R] local({}) documentation?

2011-04-08 Thread Doug Elias
Greetings, all ... I'm trying to find documentation on the use of the local() function, and am drawing a complete blank; would someone please send me a pointer to where I can learn what it is intended for, and how to correctly use it? Many thanks! Doug [[alternative HTML version

Re: [R] Rpart decision tree

2011-04-08 Thread tudor
Hi Tal: Thanks for your quick reply. I tried to create a classification tree. The problem is that the branches overlap the text in the ellipses (inner nodes) and rectangles (terminal nodes) - At times this makes it difficult for the reader to correctly process the results. One way to

Re: [R] local({}) documentation?

2011-04-08 Thread Duncan Murdoch
On 08/04/2011 2:11 PM, Doug Elias wrote: Greetings, all ... I'm trying to find documentation on the use of the local() function, and am drawing a complete blank; would someone please send me a pointer to where I can learn what it is intended for, and how to correctly use it? Try ?local. As

Re: [R] a strange behavior with ifelse

2011-04-08 Thread Joshua Wiley
Hi, The problem is that (a == 1 | b == 1) returns some NAs. NAs are not treated as strictly TRUE or FALSE. From the documentation (see ?ifelse) Missing values in 'test' give missing values in the result. You need to use a construct designed to force a TRUE/FALSE value OR something that handles

Re: [R] local({}) documentation?

2011-04-08 Thread Martin Morgan
On 04/08/2011 11:11 AM, Doug Elias wrote: Greetings, all ... I'm trying to find documentation on the use of the local() function, and am drawing a complete blank; would someone please send me a pointer to where I can learn what it is intended for, and how to correctly use it? Hi Doug --

[R] gstat data formatting

2011-04-08 Thread EdmAB
Hello, I am interested in using the hscat command in the gstat package to create h-scatterplots of snow depth measurements over a given area (spatial autocorrelation). Unfortunately I do not understand how to format my data for import into R for use with the hscat command. I have checked the

[R] a bug in write.csv?

2011-04-08 Thread Santosh
Dear Rxperts! A simple example where write.csv does not seem to accept user specified arguments.. Why? write.csv(t(1:10),./te1.csv,quo=F,col.names=F) Warning message: In write.csv(t(1:10), ./te1.csv, quo = F, col.names = F) : attempt to set 'col.names' ignored However, write.table does

Re: [R] a bug in write.csv?

2011-04-08 Thread Ista Zahn
Please read the documentation where this is clearly explained. See ?write.csv Best, Ista On Fri, Apr 8, 2011 at 4:18 PM, Santosh santosh2...@gmail.com wrote: Dear Rxperts! A simple example where write.csv does not seem to accept user specified arguments.. Why?

[R] Runing perl script from R

2011-04-08 Thread Rice, Terri
Hi. I am trying to run perl script from R. Here's what happens. setwd(C:\\Terri\\perl) getwd() [1] C:/Terri/perl list.files() [1] hello.pl lines1_10.txt try_my.pl try_my.txt system(hello.pl) Warning message: In system(hello.pl) : Impossible to run C:\Terri\perl\hello.pl Does anyone

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

2011-04-08 Thread Rita Carreira
Dear R users, I am using package mice and I am getting the error Error in if (meth[j] != ) { : argument is of length zero. I have tried using several different versions of R (even the one that will be coming out this month) to no avail. I am using RStudio as my interface with R. Also note that

Re: [R] a bug in write.csv?

2011-04-08 Thread John Kane
I believe write.csv had been revamped and some options are no longer available. --- On Fri, 4/8/11, Santosh santosh2...@gmail.com wrote: From: Santosh santosh2...@gmail.com Subject: [R] a bug in write.csv? To: r-help r-help@r-project.org Received: Friday, April 8, 2011, 4:18 PM Dear

  1   2   >