[R] Using optim function for logistic model simulation

2010-04-26 Thread Charlotte Chang
Hello! I'm a college undergrad desperately trying to finish up my thesis. I have a dataset on the distribution of a grassland bird from the Breeding Bird Survey. I have a very straightforward and simple version of the logistic growth model to describe changes in this bird's abundance over time.

Re: [R] function pointer question

2010-04-26 Thread Jan van der Laan
Giovanni, You can use the '...' for that, as in: loocv - function(data, fnc, ...) { n - length(data.x) score - 0 for (i in 1:n) { x_i - data.x[-i] y_i - data.y[-i] yhat - fnc(x=x_i,y=y_i, ...) score - score + (y_i - yhat)^2 } score - score/n return(score) } scoreks -

Re: [R] Upgrading R using the global library folder strategy - what do you think about it?

2010-04-26 Thread Tal Galili
Hi Daniel, Thanks for taking the time to go through this. You wrote: I don't see the advantage over using the R_LIBS environment variable You are correct - there is no advantage *over *doing that, because that is * exactly* what my code is doing :) You wrote: You need to initially copy

Re: [R] function pointer question

2010-04-26 Thread Giovanni Azua
Hello Jan, On Apr 26, 2010, at 8:56 AM, Jan van der Laan wrote: You can use the '...' for that, as in: loocv - function(data, fnc, ...) { n - length(data.x) score - 0 for (i in 1:n) { x_i - data.x[-i] y_i - data.y[-i] yhat - fnc(x=x_i,y=y_i, ...) score - score + (y_i - yhat)^2

[R] Just about approximate F-test

2010-04-26 Thread 1...@agri521
Hi, Dear R community, These is a paper of Wheat Grain Yield Response to N Application Evaluated through Canopy Reflectance. This paper of Materials and Methods said A single regression equation relating A and B was derived for each location using PROC NLIN (SAS Inst. 1990). Slopes and intercepts

[R] Error in pf(q, df1, df2, lower.tail, log.p) : Non-numeric argument to mathematical function

2010-04-26 Thread newbie_2010
inputfille snpid indid genotypegvariable probeid genegeneexpression rs1040480 CHB_NA18524 C/T 2 GI_19743926-I PTPRT 5.850586 rs1040480 CHB_NA18526 C/C 1 GI_19743926-I PTPRT 6.028641 rs1040480 CHB_NA18529 C/C 3

[R] Odp: Tapply.

2010-04-26 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 26.04.2010 06:52:55: Having some difficulties with understanding how tapply works and getting return values I expect Data: dataframe. DF DF$Id $D $Year... Id D Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov

Re: [R] Tapply.

2010-04-26 Thread steven mosher
I've tried both mean and colMean. I did success with one attempt using mean, however if only have 1 year and its a NA then I get NaN ( which I can replace). I'll keep trying. On Mon, Apr 26, 2010 at 12:26 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal

Re: [R] Using optim function for logistic model simulation

2010-04-26 Thread Tal Galili
Hi Charlotte , I can't reproduce your code, but skimming through it - It would appear that: 1) in eqn1- function(K1, bird) you didn't define bird (you did define it before the function, so I'd suggest just removing it from the function call like this: eqn1- function(K1) 2) you didn't return and

Re: [R] Using optim function for logistic model simulation

2010-04-26 Thread Tal Galili
mm... I also noticed the function you wrote didn't use parenthesis, mixed b and c and used different names for K. Your code is a great exercise in debugging (no offense intended :) ) Try using: bird-bird.density[0] # I assume this exists eqn- function(K1, b1 = 1.22, c1 = .55) {

Re: [R] PDF text to work with maps.

2010-04-26 Thread Tal Galili
Have a look here: http://www.r-bloggers.com/a-free-book-on-geostatistical-mapping-with-r/ http://www.r-bloggers.com/a-free-book-on-geostatistical-mapping-with-r/ Contact Details:--- Contact me: tal.gal...@gmail.com |

Re: [R] Tapply.

2010-04-26 Thread steven mosher
That fails: The manual says: tapply(X, INDEX, FUN = NULL, ..., simplify = TRUE) ArgumentsXan atomic object, typically a vector.INDEXlist of factors, each of same length as X. The elements are coerced to factors by as.factorhttp://127.0.0.1:31214/library/base/help/as.factor . my error says:

Re: [R] Using optim function for logistic model simulation

2010-04-26 Thread Charlotte Chang
Great! Thank you for your help! -Charlotte On Mon, Apr 26, 2010 at 1:12 AM, Tal Galili tal.gal...@gmail.com wrote: mm... I also noticed the function you wrote didn't use parenthesis, mixed b and c and used different names for K. Your code is a great exercise in debugging  (no offense

Re: [R] Library (tm) Error: could not find function TermDocMatrix.

2010-04-26 Thread Ignacio mas data
Hi Peter Thanks. This was my problem I saw this term in the next document http://cran.r-project.org/doc/Rnews/Rnews_2008-2.pdf Best regards -- View this message in context: http://r.789695.n4.nabble.com/Library-tm-Error-could-not-find-function-TermDocMatrix-tp2062464p2064843.html Sent from

Re: [R] Tapply.

2010-04-26 Thread Dennis Murphy
Hi: Use of ddply() in the plyr package appears to work. library(plyr) ddply(df[, -1], .(Year), colwise(mean), na.rm = TRUE) D Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 1 1.00 1980 NaN NaN NaN NaN NaN 212 203 209 228 237 NaN NaN 2 0.50 1981 NaN 251 243 246 241 NaN NaN

Re: [R] Tapply.

2010-04-26 Thread Petr PIKAL
Hi steven mosher mosherste...@gmail.com napsal dne 26.04.2010 10:21:37: That fails: The manual says: tapply(X, INDEX, FUN = NULL, ..., simplify = TRUE) Arguments X an atomic object, typically a vector. INDEX list of factors, each of same length as X. The elements are

[R] New rwiki page for large scale data

2010-04-26 Thread kMan
Dear list, There is a new rwiki (http://rwiki.sciviews.org) section for 'large scale data' at http://rwiki.sciviews.org/doku.php?id=large_scale_data. This is a massive topic of interest to many. I could use some help filling in the content so that this can develop into a powerful resource for the

[R] plot dates

2010-04-26 Thread karine heerah
hi everybody, How can you plot some dates? I mean how can i have the tickmarks with the label of each date on my x axis? The dates i use are in POSIXct format, i don't know if it matters. thanks a lot Karine

[R] Interpreting output of coxph with frailty.gamma

2010-04-26 Thread Michael Haenlein
Dear all, this is probably a very silly question, but could anyone tell me what the different parameters in a coxph model with a frailty.gamma term mean? Specifically I have two questions: (1) Compared to a normal coxph model, it seems that I obtain two standard errors [se(coef) and se2]. What

Re: [R] plot dates

2010-04-26 Thread Jim Lemon
On 04/26/2010 08:05 PM, karine heerah wrote: hi everybody, How can you plot some dates? I mean how can i have the tickmarks with the label of each date on my x axis? The dates i use are in POSIXct format, i don't know if it matters. Hi Karine, Here's one way: plot(1:3,xaxt=n)

Re: [R] plot dates

2010-04-26 Thread Duncan Murdoch
On 26/04/2010 6:05 AM, karine heerah wrote: hi everybody, How can you plot some dates? I mean how can i have the tickmarks with the label of each date on my x axis? The dates i use are in POSIXct format, i don't know if it matters. If your x variable is a POSIXct variable, it

Re: [R] Error in pf(q, df1, df2, lower.tail, log.p) : Non-numeric argument to mathematical function

2010-04-26 Thread Joris Meys
Did you check what comes out x$fstatistic[1L] etc... ? Seems to me at least one of those is not a number. Please give ready-to-use code, nobody here will transform your mail to a text file, try to read it in and so on. Also specify which package you use, lmList is not a standard function in R and

[R] How to make legend with line+ character

2010-04-26 Thread Mario Valle
Dear all, I have a multiline plot with each line labeled with a different letter. But I'm not able to make the legend display the same kind of pattern '-a-', instead the letter is overwritten by the line. A simpler legend with only the letter is not very visible and the pt.bg does nothing with

Re: [R] Noobie question on aggregate tapply and by

2010-04-26 Thread Henrique Dallazuanna
Try this: aggregate(DF[c('data', 'data2')], DF[ 'years'], FUN = sum, na.rm = TRUE) aggregate(DF[c('data', 'data2')], list(as.character(factor(DF[, 'years'], labels = c('5-7', '5-7', '5-7', 8, FUN = sum, na.rm = TRUE) On Sun, Apr 25, 2010 at 3:29 AM, steven mosher mosherste...@gmail.comwrote:

[R] CRAN master, R-Forge, R-Project websites down

2010-04-26 Thread Stefan Peter Theußl
Dear R users and developers, Due to a failure of the electrical system, the IT services (also hosting R-project related websites) of the WU (Vienna University of Economics and Business) are currently unavailable. Affected websites and services are: CRAN master (cran.r-project.org), the

Re: [R] Tinn-R

2010-04-26 Thread Joris Meys
Please check the installation guide for Tinn-R. It might be you simply forgot to configure Tinn-R (RConfigurepermanent). I use it for 2 years now, and find it a blessing. Mind that there is a problem sometimes with the connection between Tinn-R and R, and the problem is Windows-related. If you

Re: [R] boosting with decision tree

2010-04-26 Thread Max Kuhn
Google goes a long way... I would start here http://www-stat.stanford.edu/~tibs/ElemStatLearn/ On Apr 26, 2010, at 12:44 AM, Changbin Du changb...@gmail.com wrote: Hi, Dear R community, Does anyone know how to constructdecision tree with boosting? Is any tutorial I can read? --

Re: [R] How to make legend with line+ character

2010-04-26 Thread Uwe Ligges
On 26.04.2010 13:32, Mario Valle wrote: Dear all, I have a multiline plot with each line labeled with a different letter. But I'm not able to make the legend display the same kind of pattern '-a-', instead the letter is overwritten by the line. A simpler legend with only the letter is not very

Re: [R] How to make legend with line+ character

2010-04-26 Thread Henrique Dallazuanna
You can try this: plot(1:10,10:1,lty=1,type='b', lwd=2,pch='a') text(2, pretty(10:1)[2] - 0.3, paste(\u2013 a \u2013, ds1, sep =), col = 'black', font = 2) text(2, pretty(10:1)[2] - 0.6, paste(\u2013 b \u2013, ds2, sep =), col = 'red', font = 2) rect(0, 0, 3, 2) On Mon, Apr 26, 2010 at

Re: [R] How to make legend with line+ character

2010-04-26 Thread Mario Valle
Thanks Uwe and Henrique! Both solution works and both have the same niceness/work.required ratio :-) Thanks again! mario On 26-Apr-10 14:02, Uwe Ligges wrote: On 26.04.2010 13:32, Mario Valle wrote: Dear all, I have a multiline plot with each line labeled with a

Re: [R] How to make legend with line+ character

2010-04-26 Thread Gabor Grothendieck
Try this kludge: legend(left, c(-a-, -b-, ds1 , ds2 ), ncol = 2, text.col = 1:2) On Mon, Apr 26, 2010 at 7:32 AM, Mario Valle mva...@cscs.ch wrote: Dear all, I have a multiline plot with each line labeled with a different letter. But I'm not able to make the legend display the same kind of

[R] Permutation tests using apply function with package coin

2010-04-26 Thread Bryan Keller
I am using apply to run exact permutation t-tests by columns using the coin package. For example: library(coin) dat - matrix(rnorm(7*35),7,35) fun - function(x) { pvalue( independence_test(x~f, data=data.frame(x, f=factor(c(rep(a,4),rep(b,3,

[R] Cluster analysis: dissimilar results between R and SPSS

2010-04-26 Thread Jeoffrey Gaspard
Hello everyone! My data is composed of 277 individuals measured on 8 binary variables (1=yes, 2=no). I did two similar cluster analyses, one on SPSS 18.0 and one on R 2.9.2. The objective is to have the means for each variable per retained cluster. 1) the R analysis ran as followed: call

Re: [R] Unexpected warnings from summary() on mcmc.list objects

2010-04-26 Thread Uwe Ligges
Please specify reproducible code that show the problem. When I do it, ewverything is fine on my data with the most recently released versions of R, R2WinBUGS and coda. But perhaps you have another package loaded with another summary.mcmc.list method? On 26.04.2010 06:31, Chris Fonnesbeck

Re: [R] CRAN master, R-Forge, R-Project websites down

2010-04-26 Thread Peter Dalgaard
(Resending, forgot to cc. r-help) On Apr 26, 2010, at 1:47 PM, Stefan Peter Theußl wrote: Dear R users and developers, Due to a failure of the electrical system, the IT services (also hosting R-project related websites) of the WU (Vienna University of Economics and Business) are

Re: [R] Cluster analysis: dissimilar results between R and SPSS

2010-04-26 Thread Tal Galili
Hi Jeoffrey, How stable are the results in general ? If you repeat the analysis in R several times, does it yield the same results ? Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

Re: [R] Cluster analysis: dissimilar results between R and SPSS

2010-04-26 Thread Sarah Goslee
I'm not sure why you'd expect Euclidean distance and squared Euclidean distance to give the same results. Euclidean distance is the square root of the sums of squared differences for each variable, and that's exactly what dist() returns. http://en.wikipedia.org/wiki/Euclidean_distance On a map,

[R] How use lapply over one column in a dataframe?

2010-04-26 Thread Robert Nicholson
So I have Transactions as a dataframe and Transactions$Symbol is a column in the frame I simply want to run sub over all elements in that column where the new value replaces the old value this doesn't seem to work Transactions$Symbol = lapply(Transactions$Symbol, function(x) sub('[

Re: [R] How use lapply over one column in a dataframe?

2010-04-26 Thread Henrique Dallazuanna
Try this: Transactions$Symbol - gsub('[ -]*','INST',Transactions$Symbol) On Mon, Apr 26, 2010 at 10:14 AM, Robert Nicholson robert.nichol...@gmail.com wrote: So I have Transactions as a dataframe and Transactions$Symbol is a column in the frame I simply want to run sub over all elements

Re: [R] How use lapply over one column in a dataframe?

2010-04-26 Thread Robert Nicholson
Yeah I finally got there thanks. On Apr 26, 2010, at 8:22 AM, Henrique Dallazuanna wrote: Try this: Transactions$Symbol - gsub('[ -]*','INST',Transactions$Symbol) On Mon, Apr 26, 2010 at 10:14 AM, Robert Nicholson robert.nichol...@gmail.com wrote: So I have Transactions as a

Re: [R] logical(0) response from lrm

2010-04-26 Thread David Winsemius
On Apr 26, 2010, at 12:55 AM, Rob James wrote: What causes the error report: logical(0) to arise in the rms function lrm? Here's my data: But both the dependent and the independent variable seem fine... str(AABB) 'data.frame':1176425 obs. of 9 variables: $ sex : int 1 1 0 1 1 0

Re: [R] Unexpected warnings from summary() on mcmc.list objects

2010-04-26 Thread Ben Bolker
Chris Fonnesbeck fonnesbeck at gmail.com writes: I am trying to get summary statistics from WinBUGS/JAGS output in the form of mcmc.list objects, using the summary() function. However, I get odd warning messages: Warning messages: 1: In glm.fit(x = X, y = Y, weights = weights, start =

[R] Update: working mirrors and services due to IT failure at WU

2010-04-26 Thread Stefan Peter Theußl
Dear R community, The only working mirror under a separate subdomain in the zone r-project.org is cran.us.r-project.org. Some mirrors are just virtualhosts on the master server and thus cannot be resolved via DNS. These are: cran.au.r-project.org cran.br.r-project.org cran.ca.r-project.org

Re: [R] Upgrading R using the global library folder strategy -, what do you think about it?

2010-04-26 Thread Marshall Feldman
On 4/25/2010 19:39:52, Tal Galili wrote: *c) R core implementation ?!* I hope I am not being rude (or jumping into any open doors) in asking this but... What do you think about implementing this strategy into the R basic installation? Tal, As a general rule, I think R should make

[R] Simple Slots Question

2010-04-26 Thread Andrew Hill
Question: How do I isolate the p-value from the serial.test function (portmanteau test)? Details: I tried the following set of commands testResult - serial.test(vec2varModelFit) thePValue - testResult$p.value When i type 1) thePValue I get: NULL 2) testResult I get Portmanteau Test

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Robin Jeffries
I do get the following error message: *Error in lookup.svc[i, j] - svc[svc$st == unique(svc$st)[i] svc$vc == : * * replacement has length zero* I also thought it might be because of how R treats NA, but then I would expect the loop to stop at the place of error (i=1, j=2) and not continue to

Re: [R] Simple Slots Question

2010-04-26 Thread Henrique Dallazuanna
Try this: testResult$serial$p.value On Mon, Apr 26, 2010 at 11:17 AM, Andrew Hill andy.bob.h...@gmail.comwrote: Question: How do I isolate the p-value from the serial.test function (portmanteau test)? Details: I tried the following set of commands testResult -

[R] number of rules

2010-04-26 Thread fascob
Hello, I have JRip(Species ~ ., data = iris) JRIP rules: === (Sepal.Width = 2.9) and (Petal.Width = 1.6) = Species=versicolor (39.0/5.0) (Petal.Length = 4.1) and (Petal.Width = 1.7) = Species=versicolor (17.0/2.0) (Petal.Length = 4.8) = Species=virginica (46.0/1.0) = Species=setosa

[R] Sweave: centering with echo=TRUE

2010-04-26 Thread David.Epstein
In a .Rnw file I want to insert the R command pairs(mydataframe) and achieve the following effects 1. the command itseld is echoed into the tex document generated by Sweave fig=TRUE,echo=TRUE= 2. The graphics generated appears in the tex document, with the graphics centred. 3. The R command

[R] help on autocorrealtion time

2010-04-26 Thread netrunner
Hi, I would like to compute the autocorrelation time from my 2-D time series, but I cannot find how to do using R. I have found the fucntion acf and acf plot, but how can find the autocorrelation time? thanks -- View this message in context:

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Henrique Dallazuanna
Try this; xtabs(y ~ st + vc, data = x) On Mon, Apr 26, 2010 at 11:35 AM, Robin Jeffries rjeffr...@ucla.edu wrote: I do get the following error message: *Error in lookup.svc[i, j] - svc[svc$st == unique(svc$st)[i] svc$vc == : * * replacement has length zero* I also thought it might

[R] seed

2010-04-26 Thread Jimmy Söderly
Hi everybody, How can I set the seed for my simulations ? Is set.seed(123456) alright ? Thanks a lot, Jimmy [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread jim holtman
This should get you close: x - read.table(textConnection(st vc y + A Z .2 + B Z .4 + B Y .3 + C Y .1 + C X .8), header=TRUE) closeAllConnections() x st vc y 1 A Z 0.2 2 B Z 0.4 3 B Y 0.3 4 C Y 0.1 5 C X 0.8 x.1 - melt(x) Using st, vc as id variables x.1

Re: [R] seed

2010-04-26 Thread Steve Lianoglou
Hi, On Mon, Apr 26, 2010 at 10:45 AM, Jimmy Söderly jimmy.sode...@gmail.com wrote: Hi everybody, How can I set the seed for my simulations ? Is set.seed(123456) alright ? Hmm ... R set.seed(123456) R rnorm(5) [1] 0.83373317 -0.27604777 -0.35500184 0.08748742 2.25225573 R rnorm(5) [1]

Re: [R] Obvious reason for not looping twice?

2010-04-26 Thread Robin Jeffries
Seriously! That easy! I kept thinking that xtab would just give me frequencies of how many times the combination occurred, and not the values themselves. Thanks! -Robin On Mon, Apr 26, 2010 at 7:40 AM, Henrique Dallazuanna www...@gmail.comwrote: Try this; xtabs(y ~ st + vc, data = x)

Re: [R] number of rules

2010-04-26 Thread Gabor Grothendieck
Here is a kludge: fm - JRip(Species ~., iris) as.numeric(sub(.*:, , grep(Number of Rules, capture.output(fm), value = TRUE))) [1] 4 On Mon, Apr 26, 2010 at 7:23 AM, fascob samto...@yahoo.com wrote: Hello, I have JRip(Species ~ ., data = iris) JRIP rules: === (Sepal.Width =

Re: [R] Tapply.

2010-04-26 Thread steven mosher
Thanks, I was trying to stick with the base package and figure out how the base routines worked. I looked at plyer and it was very appealing. I guess i'll give in and use it On Mon, Apr 26, 2010 at 2:33 AM, Dennis Murphy djmu...@gmail.com wrote: Hi: Use of ddply() in the plyr package

Re: [R] Tapply.

2010-04-26 Thread steven mosher
I guess my problem was seeing a bunch of examples where they pulled a variable from a dataframe.. tapply(df$data, index=list(.. and I assumed that the df$data was just generalizable to a collection of vectors a vector of vector being a vector Thanks. On Mon, Apr 26, 2010 at 2:43 AM, Petr

Re: [R] seed

2010-04-26 Thread Jimmy Söderly
Thanks Steve, it seems to work ! 2010/4/26 Steve Lianoglou mailinglist.honey...@gmail.com Hi, On Mon, Apr 26, 2010 at 10:45 AM, Jimmy Söderly jimmy.sode...@gmail.com wrote: Hi everybody, How can I set the seed for my simulations ? Is set.seed(123456) alright ? Hmm ... R

[R] data frame

2010-04-26 Thread n.via...@libero.it
Dear list, I have a big data frame which looks like this: variable YEAR VAR EC01 2006 100 EC01 2007 200 EC02 2006

[R] concise syntax for selecting multiple rows

2010-04-26 Thread John Sorkin
I would like to select rows if a row contains any one of several values. I can do the selection as follows: result[,Subject]==JEFF | result[,Subject]==BG But this is very unwieldily if one wishes to select many, many rows as one has to continuously repeat the source: result[,Subject]==JEFF |

Re: [R] help on autocorrealtion time

2010-04-26 Thread Tal Galili
Do you mean ccf ? 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] concise syntax for selecting multiple rows

2010-04-26 Thread David Winsemius
On Apr 26, 2010, at 11:12 AM, John Sorkin wrote: I would like to select rows if a row contains any one of several values. I can do the selection as follows: result[,Subject]==JEFF | result[,Subject]==BG But this is very unwieldily if one wishes to select many, many rows as one has to

Re: [R] concise syntax for selecting multiple rows

2010-04-26 Thread Marc Schwartz
On Apr 26, 2010, at 10:12 AM, John Sorkin wrote: I would like to select rows if a row contains any one of several values. I can do the selection as follows: result[,Subject]==JEFF | result[,Subject]==BG But this is very unwieldily if one wishes to select many, many rows as one has to

Re: [R] concise syntax for selecting multiple rows

2010-04-26 Thread Erik Iverson
See ?%in% result$Subject %in% c(JEFF, BG) John Sorkin wrote: I would like to select rows if a row contains any one of several values. I can do the selection as follows: result[,Subject]==JEFF | result[,Subject]==BG But this is very unwieldily if one wishes to select many, many rows as one

[R] I can't with expression

2010-04-26 Thread salcaraz
Hi all, I need an R expression, expression() to get the follows Latex code: $P^\uparrow_{SF}$. Imposible, for me!!. Thank you in advance /salva __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] concise syntax for selecting multiple rows

2010-04-26 Thread Gabor Grothendieck
Here are four ways: # state.name comes with R DF - data.frame(state = state.name, num = seq_along(state.name)) DF[DF$state %in% c(Iowa, Utah),] subset(DF, state %in% c(Iowa, Utah)) subset(DF, grepl(Iowa|Utah, state)) library(sqldf) # see http://sqldf.googlecode.com sqldf(select * from DF

Re: [R] concise syntax for selecting multiple rows

2010-04-26 Thread David Winsemius
On Apr 26, 2010, at 11:27 AM, Gabor Grothendieck wrote: Here are four ways: # state.name comes with R DF - data.frame(state = state.name, num = seq_along(state.name)) DF[DF$state %in% c(Iowa, Utah),] subset(DF, state %in% c(Iowa, Utah)) subset(DF, grepl(Iowa|Utah, state)) John; The

[R] Rmpi installation problems on slave nodes

2010-04-26 Thread Paul Geeleher
Hi guys, I'm trying to install Rmpi on the slave nodes of my cluster. The installation seems to work with no errors or warnings using this command: R CMD INSTALL --configure-args=--with-Rmpi-include=/usr/lib64/openmpi/1.3.2-gcc/include --with-Rmpi-libpath=/usr/lib64/openmpi/1.3.2-gcc/lib

[R] Finding First of a Type in a Sequence

2010-04-26 Thread Su Chu
Hi there, I am working on a project that requires me to find the point at which values become negative in a sequence about the max. For example, say I have some sequence: x=c(-12, -2,-19, 0, -14, -2, 9,10,20,35,56,89,60,39,12,8,-5,-2,0,10) In this sequence, the max is 89, and I need to

[R] R.GBM package

2010-04-26 Thread Changbin Du
HI, Dear Greg, I AM A NEW to GBM package. Can boosting decision tree be implemented in 'gbm' package? Or 'gbm' can only be used for regression? IF can, DO I need to combine the rpart and gbm command? Thanks so much! -- Sincerely, Changbin -- [[alternative HTML version deleted]]

Re: [R] Finding First of a Type in a Sequence

2010-04-26 Thread Tal Galili
Try this: func - function(x) { which.negative - which(x0) index.to.return - which.negative[which.negative which.max(x)][1] return(index.to.return) } func(x) Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com |

Re: [R] Finding First of a Type in a Sequence

2010-04-26 Thread David Winsemius
On Apr 26, 2010, at 12:29 PM, Su Chu wrote: Hi there, I am working on a project that requires me to find the point at which values become negative in a sequence about the max. For example, say I have some sequence: x=c(-12, -2,-19, 0, -14, -2, 9,10,20,35,56,89,60,39,12,8,-5,-2,0,10)

[R] Sweave

2010-04-26 Thread Jimmy Söderly
Hi everybody, I wanted to use Sweave but I do not have the Latex package: LaTeX Error: File 'Sweave.sty' not found. I cannot find it with MiKTeX :-( Can somebody help me ? Thanks a lot, Jimmy [[alternative HTML version deleted]] __

[R] problems accessing MS Access 2003 database with RODBC

2010-04-26 Thread Boris.Vasiliev
Dear users, I am trying to access a Microsoft Access database from R using RODBC package but I have had little success. The setup works with isql, RODBC seems to connect to the database, but RODBC does not recognize the data in the database. Can anybody advise where I am going wrong? I am

Re: [R] Sweave

2010-04-26 Thread Doran, Harold
If you have the package you have this file. Maybe check FAQ A.12 http://www.stat.uni-muenchen.de/~leisch/Sweave/FAQ.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jimmy Söderly Sent: Monday, April 26, 2010 1:10 PM To:

Re: [R] Sweave

2010-04-26 Thread Sarah Goslee
You'll find that this is a very common question, and 30 seconds with google will get you many nice explanations and solutions. The quickest is to copy Sweave.sty from the package directory to your working directory. Sarah On Mon, Apr 26, 2010 at 1:10 PM, Jimmy Söderly jimmy.sode...@gmail.com

[R] Help with replacement of certain values in dataset with SAS code equivalent

2010-04-26 Thread Randy Cass
I am new to R and have tried for a good while to figure out how to code this in R. The dataset below: FTIStandKey State County FTITract CoverType Ver_CT V_Origin V_SpGrp NAH6005-001 Texas Jasper NAH6005 PPLB-2000-U PPLB-2000-U P P NAH6005-002 Texas

Re: [R] data frame

2010-04-26 Thread Henrique Dallazuanna
Try this: sweep(with(x, tapply(VAR, list(variable, YEAR), FUN = prod)), 2, with(x, tapply(VAR, YEAR, FUN = prod)), FUN = /) On Mon, Apr 26, 2010 at 12:07 PM, n.via...@libero.it n.via...@libero.itwrote: Dear list, I have a big data frame which looks like this: variable YEAR

Re: [R] Sweave

2010-04-26 Thread Gabor Grothendieck
Its at this path (this command is issued from within R): file.path(R.home(), share, textmf, Sweave.sty) You can add it to your MiKTeX installation or just put it in the same directory as your Rnw file. On Mon, Apr 26, 2010 at 1:10 PM, Jimmy Söderly jimmy.sode...@gmail.com wrote: Hi

Re: [R] R.GBM package

2010-04-26 Thread Changbin Du
Thanks so much, Greg! On the demo(bernoulli), I FOUND the following information: IT is used for logistic regression. My question is: when I define a decision tree, can I still use the formula Y~X1+X2+X3,# formula, even though I dont know the detailed formula of decision tree.

Re: [R] Sweave

2010-04-26 Thread Gabor Grothendieck
Sorry, typo. Try this: file.path(R.home(), share, texmf, Sweave.sty) On Mon, Apr 26, 2010 at 1:18 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Its at this path (this command is issued from within R):   file.path(R.home(), share, textmf, Sweave.sty) You can add it to your MiKTeX

[R] mvpart : Printing response values at terminal nodes

2010-04-26 Thread S, Manjunath (GE, Research)
I have created a multivariate regression tree using mvpart, with 3-4 responses. Though the plot shows bargraphs for each response, I would like to have the VALUES of the responses printed or indicated (via a scale or something) alongside the bargraph. Is this possible ?? Thanks, Manjunath

[R] help with code

2010-04-26 Thread Randy Cass
I am new to R and have tried for a good while to figure out how to code this in R. The dataset below: FTIStandKey State County FTITract CoverType Ver_CT V_Origin V_SpGrp NAH6005-001 Texas Jasper NAH6005 PPLB-2000-U PPLB-2000-U P P NAH6005-002 Texas

Re: [R] data frame

2010-04-26 Thread Tal Galili
you can do this: a - tapply(VAR, YEAR, prod) The use merge to create a new variable of the length of your original VAR, and just do VAR/prod.VAR Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

Re: [R] problems accessing MS Access 2003 database with RODBC

2010-04-26 Thread Marc Schwartz
On Apr 26, 2010, at 12:11 PM, boris.vasil...@forces.gc.ca wrote: Dear users, I am trying to access a Microsoft Access database from R using RODBC package but I have had little success. The setup works with isql, RODBC seems to connect to the database, but RODBC does not recognize the

Re: [R] data frame

2010-04-26 Thread jim holtman
Is this what you want: x - read.table(textConnection(variable YEAR VAR + EC01 2006 100 + + EC01 2007 200 + + EC02 2006 500

Re: [R] R.GBM package

2010-04-26 Thread Ridgeway, Greg
GBM implements boosted trees. It works for 0/1 outcomes, count outcomes, continuous outcomes and a few others. You do not need to combine rpart and gbm. You're best bet is to just load the package and run a demo demo(bernoulli). From: Changbin Du

Re: [R] Sweave: centering with echo=TRUE

2010-04-26 Thread Duncan Murdoch
On 26/04/2010 7:07 AM, David.Epstein wrote: In a .Rnw file I want to insert the R command pairs(mydataframe) and achieve the following effects 1. the command itseld is echoed into the tex document generated by Sweave fig=TRUE,echo=TRUE= 2. The graphics generated appears in the tex document,

Re: [R] problems accessing MS Access 2003 database with RODBC

2010-04-26 Thread Marc Schwartz
On Apr 26, 2010, at 12:40 PM, Marc Schwartz wrote: On Apr 26, 2010, at 12:11 PM, boris.vasil...@forces.gc.ca wrote: Dear users, I am trying to access a Microsoft Access database from R using RODBC package but I have had little success. The setup works with isql, RODBC seems to

[R] Why am I getting different results from cor VS ccf ?

2010-04-26 Thread Tal Galili
Hi all, I am getting different results from ccf and cor, Here is a simple example: set.seed(100) N - 100 x1 - sample(N) x2 - x1 + rnorm(N,0,5) ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1] cor(x1[-N], x2[-1]) Results: ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1] [1] -0.128027 cor(x1[-N], x2[-1]) [1]

Re: [R] Sweave

2010-04-26 Thread Jimmy Söderly
Thanks !!! 2010/4/26 Gabor Grothendieck ggrothendi...@gmail.com Sorry, typo. Try this: file.path(R.home(), share, texmf, Sweave.sty) On Mon, Apr 26, 2010 at 1:18 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Its at this path (this command is issued from within R):

Re: [R] Help with replacement of certain values in dataset with SAS code equivalent

2010-04-26 Thread Erik Iverson
What I want to do is to be able to select certain FTIStandKey's and change values in the dataset. For example, I would like to select by FTIStandKey==NAH6253-003, and change the entries for CoverType= XSOP--C and change the V_SpGrp==T, and also change V_Origin==T. I only want to change

Re: [R] help with code

2010-04-26 Thread Sarah Goslee
Hi Randy, The SAS code for what I want to do is: /*  if FTIStandKey= NAH6253-003 then do;   CoverType= XSOP--C ;   V_SpGrp=T;   V_Origin=T;  end; I admit I didn't read all the sample code you added, but this is what I *think* you're trying to accomplish.

[R] RServe across network

2010-04-26 Thread Nupur Gupta
Hi, I am trying to connect to RServe across a network. I had put RServe on my local machine and it worked just fine. When am try to connect to it across a network - it is able to go through the handshake and get in. However , when it gets to the 'request' method in the RTalk class, it hangs. Any

Re: [R] Why am I getting different results from cor VS ccf ?

2010-04-26 Thread Tal Galili
The dear mark leeds markle...@verizon.net Has pointed me that the answer to my question was in the MASS book, in page 390 Where it is said that acf works by dividing the covariance with N instead of N-t so to insure that the covariance sequence is positive definite. Although I am not sure if to

Re: [R] How do you change library location ? (in R under windows XP)

2010-04-26 Thread Mike Prager
On Fri, 23 Apr 2010 15:22:45 +0300, Tal Galili tal.gal...@gmail.com wrote: Due to the new R 2.11 release, I want to implement Dirk's suggestion herehttp://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r . So for that I am asking - How can I (permanently) change R's

Re: [R] R and S-Plus: Two programs separated by a common language?

2010-04-26 Thread Mike Prager
On Thu, 22 Apr 2010 12:00:13 -0700 (PDT), Paul Miller pjmiller...@yahoo.com wrote: I was just wondering if anyone could give me some advice about the wisdom or folly of trying to use both [R and S-Plus]. I suspect that trying to use both will give you heartburn. When I switched from S-Plus to

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-26 Thread Jonathan
Hi Dennis, Thanks for the idea, but the order of the rowSums does not necessarily correspond to the order of rows that maximizes the rank of the matrix. Ex: a[1:9]-c(1,1,30,50,1,1,1,20,1) a [,1] [,2] [,3] [1,]1 501 [2,]11 20 [3,] 3011

Re: [R] Upgrading R using the global library folder strategy - what do you think about it?

2010-04-26 Thread Mike Prager
I think it makes more sense for most users to have a global library (as you call it), rather than put the library under the current installation. I have been doing that for years, and it saves a lot of trouble. When I have helped people learn R, the need to copy the library when updating is a

  1   2   >