Re: [R] Specifying Prior Weights in a GLM

2010-12-11 Thread Dennis Murphy
Hi: Here's a simple example of its use using the data from Montgomery, Myers and Vining (2002), problem 4.7: ex4.7 <- structure(list(pressure = c(2500L, 2700L, 2900L, 3100L, 3300L, 3500L, 3700L, 3900L, 4100L, 4300L), nfast = c(50L, 70L, 100L, 60L, 40L, 85L, 90L, 50L, 80L, 65L), nfailures = c(10L,

Re: [R] remove quotes from the paste output

2010-12-11 Thread Mark Difford
Bob, >> Does anybody know how to eliminate the double quotes so that I can use >> the >> variable name (generated with the paste function) further in the code... ?noquote should do it. ## > "varName" [1] "varName" > noquote("varName") [1] varName Regards, Mark. -- View this message in contex

Re: [R] randomForest: help with combine() function

2010-12-11 Thread Liaw, Andy
combine() is meant to be used on randomForest objects that were built from identical training data. Andy > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dennis Duro > Sent: Friday, December 10, 2010 11:59 PM > To: r-help@r-pr

Re: [R] Predator Prey Models

2010-12-11 Thread Ben Bolker
Craig O'Connell gmail.com> writes: >I am currently modifying a previously developed predator prey model and > was curious if there was a way to add in a disturbance to the model (let's > say at time t=100). The disturbance can be the introduction of 40 prey > (N=40) and 10 predators (Pred =

Re: [R] overlap different line in a xyplot (lattice)

2010-12-11 Thread Peter Ehlers
On 2010-12-11 16:47, Felix Andrews wrote: On 12 December 2010 00:08, Peter Ehlers wrote: [...snip...] The idea is the same: you need to get your data into "long" format with a grouping variable and then use the 'groups' argument to xyplot. Here's fake data frame (you should have provided one

Re: [R] overlap different line in a xyplot (lattice)

2010-12-11 Thread Felix Andrews
On 12 December 2010 00:08, Peter Ehlers wrote: > On 2010-12-11 03:12, Francesco Nutini wrote: >> >> mmmh, yes this method works... >> but I have to overlap this two graphs: >> >>>  xyplot(a ~b |sites, data=dataset, col="red") >> >>>  xyplot(c ~b |sites, data=dataset, col="blue") >> >> >> a, b and

[R] (S|odf)weave : how to intersperse (\LaTeX{}|odf) comments in source code ? Delayed R evaluation ?

2010-12-11 Thread Emmanuel Charpentier
Dear list, Inspired by the original Knuth tools, and for paedaogical reasons, I wish to produce a document presenting some source code with interspersed comments in the source (see Knuth's books rendering TeX and metafont sources to see what I mean). I seemed to remember that a code chunk coul

Re: [R] Why do we have to turn factors into characters for various functions?

2010-12-11 Thread Joshua Wiley
Hi Tal, I always think of factors as a way of imposing (however arbitrarily) order on some variable. To that extent, the key aspect is first, second, third, etc., represented numerically in factors as 1, 2, 3, etc. . The labels are for convenience and interpretation. Consider: x <- factor(c(5,

[R] Why do we have to turn factors into characters for various functions?

2010-12-11 Thread Tal Galili
Hello dear R-help mailing list, My question is *not* about how factors are implemented in R (which is, if I understand correctly, that factors keeps numbers and assign levels to them). My question *is* about why so many functions that work on factors don't treat them as characters by default? Her

Re: [R] help requested

2010-12-11 Thread jim holtman
try this: > x X1 X2 1 1 3 2 1 4 3 1 5 4 2 3 5 2 4 6 3 2 7 4 1 8 4 3 9 4 5 10 5 2 11 5 4 > sapply(split(x, x$X1), function(.grp){ + paste(.grp[[1]][1], paste(.grp[[2]], collapse = ',')) + }) 1 2 3 4 5 "1 3,4,5" "2 3,4"

Re: [R] remove quotes from the paste output

2010-12-11 Thread Joshua Wiley
Hi Bob, You can use the get() function to loopup a variable name. > long.variable.name <- 5 > "long.variable.name" [1] "long.variable.name" > get("long.variable.name") [1] 5 However, I think this is all overkill. Assuming extractModelParameters() came from the MplusAutomation package, and that

[R] Predator Prey Models

2010-12-11 Thread Craig O'Connell
Dear R-users, I am currently modifying a previously developed predator prey model and was curious if there was a way to add in a disturbance to the model (let's say at time t=100). The disturbance can be the introduction of 40 prey (N=40) and 10 predators (Pred = 10). I would like to see my m

Re: [R] break

2010-12-11 Thread Ted Harding
And not only that! According to the code, the only place that i is set is in the loop for(i in 1:n){...}, and the test for 'break' is if (i < 0.1) {break(i)} Therefore the condition will never be satisfied. Possibly Serdar meant if(matris[i] < 0.1) {break} or something similar. Ted. On 11-

Re: [R] break

2010-12-11 Thread Jorge Ivan Velez
If I understand correctly, the following should do it: lag.max2 <- function(object, n = 12){ matris <- matrix(NA, nrow = n) for(i in 1:n){ matris[i] <- ur.df(object, lags = i, type = "trend")@testreg$coefficients[i+3,4] if(matris[i]<0.1) break } # output c('lag' = i, 'p' = matris[i]) } a2 <

Re: [R] break

2010-12-11 Thread Jim Holtman
It is 'break', not 'break(I)' Sent from my iPhone What is the problem you are trying to solve? On Dec 11, 2010, at 12:17, Serdar Akin wrote: Hi I'm trying to utilize the break command for breaking the loop when the p-value is less than 10 per cent using the urca package. But it does not

[R] using Statistics::R

2010-12-11 Thread Yi-Fang Liu
Hi,ALL I want to use R in Perl, the Statistics::R module is great but I meet the problem: I don`g know how to pass one array from Perl to R, can anyone show me? Any suggestion will be appreciate~ Thank you! [[alternative HTML version deleted]] __

[R] Specifying Prior Weights in a GLM

2010-12-11 Thread Enrique Garcia
Hello R folks, I have three questions. I am trying to run a logistic regression (binomial family) where the response variable is a proportion. According to R Documentation in "a binomial GLM prior weights are used to give the number of trials when the response is the proportion of successes." H

Re: [R] help requested

2010-12-11 Thread profaar
hi thanks for your reply. there are around 2 nodes in my dataset. will it work for conversion from edge list format to node list format? I am using R under Windows XP. With Warm Wishes and Regards A. Abdul Rasheed, M.C.A., M.E., Ph.D., A

[R] break

2010-12-11 Thread Serdar Akin
Hi I'm trying to utilize the break command for breaking the loop when the p-value is less than 10 per cent using the urca package. But it does not break the loop, anyone that can help me? library(urca) set.seed(1) a1 <- runif(100) lag.max <- function(object, n = 12){ matris <- matrix(NA, nrow

[R] remove quotes from the paste output

2010-12-11 Thread vaibhav dua
Hi, I'm generating the name of the variable with paste function and then using that variable name further to get the specific position value from the data.frame, here is the snippet from my code: modelResults <- extractModelParameters("C:/PilotStudy/Mplus_Input/Test", recursive=TRUE) #extract

[R] quantile linear ridge regression using qrnn

2010-12-11 Thread Daniel Gordon
We would like to use the qrnn package for building a quantile linear ridge regression. To this end we need to use the function qrnn.rbf. The meaning of the second argument x.basis, isn't clear to me. What should I give it as an argument? Does the contents of this matrix have any meaning or only it

Re: [R] Can't install Sweave

2010-12-11 Thread Duncan Murdoch
On 11/12/2010 11:18 AM, Rainer Schuermann wrote: On Saturday 11 December 2010 14:54:39 Duncan Murdoch wrote: If you put a copy of Sweave.sty into your latex installation, in a few months you'll have an obsolete version, and things will just not work. A link from ly latex installation to the or

Re: [R] Can't install Sweave

2010-12-11 Thread Yihui Xie
Is it a good idea to put Sweave.sty and other style files into CTAN as a LaTeX package? (instead of pointing the users to file.path(R.home(), 'share', 'texmf') each time they run into troubles) Regards, Yihui -- Yihui Xie Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa S

Re: [R] Could concurrent R sessions mix up variables?

2010-12-11 Thread Tal Galili
Hello Anthony, Since you are working on Windows, also consider using the "doSMP" with the "foreach" package. Although it is not fully GPL as many of us would have preferred (e.g: doSMP is not on CRAN), it is still freely available (with source code and all) to download (even without the need for "R

Re: [R] toJSON question

2010-12-11 Thread Dieter Menne
Santosh Srinivas wrote: > > I am trying to use RJSONIO > > I have: > x <- c(0,4,8,9) > y <- c(3,8,5,13) > z <- cbind(x,y) > > Any idea how to convert z into the JSON format below? > > I want to get the following JSON output to put into a php file. > [[0, 3], [4, 8], [8, 5], [9, 13]] > I ha

Re: [R] toJSON question

2010-12-11 Thread Duncan Temple Lang
On 12/11/10 8:00 AM, Santosh Srinivas wrote: > Hello, > > I am trying to use RJSONIO > > I have: > x <- c(0,4,8,9) > y <- c(3,8,5,13) > z <- cbind(x,y) > > Any idea how to convert z into the JSON format below? > > I want to get the following JSON output to put into a php file. > [[0, 3], [4,

Re: [R] Can't install Sweave

2010-12-11 Thread Rainer Schuermann
On Saturday 11 December 2010 14:54:39 Duncan Murdoch wrote: > If you put a copy of Sweave.sty into your latex installation, in a few > months you'll have an obsolete version, and things will just not work. A link from ly latex installation to the original file in my R installation would do fine?

[R] toJSON question

2010-12-11 Thread Santosh Srinivas
Hello, I am trying to use RJSONIO I have: x <- c(0,4,8,9) y <- c(3,8,5,13) z <- cbind(x,y) Any idea how to convert z into the JSON format below? I want to get the following JSON output to put into a php file. [[0, 3], [4, 8], [8, 5], [9, 13]] Thank you. __

[R] package sampling

2010-12-11 Thread andrija djurovic
Hi R users. I have a problem with function strata in sampling packages. > st0 = strata(dom, stratanames="stratas", size=sample.size, method="systematic",pik, FALSE) Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list? In previous version of R 2.9.1 and pre

Re: [R] simple payoff function

2010-12-11 Thread Romain Francois
Le 11/12/10 16:09, Santosh Srinivas a écrit : Just wondering if there is a better way to do this? x<- seq(4,20,1) y<- sapply(x, function(x) (max(x-10,0))) Is there a easier way to get to y? i.e. max(x-10,0) Hello, You are probably looking for pmax, that is described in the same help page

[R] simple payoff function

2010-12-11 Thread Santosh Srinivas
Just wondering if there is a better way to do this? x <- seq(4,20,1) y <- sapply(x, function(x) (max(x-10,0))) Is there a easier way to get to y? i.e. max(x-10,0) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

[R] Statistics::R

2010-12-11 Thread Yifang Liu
Dear,ALL I am using CRAN module Statistics::R to run R scripts in Perl, The problem is how to pass the array variable to R? Following is my Perl script: #!/usr/bin/perl use strict; use warnings; use Statistics::R; open DATA,"<","data.txt" or die "$!"; my @data = ; my $R = Statistics::R -> new()

Re: [R] Can't install Sweave

2010-12-11 Thread Duncan Murdoch
On 11/12/2010 8:41 AM, Rainer Schuermann wrote: Why do you think it wasn't installed? There is no package "Sweave". Sweave() is a function in package "utils", which you session info indicates you have and is loaded. Care to tell us what you want to do with Sweave and why you think it isn't work

Re: [R] Can't install Sweave

2010-12-11 Thread Rainer Schuermann
> Why do you think it wasn't installed? There is no package "Sweave". > > Sweave() is a function in package "utils", which you session info > indicates you have and is loaded. > > Care to tell us what you want to do with Sweave and why you think it > isn't working? Oops - this is embarrassing!

[R] Rapache on windows

2010-12-11 Thread Santosh Srinivas
Hello all, I searched on the www but could not find installation instructution for rapache on windows. The page says that the release runs on UNIX/Linux and Mac OS X operating systems. Has anyone been able to configure it on windows? Any idea how to go about it? Thank you. __

Re: [R] Can't install Sweave

2010-12-11 Thread Gavin Simpson
On Sat, 2010-12-11 at 14:07 +0100, Rainer Schuermann wrote: > Hi there! > > I tried to work with Sweave, assuming that it is part of the standard > installation - which it was not for my system. Trying to install, it > gives me this error message: Why do you think it wasn't installed? There is no

Re: [R] Can't install Sweave

2010-12-11 Thread huang min
Sweave is not a package. It is a function which comes with the base R. Huang On Sat, Dec 11, 2010 at 9:07 PM, Rainer Schuermann < rainer.schuerm...@gmx.net> wrote: > Hi there! > > I tried to work with Sweave, assuming that it is part of the standard > installation - which it was not for my syste

Re: [R] overlap different line in a xyplot (lattice)

2010-12-11 Thread Peter Ehlers
On 2010-12-11 03:12, Francesco Nutini wrote: mmmh, yes this method works... but I have to overlap this two graphs: xyplot(a ~b |sites, data=dataset, col="red") xyplot(c ~b |sites, data=dataset, col="blue") a, b and c are columns in the same dataset. "Sites" is also a column in the datas

[R] Can't install Sweave

2010-12-11 Thread Rainer Schuermann
Hi there! I tried to work with Sweave, assuming that it is part of the standard installation - which it was not for my system. Trying to install, it gives me this error message: > install.packages("Sweave") Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Swe

Re: [R] RES: Barplot with "Independent" Lines Y axis

2010-12-11 Thread Rodrigo Aluizio
Well, at least I could help (even if unintentionally), as a compensation for all the help I got from the list. Cheers. Em sexta-feira, 10 de dezembro de 2010, Jim Lemon escreveu: > On 12/10/2010 08:48 PM, Rodrigo Aluizio wrote: > > OK that's it. Working nicely. I sent the final graph with the not

Re: [R] Projecting data on a world map using long/lat

2010-12-11 Thread Patrick Hausmann
Hi Mathijs, this should work: library(maptools) library(ggplot2) gpclibPermit() theme_set(theme_bw()) #setwd("C:\\foo") point to your local dir # Data: http://thematicmapping.org/downloads/world_borders.php world.shp <- readShapeSpatial("TM_WORLD_BORDERS-0.3.shp") # check for region-id - Use "

[R] New R Install Worked to End Trouble Loading doBy and coin Packages

2010-12-11 Thread Adam Carr
Hello Peter: The new R install seems to have worked. Both doBy and coin appear to load and run fine. Thanks for taking the time to help me. Adam From: Peter Ehlers Cc: "r-help@r-project.org" Sent: Fri, December 10, 2010 7:13:17 AM Subject: Re: [R] New Inst

Re: [R] (no subject)

2010-12-11 Thread Dennis Murphy
Hi: Here's a plyr solution: library(plyr) dg <- data.frame(x1 = rep(1:2, c(10, 15)), x2 = 1:25) f <- function(x) head(rev(sort(x)), 5) > ddply(dg, 'x1', summarise, x2 = f(x2)) x1 x2 1 1 10 2 1 9 3 1 8 4 1 7 5 1 6 6 2 25 7 2 24 8 2 23 9 2 22 10 2 21 HTH, Dennis On Fri,

Re: [R] melt causes errors when characters and values are used

2010-12-11 Thread Dennis Murphy
Hi: On Fri, Dec 10, 2010 at 6:47 AM, Daniel Brewer wrote: > Hello, > > I am finding that the melt function from the reshape library causes > errors when applied to a data.frame that contains numeric and character > columns. For example, > In this case, thankfully so - it's warning that you're

Re: [R] [r] overlap different line in a xyplot (lattice)

2010-12-11 Thread Francesco Nutini
mmmh, yes this method works... but I have to overlap this two graphs: > xyplot( a ~ b | sites, data=dataset, col="red") > xyplot( c ~ b | sites, data=dataset, col="blue") a, b and c are columns in the same dataset. "Sites" is also a column in the dataset, but it's a factorial vari

Re: [R] Adding numbers in Outputs

2010-12-11 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 10.12.2010 15:00:12: > Dear Mr Holtman Sir, > > Thanks a lot for your great solution. This certainly is helping me achieve > what I need to get. However, I shall be hugely thankful to you if you can > guide me in one respect. > > Sir, you have used

Re: [R] 45 Degree labels on barplot? Help understanding code previously posted.

2010-12-11 Thread Jim Lemon
On 12/11/2010 02:25 AM, Simon Kiss wrote: Dear colleagues, i found a line or two of code in the help archives from Uwe Ligges about creating slanted x-labels for a barplot and it works well for my purposes (code below). However, I was hoping someone could explain to me precisely what the code

Re: [R] help with RSQLite adding a new column

2010-12-11 Thread Michael Bedward
Hi Michael, Sorry if I'm being slow, but I've read your post three times and still can't quite work out what you're trying to do (the changing variables names are a bit confusing). I use RSQLite a lot and might be able to help if you could explain your inputs and desired output in simple terms.

Re: [R] How to print colorful R output??

2010-12-11 Thread Liviu Andronic
Hello On Fri, Dec 10, 2010 at 10:53 PM, casperyc wrote: > I wonder if there is a way to print the R output with COLOR? > Not the color plots, but the outputs in the console. > I once asked for this on the list [1], and the are two points: - although technically feasible, say using ncurses, there