Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-05 Thread Patrick Burns
There is a crude implementation of stacks in 'S Poetry' (available on www.burns-stat.com). I haven't looked at it, but I'd guess that code would work in R as well. On 04/01/2012 21:22, Tom Roche wrote: summary: Specifically, how does one do stack/FIFO operations in R? Generally, how does one

[R] ssanova/ ssanova0 and adding the fitted line to a plot.

2012-01-05 Thread ali_protocol
Hi everyone, I use this code to add the fitted line to a plot, however, I think I cannot access the fitted equation. How my I find the equation in the object ksi? thanks alot. library (gss) generate (simple linear) x and y x= 2* (1:40) y= x-1 plot (x,y) ## fit and draw ksi = ssanova0 (x~y,

Re: [R] Joint modelling of survival data

2012-01-05 Thread ryusuke
Hi Dr Terry, Thank you for your reply. Step(1) - Lets assume Generalized Poisson model (GLM) as basic model where constant hazards ratio as time goes by. Below are two correlated GLM. X_ij = Poisson( lambda_1 = \gamma * \alpha_i * \delta_j ) Y_ij = Poisson( lambda_2 =

Re: [R] difference of the multinomial logistic regression results between multinom() function in R and SPSS

2012-01-05 Thread peter dalgaard
On Jan 5, 2012, at 02:10 , Yoo Jinho wrote: Dear all, I have found some difference of the results between multinom() function in R and multinomial logistic regression in SPSS software. The input data, model and parameters are below: choles - c(94, 158, 133, 164, 162, 182, 140, 157,

Re: [R] a quick question about rbinom

2012-01-05 Thread David Winsemius
On Jan 5, 2012, at 12:56 AM, Bert Gunter wrote: David! ... It means the author either doesn't know the 'sample' function, or wants you to understand how to use 'rbinom', or that's just the way she thinks. Could someone help? Thanks so much, X1-c(A,B)[rbinom(n,1,0.6)+1]

Re: [R] subscript with comma

2012-01-05 Thread suse
David Winsemius wrote The insight that allowed me to get a significantly higher frequency of success was realizing that the correct separators between separate expressions were * and ~ rather than space or comma. Inside an expression a comma will signal a new expression element. A

Re: [R] A problem of meta analysis based on metafor package

2012-01-05 Thread Michael Dewey
At 11:16 04/01/2012, XUT wrote: I would like to make a meta analysis based on metafor package. If I only have the data of RR, 95%CI of every study, could I finish the meta analysis? Yes, of course. Any good book on meta-analysis should help you here, Hint, how do you think the 95%CI was

Re: [R] clear plot linear mixed model

2012-01-05 Thread ken knoblauch
Christof Kluß ckluss at email.uni-kiel.de writes: Am 02-01-2012 10:54, schrieb ken knoblauch: Christof Klußcklussat email.uni-kiel.de writes: lme- lme(conc ~ name/time - 1, random=conc~time|nr,method=ML,data=measurements) see plot.augPred in the nlme package thx, but how to set

[R] Bayesian estimate of prevalence with an imperfect test

2012-01-05 Thread LianD
Hi all! I'm new to this forum so please excuse me if I don't conform perfectly to the protocols on this board! I'm trying to get an estimate of true prevalence based upon results from an imperfect test. I have various estimates of se/sp which could inform my priors (at least upper and lower

[R] match matrices of different lengths

2012-01-05 Thread Thijs vanden Bergh
was trying to match different matrices of different lengths with in the first collumn date and time info (yearmonthdayhourminute). the routine needs to return NA´s where data of either of the matrices is non existent. have been trying the following: x - c(200112030003, 200112030004,

Re: [R] Bayesian estimate of prevalence with an imperfect test

2012-01-05 Thread Bert Gunter
Lian: I doubt whether anyone on this list would be willing to wade through your code to track this down, although some smart folks may be able to guess what the issue is (alas for you, I am not one of them!). So now is as good a time as any to start learning about R's debugging tools. First, you

[R] selection part of subset

2012-01-05 Thread Christof Kluß
Hi I want to do something like a - c(10,20,15,43,76,41,25,46) tab - data.frame(a) name - a for (v in unique(tab[[name]])) { r - subset(tab, name==v) # this does not work ... } i.e. a string on the left side of the select expression (subset). How could I solve this? thx Christof

Re: [R] selection part of subset

2012-01-05 Thread Christof Kluß
Hi the output should look like r - subset(tab, a==v) but now I have something like r - subset(tab, a==v) and r - subset(tab, [[a]]==v) does not work :( greetings Christof Am 05-01-2012 16:51, schrieb Christof Kluß: Hi I want to do something like a -

Re: [R] selection part of subset

2012-01-05 Thread Sarah Goslee
I don't know how to do it with subset, but this is equivalent for your example: tab[tab[[name]] == v,] Also, you might want to look at ?== and ?identical. Sarah On Thu, Jan 5, 2012 at 11:04 AM, Christof Kluß ckl...@email.uni-kiel.de wrote: Hi the output should look like     r - subset(tab,

Re: [R] selection part of subset

2012-01-05 Thread Milan Bouchet-Valat
Le jeudi 05 janvier 2012 à 16:51 +0100, Christof Kluß a écrit : Hi I want to do something like a - c(10,20,15,43,76,41,25,46) tab - data.frame(a) name - a for (v in unique(tab[[name]])) { r - subset(tab, name==v) # this does not work ... } i.e. a string on the left side

Re: [R] selection part of subset

2012-01-05 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Christof Kluß Sent: Thursday, January 05, 2012 8:04 AM Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] selection part of subset Hi the output should look like r -

Re: [R] selection part of subset

2012-01-05 Thread Marc Schwartz
On Jan 5, 2012, at 10:04 AM, Christof Kluß wrote: Hi the output should look like r - subset(tab, a==v) but now I have something like r - subset(tab, a==v) and r - subset(tab, [[a]]==v) does not work :( greetings Christof Am 05-01-2012 16:51, schrieb

Re: [R] selection part of subset

2012-01-05 Thread peter dalgaard
On Jan 5, 2012, at 17:04 , Christof Kluß wrote: Hi the output should look like r - subset(tab, a==v) but now I have something like r - subset(tab, a==v) and r - subset(tab, [[a]]==v) does not work :( Presumably something with eval, bquote and as.name

Re: [R] match matrices of different lengths

2012-01-05 Thread Justin Haynes
see ?merge merge(xx,aa,by.x='x',by.y='a') x y b 1 2.00112e+11 1.0 1.2 2 2.00112e+11 1.1 1.9 making the two matricies time series does not mean that R knows that the first column is a datetime. and depending on your desired result, that may not be important. hope that helps,

[R] automatic SI prefixes as ticklabels on axis

2012-01-05 Thread Jonas Stein
i want to plot values with frequency on a logarithmic x axis. similar to this example that i found in the web: http://www.usspeaker.com/jensen%20p15n-graph.gif I would like to convert long numbers to si prefix notation like in the example (20 to 200k, 3500 to 3.5 M) Of course i could

[R] ggplot2 - tricky problem

2012-01-05 Thread Mario Giesel
Hello, R friends,  I've been struggling quite a bit with ggplot2. Having worked through Hadleys book twice I still wonder how to solve this task. 1. Short example Dataframe: id    city    Likeability    Uniqueness 1    Berlin    5    3 2    Munich    4    4 3    Berlin    6    4 4    Munich   

[R] wish: enable joining this Mailinglist via Gmane

2012-01-05 Thread Jonas Stein
Hi, if you are not member of this list, you can not post. That is fine so far. This list is mirrored via Gmane as a nntp gateway. It would be great if a new user could subscribe this Mailinglist as gmane.comp.lang.r.general On reply to his first posting he will get a verification mail (same

[R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread Rich Shepard
Please provide a pointer to the source of this problem so I can understand why it occurred. The data frame is: millc.tds.z MC-0.5 MC-1 MC-2 MC-30 MC-50 1994-01-20 NA NA 429NANA 1994-03-24 NA NA 479NANA 1994-04-21 NA NA 456NANA

Re: [R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread R. Michael Weylandt
My initial guess is because you don't have any complete cases: cf. this behavior plot(c(NA, NA)) If that's not it, dput() your data so that it's useable by others. Michael On Thu, Jan 5, 2012 at 10:43 AM, Rich Shepard rshep...@appl-ecosys.com wrote:  Please provide a pointer to the source of

Re: [R] ggplot2 - tricky problem

2012-01-05 Thread Justin Haynes
how bout: dat-data.frame(id=1:4,city=c('berlin','munich'),likeability=c(5,4,6,5),uniqueness=c(3,4,4,4)) ggplot(ddply(melt(dat, id.vars=c('id','city')), .(variable,city), summarise, value=mean(value)),

Re: [R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread Rich Shepard
On Thu, 5 Jan 2012, R. Michael Weylandt wrote: My initial guess is because you don't have any complete cases: cf. this behavior plot(c(NA, NA)) Michael, Here's a data frame that does plot; no complete cases here, either: mahalla.tds.z MAH-100 MAH-225 MAH-50 MASH-10 MASH-20

[R] save output of print() to txt file

2012-01-05 Thread Ana
I am looking for other option to write the output of the print command in R I am using sink() to write the R output to a file. This is similar to what I have: a=c(1:30) a [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

Re: [R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread Rich Shepard
On Thu, 5 Jan 2012, R. Michael Weylandt wrote: My initial guess is because you don't have any complete cases: cf. this behavior plot(c(NA, NA)) Michael, I may be creating the plots incorrectly: using plot() rather than plot.zoo(). When I compare the plot of the zoo object to a lattice

Re: [R] simulating stable VAR process

2012-01-05 Thread Paul Gilbert
The simulate function in dse lets you specify the model and the distribution of the noise term (or even their values so you can get any distribution you like). So, you should be able to do what you want, with either a VAR(p) or a vector ARMA process. If you are getting a process that

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-05 Thread Tom Roche
William Dunlap Wed, 4 Jan 2012 22:54:41 + R functions [can] use their enclosing environments to save state. Aha! makeStack - function () { stack - list() list(pop = function() { if (length(stack) == 0) { # get from an enclosing env. retval - NULL } else {

Re: [R] save output of print() to txt file

2012-01-05 Thread R. Michael Weylandt
cat(file = ) M On Thu, Jan 5, 2012 at 11:05 AM, Ana rrast...@gmail.com wrote: I am looking for other option to write the output of the print command in R I am using sink() to write the R output to a file. This is similar to what I have: a=c(1:30) a  [1]  1  2  3  4  5  6  7  8  9 10 11

Re: [R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread William Dunlap
Most plot methods die with an error like this if all the values in y (or x) are NA. E.g., you get the same problem with plot(rep(NA, 10)) Remove the columns that are all NA's before trying to plot them. It might be nice if the fancier plot methods could trap such errors and perhaps put some

Re: [R] save output of print() to txt file

2012-01-05 Thread David Winsemius
On Jan 5, 2012, at 12:05 PM, Ana wrote: I am looking for other option to write the output of the print command in R ?capture.output I am using sink() to write the R output to a file. This is similar to what I have: a=c(1:30) a [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Re: [R] save output of print() to txt file

2012-01-05 Thread Duncan Murdoch
On 12-01-05 12:05 PM, Ana wrote: I am looking for other option to write the output of the print command in R You don't say why you want this or what platform you're working on, so it's hard to choose among the many options, but one possibility is to run your script using R CMD BATCH or

Re: [R] Error in plot.window(...) : need finite 'ylim' values

2012-01-05 Thread Rich Shepard
On Thu, 5 Jan 2012, William Dunlap wrote: Most plot methods die with an error like this if all the values in y (or x) are NA. E.g., you get the same problem with plot(rep(NA, 10)) Remove the columns that are all NA's before trying to plot them. Bill, Ah, so. I did not look to see if

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-05 Thread Martin Morgan
On 01/05/2012 09:18 AM, Tom Roche wrote: William Dunlap Wed, 4 Jan 2012 22:54:41 + R functions [can] use their enclosing environments to save state. Aha! makeStack- function () { stack- list() list(pop = function() { if (length(stack) == 0) { # get from an enclosing env.

Re: [R] [newbie] stack operations, or functions with side effects (or both)

2012-01-05 Thread William Dunlap
Thanks for the improvements. The main point in my original post was that altering the arguments of a function is a really bad thing to do in R (except when using replacement functions). A function that alters other objects in the caller's environment is also really bad. By bad I mean that such

[R] Calling R functions within C/C++

2012-01-05 Thread Ian Schiller
Hello everyone! First of all, please note that I'm working under Windows 7. I have written a Gibbs sampler in R and I'm now in the process of translating it in C++ to increase the speed. I'm relatively new to C++ and this question may be trivial, but my search so far have been unsuccessful.

Re: [R] Fwd: WHO Anthro growth curve macros and RIn-Reply-To=CAAOCNNZawGtKkWpgFMYADSyxWGTeWEDxqVVHv7=Azo=1g+h...@mail.gmail.com

2012-01-05 Thread Severine.Frison
Dear Gustaf, I wish you a happy new year! I am a PhD Staff at LSHTM and I have been trying to use WHO anthro macros in R with the file you posted on internet but when I double check the WHZ, HAZ, WAZ output with output from ENA or STATA, it differs slightly. Do you have any idea why that

[R] Problem with axes in a plot of Kaplan-Meier

2012-01-05 Thread correu griera
Helo: After changing involuntarily some of the graphics parameters with the command par() (I did not know that changes with this command are permanent), now when I made a plot of the survival Kaplan-Meier function, the Y axis does not start at 1, and the X axis does starts at 0. The commands that

Re: [R] Calling R functions within C/C++

2012-01-05 Thread Dirk Eddelbuettel
On 5 January 2012 at 15:04, Ian Schiller wrote: | Hello everyone! | | First of all, please note that I'm working under Windows 7. | | I have written a Gibbs sampler in R and I'm now in the process of translating it in C++ to increase the speed. I'm relatively new to C++ and this question

Re: [R] Calling R functions within C/C++

2012-01-05 Thread Ian Schiller
I am not sure if you have found Rcpp yet I will take a look for sure! Thanks a lot! Ian -Original Message- From: Dirk Eddelbuettel [mailto:e...@debian.org] Sent: 5 janvier 2012 15:18 To: Ian Schiller Cc: r-help@r-project.org Subject: Re: [R] Calling R functions within C/C++ On 5

Re: [R] Problem with axes in a plot of Kaplan-Meier

2012-01-05 Thread David Winsemius
On Jan 5, 2012, at 12:50 PM, correu griera wrote: Helo: After changing involuntarily some of the graphics parameters with the command par() (I did not know that changes with this command are permanent), now when I made a plot of the survival Kaplan-Meier function, the Y axis does not start at

Re: [R] RODBC installation: error message

2012-01-05 Thread gregory benison
As Duncan noted, the message is pretty clear in that the ODBC header files are missing, which are required to compile RODBC from source. On RH based Linuxen, this requires the installation of the unixODBC-devel RPM, much as one would need to have other *-devel RPMs (eg. readline-devel)

[R] [ncdf] programmatically copying a netCDF file

2012-01-05 Thread Tom Roche
How to programmatically (i.e., without no or minimal handcoding) copy a netCDF file? (Without calling system(cp whatever wherever) :-) Why I ask: I need to do surgery on a large netCDF file (technically an I/O API file which uses netCDF). My group believes a data-assimilation error caused a

Re: [R] automatic SI prefixes as ticklabels on axis

2012-01-05 Thread Jonas Stein
On 2012-01-05, Jonas Stein n...@jonasstein.de wrote: i want to plot values with frequency on a logarithmic x axis. similar to this example that i found in the web: http://www.usspeaker.com/jensen%20p15n-graph.gif I would like to convert long numbers to si prefix notation like in the example

Re: [R] automatic SI prefixes as ticklabels on axis

2012-01-05 Thread Ben Tupper
On Jan 5, 2012, at 8:02 PM, Jonas Stein wrote: On 2012-01-05, Jonas Stein n...@jonasstein.de wrote: i want to plot values with frequency on a logarithmic x axis. similar to this example that i found in the web: http://www.usspeaker.com/jensen%20p15n-graph.gif I would like to convert long

Re: [R] [ncdf] programmatically copying a netCDF file

2012-01-05 Thread David William Pierce
On Thu, Jan 5, 2012 at 3:29 PM, Tom Roche tom_ro...@pobox.com wrote: How to programmatically (i.e., without no or minimal handcoding) copy a netCDF file? (Without calling system(cp whatever wherever) [...] So I'm wondering, can anyone point me to, or provide, code that copies a

Re: [R] graphic problem: transparent window when starting mtrace() from package debug

2012-01-05 Thread Mark.Bravington
Hi Jannis [I'm the author of package debug... I know this is 6 months after your query, sorry-- but I don't subscribe to R-help, and you didn't post to the maintainer! I'm primarily sending this to close off the thread.] when I use the package debug, mark a function with mtrace() and enter

Re: [R] Problem reading .por (SPSS portable) data file

2012-01-05 Thread william jawde
Hello, I have both foreign and Hmisc packages installed. However, when I attempt to import a SPSS .por file, I get the following error message: Error in read.spss(file, use.value.labels = use.value.labels, to.data.frame = to.data.frame, : error reading portable-file dictionary In

Re: [R] Fwd: WHO Anthro growth curve macros and RIn-Reply-To=CAAOCNNZawGtKkWpgFMYADSyxWGTeWEDxqVVHv7=Azo=1g+h...@mail.gmail.com

2012-01-05 Thread csrabak
Em 5/1/2012 14:59, severine.fri...@lshtm.ac.uk escreveu: Dear Gustaf, I wish you a happy new year! I am a PhD Staff at LSHTM and I have been trying to use WHO anthro macros in R with the file you posted on internet but when I double check the WHZ, HAZ, WAZ output with output from ENA or STATA,

Re: [R] automatic SI prefixes as ticklabels on axis

2012-01-05 Thread Rui Barradas
Hello, You can use your function with 'lapply' getSIstring(2e7) getSIstring(2e-8) lapply(c(2e7, 2e-8, 1234), getSIstring) # as a list unlist(lapply(c(2e7, 2e-8, 1234), getSIstring)) # as a character vector or you can include the 'lapply' in the function body getSIstring2 -

Re: [R] automatic SI prefixes as ticklabels on axis

2012-01-05 Thread Rui Barradas
I forgot to say I have commented out your function's first line, sistring - paste(x) It wouldn't cause any problem, it's just not needed. Rui Barradas -- View this message in context: http://r.789695.n4.nabble.com/automatic-SI-prefixes-as-ticklabels-on-axis-tp4266141p4267965.html Sent from

Re: [R] package sampling

2012-01-05 Thread blueberry1228
Hi, I would like to attach my answer although this question has been posted here for more than a year. I believe some people may meet the same problem. I use sampling package to do the stratified sampling as well, using strata() function. And everything goes well before I add another library:

[R] Can levelplot colorkeys display a logarithmic scale evenly?

2012-01-05 Thread Mike MacFerrin
I'm using the {lattice} levelplot function to make a (more or less) 2-d histogram, and for the most part it's working fine with my data. However, I can't get the color key to do what I need. I can give it labels and custom cutoffs, but my cutoff lines (and hence my labels) aren't evenly

[R] R not recognizing words

2012-01-05 Thread arabarkev
Hello all I'm new to R and am experiencing a problem with a categorical variable. All the data of this variable are Low, High, or NA. When I put summary(x$y), it gives me the number of High, Low, and NA entries. However, when I try to subset by writing x$y==Low or x$y==High, R does not

[R] question about rev

2012-01-05 Thread 孟欣
Hi,all: I have a vector,and wanna get the opposite value via rev function. a [1] FALSE FALSE TRUE TRUE TRUE rev(a) [1] TRUE TRUE TRUE FALSE FALSE I don't know why the 3rd TRUE has not been reversed,while all other values are reversed? Thanks My best [[alternative