Re: [R] permutations in R

2009-03-17 Thread Stavros Macrakis
On Tue, Mar 17, 2009 at 12:41 PM, Greg Snow wrote: > No, I meant the Combinations package, it is apparently an Omegahat package > (http://www.omegahat.org/Combinations/).  It looks similar to the permn > function as far as the usage goes, but the documentation includes additional > information

Re: [R] permutations in R

2009-03-17 Thread Stavros Macrakis
On Tue, Mar 17, 2009 at 5:24 AM, Gavin Simpson wrote: > On Mon, 2009-03-16 at 18:43 -0400, Stavros Macrakis wrote: >> ... no way to find relevant functions, and no way of knowing which one to >> use if there is more than one. > That is what the Task Views are meant to address, for discrete subje

[R] Extreme AIC or BIC values in glm(), logistic regression

2009-03-17 Thread Maggie Wang
Dear R-users, I use glm() to do logistic regression and use stepAIC() to do stepwise model selection. The common AIC value comes out is about 100, a good fit is as low as around 70. But for some model, the AIC went to extreme values like 1000. When I check the P-values, All the independent variab

Re: [R] Combining columns from two dataframes

2009-03-17 Thread Jorge Ivan Velez
Dear Andrew, Try this: data.frame(z=c(a$a,b$c)) HTH, Jorge On Tue, Mar 17, 2009 at 5:55 PM, Andrew McFadden < andrew.mcfad...@maf.govt.nz> wrote: > I all > > I am trying to combine columns from two dataframes to make a completely > new dataframe consisting of one column of dates (ie a combinat

Re: [R] Combining columns from two dataframes

2009-03-17 Thread David Winsemius
What about just: data.frame(z=c(a$a, b$c)) ? -- David Winsemius On Mar 17, 2009, at 10:44 PM, Steven McKinney wrote: Not sure how well this gets at what you want, but it seems close (if not kludgy!) c <- data.frame(t(cbind(t(a), t(b))), stringsAsFactors = FALSE)[, 1, drop = FALSE] c

[R] JGR install problem

2009-03-17 Thread pgseye
Hi, I thought I'd like to try out JGR, but after installing the package (and dependencies) I receive the following when I try to load it: > library(JGR) Loading required package: rJava Loading required package: JavaGD Loading required package: iplots Note: On Mac OS X we strongly recommend using

[R] asymmetric mutual information

2009-03-17 Thread JOHN VOIKLIS
Hello, In a human-subjects experiment collaborators (A & B) communicated about how to categorize a number of multidimensional stimuli. Following their conversation, each collaborator sorted the stimuli into bins. This sort data was converted into square co-occurrence matrices, where 1 indicated th

Re: [R] Combining columns from two dataframes

2009-03-17 Thread Steven McKinney
Not sure how well this gets at what you want, but it seems close (if not kludgy!) > c <- data.frame(t(cbind(t(a), t(b))), stringsAsFactors = FALSE)[, 1, drop = > FALSE] > c a 1 2008-07-27 2 2008-10-01 3 2008-08-15 4 2008-08-14 5 2008-08-14 6 2008-09-20 7 2008-07-27 8 2008-10-01 > c$a <

Re: [R] How do I set the Windows temporary directory in R?

2009-03-17 Thread Steven McKinney
Check help for tempfile() and tempdir() You can set an environment variable as discussed in the help to point to D:\temp >From ?tempfile: By default, the filenames will be in the directory given by tempdir(). This will be a subdirectory of the temporary directory found by the followin

Re: [R] How do I set the Windows temporary directory in R?

2009-03-17 Thread stephen sefick
?setwd() I don't have a windows machine to work on, but this should work. On Tue, Mar 17, 2009 at 10:14 PM, andrew wrote: > setwd > > On Mar 18, 12:42 pm, Jonathan Greenberg wrote: >> I'm trying to redirect where temporary files go under R to >> D:\temp\somerandomname from its default (C:\Docume

Re: [R] How do I set the Windows temporary directory in R?

2009-03-17 Thread andrew
setwd On Mar 18, 12:42 pm, Jonathan Greenberg wrote: > I'm trying to redirect where temporary files go under R to > D:\temp\somerandomname from its default (C:\Documents and > Settings\username\Temp\somerandomname) -- how do I go about doing this? > > --j > > -- > > Jonathan A. Greenberg, PhD > P

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread Jason Rupert
Paul, I really appreciate all your help. Here is what I ended up with: http://n2.nabble.com/Can-R-produce-this-plot--td2489288.html#a2494992 This is really close. I might try to figure out a way to add the median to the "boxplot", but this is really close and captures a ton of information on

[R] How do I set the Windows temporary directory in R?

2009-03-17 Thread Jonathan Greenberg
I'm trying to redirect where temporary files go under R to D:\temp\somerandomname from its default (C:\Documents and Settings\username\Temp\somerandomname) -- how do I go about doing this? --j -- Jonathan A. Greenberg, PhD Postdoctoral Scholar Center for Spatial Technologies and Remote Sensin

Re: [R] bigglm() results different from glm()

2009-03-17 Thread Francisco J. Zagmutt
Dear Thomas and John, Thanks for your prompt reply and for looking at your code to explain these differences. I see you replied very late at night, so I am sorry if my little problem kept you awake! As you pointed out, the model indeed converges (as reported in model$converged) once I specif

Re: [R] bigglm() results different from glm()

2009-03-17 Thread Francisco J. Zagmutt
Dear Thomas and John, Thanks for your prompt reply and for looking at your code to explain these differences. I see you replied very late at night, so I am sorry if my little problem kept you awake! As you pointed out, the model indeed converges (as reported in model$converged) once I specif

Re: [R] the quote problem with readLines()

2009-03-17 Thread jim holtman
readLines is doing exactly what you are asking: Value A character vector of length the number of lines read. You still have to convert the character strings to numeric. Exactly how large is "quite large"? What system are you running on? How much memory do you have? What is the error message t

Re: [R] Need a little help setting the upper median using "layout"...

2009-03-17 Thread jim holtman
try something like this: x <- rnorm(1) # op <- par(mar=c(2,2,2,2), oma=c(0,0,0,0)+.8) op <- par(mar=c(2, 2, 2, 2), oma=c(0,0,0,0)+.8) layout(matrix(c( 4, 4, 4, 4, 4, 4, 2, 2, 2, 3, 3, 3, 1, 1, 1, 3, 3, 3, 1, 1, 1, 3, 3, 3,

Re: [R] converting null to some values

2009-03-17 Thread Bill.Venables
> temp type1 type2 a b c 1 male low 1 5 0 2 female med 2 NA 0 3 male high 4 5 1 4 female low NA 1 1 5 female med 3 2 NA > temp[is.na(temp)] <- 0 ## the magic words... > temp type1 type2 a b c 1 male low 1 5 0 2 female med 2 0 0 3 male high 4 5 1 4 femal

Re: [R] converting null to some values

2009-03-17 Thread Ferry
Sorry, the data is: temp <- data.frame(type1 = c("male", "female", "male", "female", "female"), type2 = c("low", "med", "high", "low", "med"), a = c(1,2,4, NA, 3), b = c(5,NA,5,1,2), c = c(0,0,1,1,NA)) On Tue, Mar 17, 2009 at 4:28 PM, Ferry wrote: > Hi, > > I have newbie question. Suppose I hav

Re: [R] formula question

2009-03-17 Thread Peter Dalgaard
Erin Hodgess wrote: Dear R People: Here is a small data frame and two particular formulas: test.df y x 1 -0.9261650 1 2 1.5702700 2 3 0.1673920 3 4 0.7893085 4 5 0.3576875 5 6 -1.4620915 6 7 -0.5506215 7 8 -0.3480292 8 9 -1.2344036 9 10 0.8502660 10 summary

[R] converting null to some values

2009-03-17 Thread Ferry
Hi, I have newbie question. Suppose I have the following data: temp <- data.frame(type1 = c("male", "female", "male", "female", "female"), type2 = c("low", "med", "high", "low", "med"), a = c(1,2,4, NA, 3), b = [TRUNCATED] temp type1 type2 a b c 1 male low 1 5 0 2 female med

[R] Likelihood of a ridge regression (lm.ridge)?

2009-03-17 Thread joris meys
Dear all, I want to get the likelihood (or AIC or BIC) of a ridge regression model using lm.ridge from the MASS library. Yet, I can't really find it. As lm.ridge does not return a standard fit object, it doesn't work with functions like e.g. BIC (nlme package). Is there a way around it? I would ca

Re: [R] formula question

2009-03-17 Thread Ted Harding
On 17-Mar-09 23:04:25, Erin Hodgess wrote: > Dear R People: > Here is a small data frame and two particular formulas: >> test.df > y x > 1 -0.9261650 1 > 2 1.5702700 2 > 3 0.1673920 3 > 4 0.7893085 4 > 5 0.3576875 5 > 6 -1.4620915 6 > 7 -0.5506215 7 > 8 -0.3480292 8

Re: [R] Converting time from HH:MM:SS to only HH:MM

2009-03-17 Thread Bill.Venables
Dear Neotropical Bat Risk Assessments, Rounding is the problem. If you just want to lop off the seconds that is easy. For example: > d <- strptime(date(), "%a %b %d %H:%M:%S %Y") > d [1] "2009-03-18 08:52:41" > format(d, "%Y-%m-%d %H:%M") [1] "2009-03-18 08:52" Here is a one way to do the rou

[R] formula question

2009-03-17 Thread Erin Hodgess
Dear R People: Here is a small data frame and two particular formulas: > test.df y x 1 -0.9261650 1 2 1.5702700 2 3 0.1673920 3 4 0.7893085 4 5 0.3576875 5 6 -1.4620915 6 7 -0.5506215 7 8 -0.3480292 8 9 -1.2344036 9 10 0.8502660 10 > summary(lm(exp(y)~x)) Call:

Re: [R] Converting time from HH:MM:SS to only HH:MM

2009-03-17 Thread Rolf Turner
On 18/03/2009, at 11:34 AM, Neotropical bat risk assessments wrote: Hi all, I need to compare between times and put all similar times in specific 1 minute bins. Unfortunately the original data include seconds as well. My data is in HH:MM:SS format but I need it rounded to only HH:MM and tryin

Re: [R] Distribution U

2009-03-17 Thread David Winsemius
I was initially going to say Uniform but you have too many parameters. The Uniform distribution can only have a start point and an end point. Perhaps the Mann-Whitney U? In R that could be qwilcox(p, n, m) -- David Winsemius On Mar 17, 2009, at 5:15 PM, MarcioRibeiro wrote: Hi listers, Does

Re: [R] Map using projection

2009-03-17 Thread Dr. Alireza Zolfaghari
Thanks Ray On Thu, Mar 12, 2009 at 11:01 PM, Dr. Alireza Zolfaghari < ali.zolfagh...@gmail.com> wrote: > Hi list, > I have a real problem with plotting US state map. When I try to plot the > northern state, there will be some blank space in the top of graph (see case > 1 example), and when I plot

[R] Converting time from HH:MM:SS to only HH:MM

2009-03-17 Thread Neotropical bat risk assessments
Hi all, I need to compare between times and put all similar times in specific 1 minute bins. Unfortunately the original data include seconds as well. My data is in HH:MM:SS format but I need it rounded to only HH:MM and trying in Excel to display "unique" records only does not work since the

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread Paul Murrell
Hi Jason Rupert wrote: > Paul, > > This is great! Like you said it is really close. I made a few > changes and for some reason the y-axis label magically came back. I > tried to remove it but it wouldn't stay away. You have removed the 'axes=FALSE' from the qqplot() call. Also, you have re

[R] Distribution U

2009-03-17 Thread MarcioRibeiro
Hi listers, Does anybody could tell me if there is a function for the DISTRIBUTION FUNCTION U(p;m,n)! Thanks, Marcio -- View this message in context: http://www.nabble.com/Distribution-U-tp22567871p22567871.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Way to rotate a histogram?

2009-03-17 Thread Mike Lawrence
I actually pasted the wrong code! This attempts to replicate the original request to replicate a JMP graphic: library(ggplot2) test_data<-rnorm(100,mean=10,sd=4) a = data.frame(obs = test_data,condition = 'None') p1 = ggplot( data = a ,aes( x = obs ) )+geom_

[R] Combining columns from two dataframes

2009-03-17 Thread Andrew McFadden
I all I am trying to combine columns from two dataframes to make a completely new dataframe consisting of one column of dates (ie a combination of dates from the two dataframes). >From the following dataframes a b 1 2008-07-27 1 2 2008-10-01 2 3 2008-08-15 3 4 2008-08-14 4 5 2008-08-14 5 6

Re: [R] RES: set a legend with an "image" graph

2009-03-17 Thread Jorge Ivan Velez
Dear Luis, You might be interested in ?title. Here is an example took from ?image: require(grDevices) # for colours x <- y <- seq(-4*pi, 4*pi, len=27) r <- sqrt(outer(x^2, y^2, "+")) image(z = z <- cos(r^2)*exp(-r/6), col=gray((0:32)/32)) # title added after plotting title(main="Here you go!")

Re: [R] Way to rotate a histogram?

2009-03-17 Thread David Winsemius
Nice work, Mike. Actually I think he was looking for it done this way. library(ggplot2) test_data<-rnorm(100) a=data.frame(obs=test_data,condition='None') p1=qplot( data=a ,x=obs ,geom='histogram' )+coord_flip() p2=qplot( data=a ,y=obs ,x=c

Re: [R] sorting by creation time in ls()

2009-03-17 Thread Tony Plate
R doesn't keep track of when objects were created, so that's not possible. If this is important to you, you could look at the 'trackObjs' package, which does this and also stores individual objects in individual files (and writes them to the file when they are changed in R). -- Tony Plate Ale

Re: [R] Way to rotate a histogram?

2009-03-17 Thread Mike Lawrence
Using ggplot2: library(ggplot2) test_data<-rnorm(100) a=data.frame(obs=test_data,condition='None') p1=qplot( data=a ,x=obs ,geom='histogram' )+coord_flip() p2=qplot( data=a ,y=obs ,x=condition ,geom='boxplot' )+opts(

Re: [R] Requesting assistance installing ESS for R on Redhat

2009-03-17 Thread Marc Schwartz
On Mar 17, 2009, at 3:29 PM, steve_fried...@nps.gov wrote: I'm moving my R applications to a Redhat OS and want to install ESS. My sys admin has downloaded the rpm (emacs-common- ess-5.3.8-1.fc8.src.rpm), but when he tried to do the install he rec'd a number of warnings. We are not sure if

[R] Requesting assistance installing ESS for R on Redhat

2009-03-17 Thread Steve_Friedman
I'm moving my R applications to a Redhat OS and want to install ESS. My sys admin has downloaded the rpm (emacs-common-ess-5.3.8-1.fc8.src.rpm), but when he tried to do the install he rec'd a number of warnings. We are not sure if the warnings are telling us that the installation did not occur

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread Jason Rupert
Paul, This is great! Like you said it is really close. I made a few changes and for some reason the y-axis label magically came back. I tried to remove it but it wouldn't stay away. Also, for some reason the title exceeds the margins of the layout. I am going ot mess around with this a

Re: [R] Multilevel Modeling using R

2009-03-17 Thread Stas Kolenikov
In most biometric applications, those variances are treated as nuisance parameters. They only need to be controlled for, while the main purpose is to get the right point estimates and standard errors for the fixed effects. In social science multilevel modeling (of which education is probably the he

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread Paul Murrell
Hi Jason Rupert wrote: > I guess no reply means there is not an existing package to produce > the plot? > > I will post the results of my script to hopefully help others who are > trying to formulate the same plot. > > Thanks again. I don't know of an existing function that does that particul

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Berend Hasselman
Ravi Varadhan wrote: > > > require(BB) > > f2 <- function(x) { > f <- rep(NA, length(x)) > f[1] <- 1 + 2 * x[1] * x[3] # x[3] is the Lagrangian multiplier > f[2] <- 1 + 2 * x[2] * x[3] > f[3] <- x[1]^2 + x[2]^2 - 1 # the equality constraint > f > } > > You can also try my packag

[R] sorting by creation time in ls()

2009-03-17 Thread Alexy Khrabrov
When trying to remember what did I do in the session, especially after coming back to it after a few days, I'd like to mimic Unix's ls -ltrh -- does R retain the timing a certain variable is created? If not, would it make a useful addition, to have ls with an option to sort by creation tim

[R] Need a little help setting the upper median using "layout"...

2009-03-17 Thread Jason Rupert
The code I'm using is shown below. I would like to have a larger median at the top of the plot so that I can show the entirity of "title_text". Several times I tried messing with "par(mar", but that seemed to make matters worse. By any chance can anyone provide any insight as to the best

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Paul Smith
On Tue, Mar 17, 2009 at 7:10 PM, Ravi Varadhan wrote: > Here is how you can implement the Lagrangian multiplier approach and solve > the first-order KKT conditions to obtain the solution for Paul Smith's > example: > >        require(BB) > > f2 <- function(x) { > f <- rep(NA, length(x)) > f[1] <-

[R] RODBC changes data types when reading from MS SQL Server 2005 -- How to fix?

2009-03-17 Thread Seeliger . Curt
Folks, As reproduced in the code below, our data is being transformed during the sqlFetch() operation. This has apparently been an issue since 2002. Are there any ways for correctly reading data from MS SQL Server 2005? Why does RODBC ignore the type information supplied by SQL Server? req

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Ravi Varadhan
Here is how you can implement the Lagrangian multiplier approach and solve the first-order KKT conditions to obtain the solution for Paul Smith's example: require(BB) f2 <- function(x) { f <- rep(NA, length(x)) f[1] <- 1 + 2 * x[1] * x[3] # x[3] is the Lagrangian multiplier f[2] <- 1 +

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Ravi Varadhan
Lars, Here is how you can solve the example given by Paul using spg() in "BB" package. f <- function(x, lambda) x[1] + x[2] - lambda * (x[1]^2 + x[2]^2 - 1)^2 # look at how Penalized function is formulated eps <- Inf tol <- 1.e-05 p0 <- c(1, 1) lambda <- 0.1 # start with a small value for

Re: [R] Way to rotate a histogram?

2009-03-17 Thread David Winsemius
Can you reverse the x and y columns of the density object? plot(density(c(-20,rep(0,98),20))$y, density(c(-20,rep(0,98),20))$x, xlim = c(0,1), ylim=c(-4,4), type='l', lwd=3, col='red') -- David Winsemius On Mar 17, 2009, at 2:38 PM, Jason Rupert wrote: Awesome. This seems to

[R] AFT model

2009-03-17 Thread tsn4867
Hi, In the package survival, using the function survreg for AFT model, I only see 4 distributions for the response y: weibull, gaussian, logistic, lognormal and log-logistic, which correspond to certain distributions for the error terms. I'm wondering if there is a package or how to obta

[R] update on mcmcsamp for glmer

2009-03-17 Thread Tanja Srebotnjak
I've searched the help archives of both lists and apologize if I missed the answer to my question: Is there an update on developing mcmcsamp for glmer? I'm using R v. 2.7.2 (on our Unix server - will hopefully be updated soon) and 2.8.1 on my PC and get the message for both: gm1 <- glmer(cbind

Re: [R] Way to rotate a histogram?

2009-03-17 Thread Jason Rupert
Awesome. This seems to produce the vertical histogram as needed, but is there then a way to come back and add on a probability distribution line? That is, add something like the following to the barplot: points(density(x), type='l', lwd=3, col='red') Thanks again. --- On Tue, 3/17/09, Patr

Re: [R] package vars: save plots

2009-03-17 Thread David Winsemius
You do not mention your OS, so further details may be needed. Graphical output can be constrained by machine details. As a first step, why not try a format that has multiple page possibilities such as pdf ... this gives me 4 pages: pdf(file ="outtest.pdf") ?lm ctl <- c(4.17,5.58,5.18,6

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Paul Smith
Hi Lars, Consider the following problem: max x + y subject to x^2 + y^2 =1. The solution is obviously (x,y) = (sqrt(2) / 2, sqrt(2) / 2). Now, consider the unconstrained maximization problem on the variables x, y and lambda: max x + y + lambda * (x^2 + y^2 - 1) (Notice that the objective fu

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Levi Waldron
On Tue, Mar 17, 2009 at 12:54 PM, Bill Cunliffe wrote: > Thanks for your help. Part of the problem was that I thought I was > dealing with a data frame when it was actually an array. I forced all to be > matrices for consistency. However, I see that > > > > avGain <- rbind(avGain[1:(j-1),],b,a

[R] package vars: save plots

2009-03-17 Thread Koboltschnig, Rose-Gerd
hello, i use the vars package and would like to save the plots plotted with the plot method for objects with class attribute varest etc. so, if library(vars) data(Canada) var.canada <- VAR(Canada) then plot(var.canada) produces a plot for every of the four variable

Re: [R] 3d layering

2009-03-17 Thread Duncan Murdoch
On 3/17/2009 1:57 PM, kapo coulibaly wrote: Is it possible to render a volume like the one attached, in R using packages misc3d or rgl if I have the data for the individual surfaces (top and bottom for each layer). Your figure wasn't attached, but I'd guess the answer is yes. rgl allows you

[R] 3d layering

2009-03-17 Thread kapo coulibaly
Is it possible to render a volume like the one attached, in R using packages misc3d or rgl if I have the data for the individual surfaces (top and bottom for each layer). Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r

Re: [R] bigglm() results different from glm()

2009-03-17 Thread Thomas Lumley
Yes, the slow convergence is easier to get with the log link. Overshooting the correct coefficient vector has more dramatic effects on the fitted values and weights, and in this example the starting value of (0,0) is a long way from the truth. The same sort of thing happens in the Cox model

[R] Interview: Jon Peck on SPSS, R ,Python ...

2009-03-17 Thread Ajay ohri
Dear List, I recently got the chance to interview Jon Peck of SPSS Inc, a pioneering technical statistician working since 1983 (when there were only two substantial statistical software companies as per him ;) (not anymore ;) and currently he is a Principal Software Engineer and Technical Advisor

[R] initial value in 'vmmin' is not finite

2009-03-17 Thread Andreia Mendonça
Dear r helpers, I'm trying to run the models of the BIOMOD package and got this message: * Error in nnet.default (x, y, w,...): **initial value in 'vmmin' is not finite* What does this mean? and how can I correct it? Thank you *Andreia* [[alternative HTML version deleted]]

[R] A useful alternative to simple merging?

2009-03-17 Thread Frank E Harrell Jr
In the case of 1:1 merging with distinct sets of non-ID variables in two or more datasets, would the following code, which doesn't need to form the larger merged data frame, be useful or faster? [A generalization of with() would make this even better. I've often wondered about the utility of

Re: [R] Need to build package for Affy HT HG-U133+ PM arrays

2009-03-17 Thread James W. MacDonald
This question is better asked on the Bioconductor list (bioconduc...@stat.math.ethz.ch). James Mcininch wrote: I would like to build a package for the HT HG-U133+ PM arrays from affy, but I can't find any good documentation on how to go about it. Naively using makecdfenv's make.cdf.package()

[R] Std.Error in Analysis of Deviance Table

2009-03-17 Thread Alexander Jüterbock
Hello, I would be pleased if you could help me in determining the standard error of the estimate for “place2L1.N2” from the following table: Call: glm(formula = y ~ places2 + shellheight, family = quasibinomial) Deviance Residuals: Min1QMedian3Q Max -3.41415 -

Re: [R] breaking ties in order() based on many vectors

2009-03-17 Thread Levi Waldron
On Tue, Mar 17, 2009 at 12:56 PM, Patrick Burns wrote: > Use 'do.call' as discussed in 'The R Inferno' > and elsewhere. Perfect, thanks. -- Levi Waldron post-doctoral fellow Jurisica Lab, Ontario Cancer Institute Division of Signaling Biology IBM Life Sciences Discovery Centre TMDT 9-304D 101

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Bill Cunliffe
Thanks for your help. Part of the problem was that I thought I was dealing with a data frame when it was actually an array. I forced all to be matrices for consistency. However, I see that avGain <- rbind(avGain[1:(j-1),],b,avGain[(j+1):nrow(avGain),]) would be a great solution as posit

[R] breaking ties in order() based on many vectors

2009-03-17 Thread Levi Waldron
The order() function allows you to specify multiple vectors, which are used successively to break ties. If I want to use many vectors to break ties (say, 25 or more), that are columns of a matrix or elements of a list, does anyone know a shortcut to do this without passing 25 arguments to order()?

Re: [R] permutations in R

2009-03-17 Thread Greg Snow
No, I meant the Combinations package, it is apparently an Omegahat package (http://www.omegahat.org/Combinations/). It looks similar to the permn function as far as the usage goes, but the documentation includes additional information on other resources. -- Gregory (Greg) L. Snow Ph.D. Statis

Re: [R] Merging

2009-03-17 Thread Keith Jewell
OK, I can't see anything wrong with that. a) post the results of ... > sessionInfo() ... so we can check you're using a reasonably up to date system b) send a copy of your data set to me at... k.jewell at campden.co.uk ... and I'll see if I can reproduce your error. I can take most common da

Re: [R] Combining Sweave and fancyvrb

2009-03-17 Thread Andrew Ellis
try this: create a file called mySweave.sty, containing the following code: \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{mySweave}{} \RequirePackage{ifthen} \newboolean{swe...@gin} \setboolean{swe...@gin}{true} \newboolean{swe...@ae} \setboolean{swe...@ae}{true} \RequirePackage{ifthen} \RequirePack

Re: [R] Way to rotate a histogram?

2009-03-17 Thread Patrizio Frederic
Jason, be carefully to the order of intensities (counts or densities): x=rnorm(1000) par(mfrow=c(2,2)) h=hist(x,breaks=bk<-c(-5,-3,-2,-1,-.5,0,1,3,5)) barplot(rev(h$intensities),rev(bk[2:9]-bk[1:8]),space=0,horiz=T) # compare to axis(2) barplot(h$intensities,bk[2:9]-bk[1:8],space=0,horiz=T) axis(2

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread stephen sefick
I don't know if this will help, but look at the R graph gallery. There may be something there, with code, that will work. On Tue, Mar 17, 2009 at 10:39 AM, Jason Rupert wrote: > > I guess no reply means there is not an existing package to produce the plot? > > I will post the results of my script

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Levi Waldron
Your first example that works would just repeat the atomic vector to the length of the row. To replace a row with another data frame, you could use rbind: avGain <- rbind(avGain[-j,],b) Or if the positioning is important, 2) avGain <- rbind(avGain[1:(j-1),],b,avGain[(j+1):nrow(avGain),]) I didn

Re: [R] Multilevel Modeling using R

2009-03-17 Thread Doran, Harold
That's by intent, by the way. The standard errors of the variance components are only useful if the distribution is symmetric, and this is not always true. If you were using lmer, and not lme, then you could use the mcmcsamp function to look at the distribution of the random effects to see if it is

Re: [R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread stephen sefick
not off the top of my head, but if you provide a reproducible example (cut and paste into R) then I may be able to help you. On Tue, Mar 17, 2009 at 10:44 AM, Bill Cunliffe wrote: > I have the following data frames, avGain and retGain.  They have the same > dimensions. > > > > The following line

[R] the quote problem with readLines()

2009-03-17 Thread Dongyan Song
Dear all, I read a file with all numbers with readLines function, as below, > f <- file("data.txt") > a <- readLines(f) but all the values in a are in format "", and I cannot do the calculation with them since they are not numeric. I wonder how should I skip those quotes, thank you for help!

Re: [R] Get user system name

2009-03-17 Thread Paolo Sonego
UNIX only (At least it works under Linux and Mac OS X): (user <- system("users", intern=T)) Paolo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide

[R] Multilevel Modeling using R

2009-03-17 Thread WONG, Ka Yau
Dear experts, I use R to conduct multilevel modeling. However, I have a problem about the interpretation of random effect. Unlike the variables in fixed effects, the variables in random effects have not shown the standard error (s.e.) and p-value, so I don't know whether the

[R] Help with R.oo's Rdoc$compile()

2009-03-17 Thread Ken Feng
Does anyone have a sample file with an example/template for Rdoc (as implemented in R.oo)? The command I am using is Rdoc$compile(), but I am having difficulties figuring out what the Macros look like. Apparently, in the headers, I see that I should use one of: # @RdocClass className # @RdocMeth

Re: [R] Way to rotate a histogram?

2009-03-17 Thread David Winsemius
I believe that hist will return a vector that could be passed to barplot: h.islands <- hist(islands) > barplot(h.islands$intensities, horiz=TRUE) # or > barplot(h.islands$counts, horiz=TRUE) David Winsemius On Mar 17, 2009, at 11:38 AM, Jason Rupert wrote: Here is what I have so far:

[R] Combining Sweave and fancyvrb

2009-03-17 Thread Giovanni Petris
I find Sweave very useful and I was trying to combine it with the latex package fancyvrb. I was trying to get line numbering and labels in order to reference the lines where particular commands occur. Unfortunately, I haven't been able to figure out how to do it. Maybe somebody can help me. The

[R] Way to rotate a histogram?

2009-03-17 Thread Jason Rupert
Here is what I have so far: > test_data<-rnorm(100) > par(mfrow=c(1,3)) # 3 rows by 1 columns layout of plots > hist(test_data) > boxplot(test_data) > qqnorm(test_data) I noticed that I can rotate a boxplot via "horizontal", but apparently "hist" does not have that functionality. I tried stack

Re: [R] Merging

2009-03-17 Thread Tammy Ma
My data frame is: > str(act_data12) 'data.frame': 1687 obs. of 5 variables: $ Date: chr "2006-02-22" "2006-02-22" "2006-02-22" "2006-02-22" ... $ Dtime : chr "14:36:10" "14:36:11" "14:36:12" "14:37:38" ... $ FocusApp_seq: chr "useractivity_act" "4" "3" "0" ... $ App_duratio

[R] Need to build package for Affy HT HG-U133+ PM arrays

2009-03-17 Thread James Mcininch
I would like to build a package for the HT HG-U133+ PM arrays from affy, but I can't find any good documentation on how to go about it. Naively using makecdfenv's make.cdf.package() causes R to seg-fault. I'm unfamiliar with the CDF format as such, but I'm guessing that it's changed somewhat be

Re: [R] matching vectors

2009-03-17 Thread jim holtman
You can use something like this to make sure that h2 is a subset of h1 in consecutive order: > h1 <- 1:50 > h2 <- 25:30 > hm <- match(h2, h1) > all(diff(hm) == 1) [1] TRUE > On Tue, Mar 17, 2009 at 6:42 AM, emj83 wrote: > > I have two numerical vectors; hun2 is a subset of hun1: > >> hun1 >  [

Re: [R] Merging

2009-03-17 Thread Keith Jewell
In case it helps, this refers to the columns by position rather than name... > aggregate(aDF[,4], by=aDF[,-4], sum) It sums the fourth column (I'm guessing this is what Tammy meant by "merge") for unique combinations of all columns except the fourth. It doesn't need the column names inside the ag

[R] RES: set a legend with an "image" graph

2009-03-17 Thread Rodrigo Aluizio
Luis, take a look at the ?legend function, it can produce almost any kind of legend you may need! Hope It helps. Rodrigo. -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Luis Ridao Cruz Enviada em: terça-feira, 17 de março de 2009 11:

Re: [R] R package to automatically produce combination plot?

2009-03-17 Thread Jason Rupert
I guess no reply means there is not an existing package to produce the plot? I will post the results of my script to hopefully help others who are trying to formulate the same plot. Thanks again. --- On Mon, 3/16/09, Jason Rupert wrote: > From: Jason Rupert > Subject: [R] R package to aut

Re: [R] RES: set a legend with an "image" graph

2009-03-17 Thread Luis Ridao Cruz
R-help, I'm sorry that I said " I don't have idea ". What I mean t is that I just don't know how to set a legend when "image" is called. Thanks in advance __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

[R] Difficulty Replacing a Row of a Data Frame

2009-03-17 Thread Bill Cunliffe
I have the following data frames, avGain and retGain. They have the same dimensions. The following line of code replaces row j of avGain as desired: avGain[j, ] <- mean( retGain[jStart:j, ] ) However, the following line does not work: avGain[j, ] <- ( avGain[j-1, ] * ( DAYS - 1 ) +

Re: [R] Merging

2009-03-17 Thread Keith Jewell
Looks as if you copied my code without modifying to suit your data frame. My data frame (aDF) had column names V1, V2, V3, V4 > str(aDF) 'data.frame': 12 obs. of 4 variables: $ V1: chr "2006-02-22 16:28:18" "2006-02-22 16:28:26" "2006-02-22 16:28:28" "2006-02-22 16:28:31" ... $ V2: Factor w

[R] set a legend with an "image" graph

2009-03-17 Thread Luis Ridao Cruz
R-help, I have an image plot and I wish to set a legend to it but I don't have an idea how to do it. Below it's the code line. image(yyy, col = rev(heat.colors(10)), axes = T) Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.c

Re: [R] Merging

2009-03-17 Thread Tammy Ma
Thanks. Actually, I have been trying many time using method from KJ, There is always the following information coming up or Rgui exit without reason.. I have no idea about this? gh<-with(act_data12, aggregate(V4, by=list(V1,V2,V3), sum)) Error in unlist(y, recursive = FALSE) : promise alrea

Re: [R] bigglm() results different from glm()

2009-03-17 Thread John Fox
Dear Francisco, I was able to duplicate the problem that you reported, and in addition discovered that the problem seems to be peculiar to the poisson family. lm(y~ttment, data=dat) and biglm(y~ttment, data=dat) produce identical results, as do glm(y~ttment, data=dat) and bigglm(y~ttment, data=dat

[R] coefficient graph

2009-03-17 Thread Sachi Ito
Dear R list members, I'd like to make a graph of coefficients of the intercept, variable 1, and variable 2 (and possibly the interaction between variable 1 and variable 2). When I use the lmList function as attached below, it shows a nice coefficient graph. > PACRP.lis <- lmList(PAffect ~ CRPC +

Re: [R] Merging

2009-03-17 Thread Annette Heisswolf
Tammy, You won't get more help if you post this again every half an hour... I don't quite understand what you exactly want to do, but it seemed at least to me that Keith's suggestion (see again below) pretty much does what you want. If not, could you please specify *EXACTLY* what you want to do

Re: [R] Non-Linear Optimization - Query

2009-03-17 Thread Ravi Varadhan
Hi Lars, The approach suggested by Paul Smith is one way to try and solve your problem. Another aproach is to try and eliminate, if possible, one of the variables using the equality constraint, so that the problem now become unconstrained in (p-1) dimensions (where p is the original dimension

Re: [R] Merging

2009-03-17 Thread Tammy Ma
I still couldn't solve itany help would be preciated! Tammy > From: metal_lical...@live.com > To: r-help@r-project.org > Date: Tue, 17 Mar 2009 11:49:10 +0200 > Subject: [R] Merging > > > Hi, All. > > > I have a data frame with the part as : > > . > 1422006-02-22 16:28

Re: [R] Best way to do temporal joins in R?

2009-03-17 Thread Gabor Grothendieck
In thinking about this some more an SQL solution would be a bit easier. Try this where species and temp are from the prior post (i.e. after processing with chron). The first statement finds the minimum distances for each species and station_id combination. The second finds all combinations of a

  1   2   >