[R] Mean(s) from values in different row?

2011-10-05 Thread SML
Hello: Is there a way to get a mean from values stored in different rows? The data looks like this: YEAR-1, JAN, FEB, ..., DEC YEAR-2, JAN, FEB, ..., DEC YEAR-3, JAN, FEB, ..., DEC What I want is the mean(s) for just the consecutive winter months: YEAR-1.DEC, YEAR-2.JAN, YEAR-2.FEB YE

Re: [R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-05 Thread Prof Brian Ripley
A more portable way (that function only works in some versions of R) is as.POSIXct(1317857320, origin="1970-01-01") possibly with a 'tz' argument if you need to restore the timezone. On Wed, 5 Oct 2011, jim holtman wrote: Here is what I use: unix2POSIXct(1317857320) [1] "2011-10-05 19:28:40

Re: [R] [R-SIG-Finance] AsOf join in R

2011-10-05 Thread Ulrich Staudinger
A bit late, but here is what I always do: m = merge(bid, ask, tick) m<- interpNA(m, method="before") intrepNA can also interpolate NAs in different ways, for example linearly. Hth, Ulrich Am 06.10.2011 03:08, schrieb Robert A'gata: Hi Roupell, Yes I am aware of RTAQ function matchTradesQu

Re: [R] Titles changing when a plot is redrawn

2011-10-05 Thread Yihui Xie
I think the problem is your str1 is an unevaluated expression and will change with the value of i. You should be able to get a fixed title by this: par(mfrow = c(2, 1)) for (i in 1:2) { x <- 1:100 rmse <- sin(x/5) # fake data plot(x, rmse, main = substitute(list(RMSE(theta), i == z),

Re: [R] aggregate function with a dataframe for both "x" and "by"

2011-10-05 Thread David Winsemius
On Oct 5, 2011, at 7:45 PM, Eva Powers wrote: I have 2 dataframes. "mydata" contains numerical data. "mybys" contains information on the "group" each row of the data is in. I wish to aggregate each column in mydata using the corresponding column in mybys. corresponding? Please see th

Re: [R] reporting multiple objects out of a function

2011-10-05 Thread Gabor Grothendieck
On Wed, Oct 5, 2011 at 12:27 AM, andrewH wrote: > Dear folks, > > I’m trying to build a function to create and make available some variables I > frequently use for testing purposes.  Suppose I have a function that takes > some inputs and creates (internally) several named objects. Say, > > fun1 <-

Re: [R] counts in quantiles in and from a matrix

2011-10-05 Thread Dennis Murphy
Hi: Here's one way: m <- matrix(rpois(100, 8), nrow = 5) f <- function(x) { q <- quantile(x, c(0.1, 0.9), na.rm = TRUE) c(sum(x < q[1]), sum(x > q[2])) } t(apply(m, 1, f)) HTH, Dennis On Wed, Oct 5, 2011 at 8:11 PM, Ben qant wrote: > Hello, > > I'm trying to get the count of value

[R] counts in quantiles in and from a matrix

2011-10-05 Thread Ben qant
Hello, I'm trying to get the count of values in each row that are above and below quantile thresholds. Thanks! Example: > x = matrix(1:30,5,6) > x [,1] [,2] [,3] [,4] [,5] [,6] [1,]16 11 16 21 26 [2,]27 12 17 22 27 [3,]38 13 18 23 28 [4,]4

[R] Titles changing when a plot is redrawn

2011-10-05 Thread John Nolan
I ran into a problem with titles on graphs. I wanted a graph with multiple subplots, with each having a title that involved both a Greek letter and an identifier for each graph. Below is a simplified version of code to do this. The graph appears fine, with the first graph having "i=1" in the ti

Re: [R] Entering data into a multi-way array?

2011-10-05 Thread Victoria_Stuart
Solution: I figured this out on my own (below). > gnames<-read.csv("/home/victoria/R/gnames.csv",header=FALSE,sep=",") > gnames V1V2V3V4V5 V6V7 1 NM_005588 NM_004407 NM_006136 NM_004817 NM_006012 NM_001008693 NM_181435 [snip] V497

Re: [R] [R-SIG-Finance] AsOf join in R

2011-10-05 Thread Roupell, Darko
Btw tweaking MatchTradesQuotes should not be an issue and its easy to accommodate any data format that is passed through in xts object. At least that's what I did with RTAQ package - used it as a shell to create unique functions that suit data format for intra-day tick flow from ASX. Hope th

Re: [R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-05 Thread Jeff Newmiller
This game you are playing is quite dangerous, and I recommend that you avoid this assiduously. Look at the lubricate library or use the chron or Date classes. Timestamps are rather poor candidates for numeric operations, and the vagaries of timezones are quite a headache. ---

Re: [R] aggregate function with a dataframe for both "x" and "by"

2011-10-05 Thread Dennis Murphy
Hi: It's a little tricky to read in a data frame 'by hand' without making NA a default missing value; you've got to trick it a bit. I'm doing this inefficiently, but if you have the two 'real' data sets stored in separate files, read.table() is the way to go since it provides an option for definin

Re: [R] Difficulty with lme

2011-10-05 Thread Ben Bolker
Kevin Wright gmail.com> writes: > > Generally, the only way to estimate f1:f2 is if you have all combinations of > data present for these two factors. Well, he said it was unbalanced, he didn't say how unbalanced -- i.e. it's not clear (to me) whether there are any completely missing cells or

Re: [R] [R-SIG-Finance] AsOf join in R

2011-10-05 Thread Robert A'gata
Darko - Looking at it carefully. Yes, you're right. It's still native R code function. I know how to proceed now. Thanks. On Wed, Oct 5, 2011 at 9:22 PM, Roupell, Darko wrote: > Btw tweaking MatchTradesQuotes should not be an issue and its easy to > accommodate any data format that is passed thr

Re: [R] Subsetting question

2011-10-05 Thread jim holtman
Does this do what you want: > data1 A B 1 1 a 2 1 b 3 2 c 4 2 d > data2 D E F 1 x y 1 2 w z 2 > data1.1 <- aggregate(data1$B, list(data1$A), FUN=paste, collapse=',') > data1.1 Group.1 x 1 1 a,b 2 2 c,d > merge(data2, data1.1, by.x="F", by.y="Group.1") F D E x 1 1 x y a,b 2

Re: [R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-05 Thread jim holtman
Here is what I use: unix2POSIXct(1317857320) [1] "2011-10-05 19:28:40 EDT" unix2POSIXct <- function (time) structure(time, class = c("POSIXt", "POSIXct")) On Wed, Oct 5, 2011 at 7:38 PM, Mike Williamson wrote: > Hi, > >    In short, I would like to know if there is any way to convert a num

Re: [R] [R-SIG-Finance] AsOf join in R

2011-10-05 Thread Robert A'gata
Hi Roupell, Yes I am aware of RTAQ function matchTradesQuotes. But my time series does not follow the TAQ format like they suggest. So I gave it a try and find that it doesn't work. In particular, my time series contain full level 2 order book and trades. I want to do asof join of the book to the

Re: [R] Issue with read.csv treatment of numerics enclosed in quotes (and a confession)

2011-10-05 Thread Sarah Goslee
Hi Chris, Yes, you're missing something: the colClasses argument to read.csv. Given a tiny little csv file that looks like this: 1,2,3,"01234" 4,5,6,"00011" 7,8,0,"0" > testdata <- read.csv("testdata.csv", header=FALSE, colClasses=c(NA, NA, NA, > "character")) > testdata V1 V2 V3V4 1

Re: [R] kriging shapefiles

2011-10-05 Thread Michael Sumner
It is perhaps easier than you think, see the example in gstat: library(gstat) ?krige After this is run "meuse" is a SpatialPointsDataFrame: coordinates(meuse) = ~x+y Any point shapefile read with readOGR from rgdal (or the alternative functions in maptools) will also be SpatialPointsDataFrames,

[R] Issue with read.csv treatment of numerics enclosed in quotes (and a confession)

2011-10-05 Thread Chris Conner
Dear Help-Rs,   I've been dealing with this problem for some time, using a work-around to deal with it. It's time for me to come clean with my ineptitude and seek a what has got to be a more streamlined solution from the Help-Rverse.   I regularly import delimited text data that contains numerics

[R] Help with wireframe graphics problem (newbie)

2011-10-05 Thread David Wiley
All, I've read several tutorials re: generating wireframes, but am clearly missing something. I have data along the lines of: > tbl [1:10,] Visits Activity Course.Grade 1 17218.31 2 7 1120.67 3 9 1724.69 4 28 7138.

Re: [R] cuhre usage ?? multidimensional integration

2011-10-05 Thread sevenfrost
cuhre is a function in package R2Cuba for multidimensional integration. There are three kind of variables to integrate. I just use y,w,t to distinguish them from each other. Is there any problem ? -- View this message in context: http://r.789695.n4.nabble.com/cuhre-usage-multidimensional-integra

[R] Dealing with proportions

2011-10-05 Thread Sam
Dear list, I have very little experience in dealing with proportions, i am sure this is a very simple question but i could find no suitable answer beyond doing a chi-sq test and then using the Marascuilo procedure as a post-hoc analysis. I am simply wanting to know if the proportions ( i.e the

[R] unique possible bug

2011-10-05 Thread Patrick McCann
Hi, I am trying to read in a rather large list of transactions using the arules library. It seems in the coerce method into the dgCmatrix, it somewhere calls unique. Unique.c throws an error when n > 536870912; however, when 4*n was modified to 2*n in 2004, the overflow protection should have cha

[R] aggregate function with a dataframe for both "x" and "by"

2011-10-05 Thread Eva Powers
I have 2 dataframes. "mydata" contains numerical data. "mybys" contains information on the "group" each row of the data is in. I wish to aggregate each column in mydata using the corresponding column in mybys. Please see the example below. What is a more elegant or "better" way to accomplish

[R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-05 Thread Mike Williamson
Hi, In short, I would like to know if there is any way to convert a numeric into a date, similar to how strptime() can convert a string to a date time class? There are some functions, etc. which don't work well with dates, and tend to force them into numerics. I understand that the numbe

[R] Subsetting question

2011-10-05 Thread darkgaze
Hi all, Suppose I have data1 A B 1 a 1 b 2 c 2 d and data2 D E F x y 1 w z 2 and I want data2 D E F G x y 1 a,b w z 3 c,d I am trying data2$G=list(data1$B[data1$A==data2$F,]) How do I correct this approach? -- View this message in context: http://r.789695.n4.nabble.com/Subsetting-questi

Re: [R] dynamically creating functions in r

2011-10-05 Thread Carl Witthoft
Another way to build functions "from scratch" : > func<-'x^2+5' > funcderiv<- D(parse(text=func), 'x') ) > newtparam <- function(zvar) {} > body(newtparam)[2] <- parse(text=paste('newz <- (',func,')/eval(funcderiv)',collapse='')) > body(newtparam)[3] <- parse(text=paste('return(invisible

Re: [R] R CMD check

2011-10-05 Thread Jeff Breiwick
Richard M. Heiberger temple.edu> writes: > > The next thing to check is this item from doc/manual/R-exts.html > > Quoted strings within R-like text are handled specially... > > My guess is that the problem is occuring in the .Rd file, not in the .R > file. > > Remove the line, or double t

Re: [R] R CMD check

2011-10-05 Thread Richard M. Heiberger
The next thing to check is this item from doc/manual/R-exts.html Quoted strings within R-like text are handled specially... My guess is that the problem is occuring in the .Rd file, not in the .R file. Remove the line, or double the "\" characters. Rich On Wed, Oct 5, 2011 at 5:37 PM, Jeff

Re: [R] R CMD check

2011-10-05 Thread Jeff Breiwick
Jeff Breiwick noaa.gov> writes: > > Dear R-Group, > > I have a function that sorts a data frame and oneo of the lines in the > function is: > > vars <- unlist(strsplit(formc, "[\\+\\-]")) > > The function works fine and the above line is always reached. However, when I > include the functi

Re: [R] subplot strange behavoir

2011-10-05 Thread emorway
I tried this trick, and clearly things are not going in the right direction. It seems 'layout' is at the root of my frustration, so I can make two plots and marge them in adobe illustrator (or something similar). png("c:/temp/lookat.png",res=120,height=600,width=1200) layout(matrix(c(1,2),2,2,byr

Re: [R] Party extract BinaryTree from cforest?

2011-10-05 Thread Chris
I found an internal workaround to this to support printing and plot type simple, tt<-party:::prettytree(cf at ensemble[[1]], names(cf at data at get("input"))) > npt <- new("BinaryTree") > npt@tree<-tt > plot(npt) Error in terminal_panel() : âctreeobjâ is not a regression tree > plot(npt, type="

Re: [R] do calculations as defined by a string / expandmathematical statements in R

2011-10-05 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Martin Batholdy > Sent: Wednesday, October 05, 2011 2:10 PM > To: R Help > Subject: Re: [R] do calculations as defined by a string / > expandmathematical statements in R > > Thank

Re: [R] R CMD check

2011-10-05 Thread Duncan Murdoch
On 05/10/2011 4:46 PM, Jeff Breiwick wrote: Dear R-Group, I have a function that sorts a data frame and oneo of the lines in the function is: vars<- unlist(strsplit(formc, "[\\+\\-]")) The function works fine and the above line is always reached. However, when I include the function in a packa

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread R. Michael Weylandt
# Changing to variable Z since array() is a function apply(Z.temp <- Z[,,,a:b],1:3,sum)/dim(Z.temp)[4] # Should work, though it may be more clear to define Z.temp in its own line M On Wed, Oct 5, 2011 at 5:10 PM, Martin Batholdy wrote: > Thanks for all the suggestions! > > > > Perhaps my post wa

Re: [R] reporting multiple objects out of a function

2011-10-05 Thread andrewH
Thanks, Sina! This is very helpful and informative, but still not quite what I want. So, here is the thing: When a function returns an object, that object is available in the calling environment. If it is returned inside a function, it is available in the function, but not outside of the function

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread Martin Batholdy
Thanks for all the suggestions! Perhaps my post was not clear enough. apply(array,1:2,sum)/dim(array)[3] and # reproducible example x <- 1:1000 dim(x)<-rep(10,3) # code apply(x,1:2,sum) would give me the mean over one whole dimension, right? The problem with that is, that I just want to c

Re: [R] subplot strange behavoir

2011-10-05 Thread emorway
Hello Greg, Session info is below. Running Win7 64-bit. I just upgraded my version of R and tried rerunning the code and got the same odd result. I, too, get an expected result when I create the plot in the R GUI. The problem crops up only when I try and create the plot in png() or tiff(). Pe

[R] R CMD check

2011-10-05 Thread Jeff Breiwick
Dear R-Group, I have a function that sorts a data frame and oneo of the lines in the function is: vars <- unlist(strsplit(formc, "[\\+\\-]")) The function works fine and the above line is always reached. However, when I include the function in a package and run "R CMD check pkgname" it gives t

Re: [R] Display a contingency table on the X11 device

2011-10-05 Thread Dennis Murphy
Thanks, Baptiste. I was looking for tableplot() or something like it and thought textplot() was doing something different. Appreciate the correction. Dennis On Wed, Oct 5, 2011 at 1:29 PM, baptiste auguie wrote: > On 6 October 2011 09:23, Dennis Murphy wrote: >> Hi: >> >> One option is the grid

Re: [R] Difficulty with lme

2011-10-05 Thread Kevin Wright
Generally, the only way to estimate f1:f2 is if you have all combinations of data present for these two factors. Sometimes it makes sense to include f1:f2 as a random effect in the model (which does NOT need balanced data) but that is something you have to decide. Kevin On Wed, Oct 5, 2011 at 2

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread R. Michael Weylandt
Actually, this may just be a typo in your first post, but if you actually want to do this calculation: (array[,,1] + array[,,2] + array[,,3] + array[,,4] + array[,,5] + array[,,6] + array[,,7] + array[,,8]) / 8 Wouldn't this work? apply(array,3,sum)/dim(array)[3] On Wed, Oct 5, 2011 at 4:22 PM

Re: [R] subplot strange behavoir

2011-10-05 Thread Greg Snow
When I copy and paste your code I get what is expected, the 2 subplots line up on the same y-value. What version of R are you using, which version of subplot? What platform? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > --

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread R. Michael Weylandt
Sorry!! meant: apply(array,1:2,sum)/dim(array)[3] M On Wed, Oct 5, 2011 at 4:31 PM, R. Michael Weylandt wrote: > Actually, this may just be a typo in your first post, but if you > actually want to do this calculation: > > (array[,,1] + array[,,2] + array[,,3] + array[,,4] + array[,,5] + > array

Re: [R] Display a contingency table on the X11 device

2011-10-05 Thread baptiste auguie
On 6 October 2011 09:23, Dennis Murphy wrote: > Hi: > > One option is the gridExtra package - run the example associated with > the tableGrob() function. Another is the addtable2plot() function in > the plotrix package. I'm pretty sure there's at least one other > package that can do this; I thoug

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread Jean-Christophe BOUËTTÉ
Hi, are you looking for # reproducible example x <- 1:1000 dim(x)<-rep(10,3) # code apply(x,1:2,sum) note that ?apply works with many functions... 2011/10/5 Martin Batholdy : > Dear R-group, > > > is there a way to perform calculations that are defined in a string format? > > > for example I h

Re: [R] Needed help with 3 factor anova !!!

2011-10-05 Thread Kevin Wright
For example, library(agridat) ?gomez.stripsplitplot Kevin Wright On Wed, Oct 5, 2011 at 3:13 PM, Dennis Murphy wrote: > Try Googling 'Three factor ANOVA R'; it didn't take long to find a few > relevant hits. > > Dennis > > On Wed, Oct 5, 2011 at 10:56 AM, rafal wrote: > > I am a student fro

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread R. Michael Weylandt
Didn't three of us give you a function (in various flavors) that would do the mean for variable inputs, reading them from a list? (Though David's was admittedly much cooler than mine!) Anyways, look into parse(text=do) with eval() if you want to go the string route. Michael On Wed, Oct 5, 2011 a

Re: [R] Display a contingency table on the X11 device

2011-10-05 Thread Dennis Murphy
Hi: One option is the gridExtra package - run the example associated with the tableGrob() function. Another is the addtable2plot() function in the plotrix package. I'm pretty sure there's at least one other package that can do this; I thought it was in the gplots package, but couldn't find one tha

Re: [R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread William Dunlap
Avoid parsing strings to make expressions. It is easy to do, but hard to do safely and readably. In your case you could make a short loop out of it result <- x[,,,1] for(i in seq_len(dim(x)[4])[-1]) { result <- result + x[,,,i] } result <- result / dim(x)[4] Bill Dunlap Spotfi

Re: [R] white on black theme for ggplot2

2011-10-05 Thread baptiste auguie
Hi, there are a couple of themes proposed in the wiki, one being white on black, https://github.com/hadley/ggplot2/wiki/Themes HTH, baptiste On 6 October 2011 04:05, Eugene Kanshin wrote: > Hello, > I'm trying to produce some plots in ggplot2 to use them on > the dark-blue gradient background

[R] do calculations as defined by a string / expand mathematical statements in R

2011-10-05 Thread Martin Batholdy
Dear R-group, is there a way to perform calculations that are defined in a string format? for example I have different variables: x1 <- 3 x2 <- 1 x4 <- 1 and a string-variable: do <- 'x1 + x2 + x3' Is there any way to perform what the variable 'do'-describes (just like the formula-element

Re: [R] Needed help with 3 factor anova !!!

2011-10-05 Thread Dennis Murphy
Try Googling 'Three factor ANOVA R'; it didn't take long to find a few relevant hits. Dennis On Wed, Oct 5, 2011 at 10:56 AM, rafal wrote: > I am a student from Poland. What I am interested in is 3 factor anova with R. > Could you please help me find an example with using this method with R? > W

Re: [R] Variability plot in R

2011-10-05 Thread Joseph Boyer
Dennis, Thank you for your reply. This is a good start for what I want to achieve. -- Joe -Original Message- From: Dennis Murphy [mailto:djmu...@gmail.com] Sent: Friday, May 20, 2011 10:55 PM To: Joseph Boyer Cc: r-help@r-project.org Subject: Re: [R] Variability plot in R Here's one at

Re: [R] subplot strange behavoir

2011-10-05 Thread Sarah Goslee
Hi, I'm assuming you're using subplot() from Hmisc, but it's a good idea to specify. It's not subplot() that's causing the problem, it's layout, or rather the interaction between the two. This section run at the command line doesn't work: layout(matrix(c(1,2),2,2,byrow=TRUE),c(1.5,2.5),respect=T

Re: [R] cuhre usage ?? multidimensional integration

2011-10-05 Thread R. Michael Weylandt
Perhaps you should start by writing vectorized code; as it stands, your code suggests you don't understand what simple operations like y <- x actually do. More to your question: what are cuhre & crff ? They are not in base R nor in any packages I have current loaded. Michael On Wed, Oct 5, 201

Re: [R] calling a variable which in turn calls many more variables

2011-10-05 Thread Bert Gunter
Ista: But I think the problem here is how to update the model formula. I see no "simple" way to do that (it can be done straightforwardly enough, but I wouldn't consider it simple). ... But perhaps what you meant is to update the data argument like this: cntrl <- data.frame(...) ##response + un

Re: [R] dynamically creating functions in r

2011-10-05 Thread William Dunlap
Creating expressions and functions dynamically can be tricky. Usually I use functions like call(), substitute(), and formals(); very occasionally I use parse(text=). Here is one way to make a family of functions that differ only in the default value their their argument: > funsA <- lapply(1:3,

Re: [R] Subsetting a data frame with multiple values and exclusions.

2011-10-05 Thread Dennis Murphy
Hi: Is this what you're after? f <- function(x) !any(x %in% terms_exclude) && any(x %in% terms_include) db[apply(db[, -1], 1, f), ] ind test1 test2 test3 2 ind2 227 28.0 4 ind4 3 2 1.2 HTH, Dennis On Wed, Oct 5, 2011 at 8:53 AM, natalie.vanzuydam wrote: > Hi all, > > I

[R] subplot strange behavoir

2011-10-05 Thread emorway
Hello, Below is some example code that should reproduce an error I'm encountering while trying to create a tiff plot with two subplots. If I run just the following bit of code through the R GUI the result is what I'd like to have appear in the saved tiff image: x<-seq(0:20) y<-c(1,1,2,2,3,4,5,4

Re: [R] calling a variable which in turn calls many more variables

2011-10-05 Thread Ista Zahn
Hi Justin, On Wed, Oct 5, 2011 at 3:32 PM, justin jarvis wrote: > Hi all, > I am running regressions with many covariates, most of which remain the same > each time (control variables).  Instead of writing 30 demographic variables > every regression, is there a way I could call them all at once u

Re: [R] creating a loop for a function

2011-10-05 Thread R. Michael Weylandt
lapply(1:10, function(i) Box.test (lfut, lag = i, type="Ljung")) Add extractors to get statistics as desired. Michael Weylandt On Wed, Oct 5, 2011 at 1:09 PM, upananda pani wrote: > Dear All, > > I want to create a loop within a function r. The example follows: > > Box.test (lfut, lag = 1, type

[R] calling a variable which in turn calls many more variables

2011-10-05 Thread justin jarvis
Hi all, I am running regressions with many covariates, most of which remain the same each time (control variables). Instead of writing 30 demographic variables every regression, is there a way I could call them all at once using a variable called, perhaps "demog"? I have tried: > demog <- list(ag

Re: [R] A question about R image function

2011-10-05 Thread Sarah Goslee
Hi, On Wed, Oct 5, 2011 at 1:44 PM, JeffND wrote: > Dear folks, > > I have a question about the image() function in R. I found the following > link talking about this > but the replies didn't help with my situations. > > http://r.789695.n4.nabble.com/question-on-image-function-td839275.html#a8392

Re: [R] SPlus to R

2011-10-05 Thread Bert Gunter
Consider: > f <- function(x){ x<- 10;x^2} > f() [1] 100 If the argument is not needed, there is no error in omitting it. R uses "lazy evaluation" -- arguments are not evaluated until needed. -- Bert On Wed, Oct 5, 2011 at 8:54 AM, Scott Raynaud wrote: > It seems I have things set up correctly

Re: [R] variance ratio test

2011-10-05 Thread Sarah Goslee
Hi, Searching on http://www.rseek.org for "variance ratio test" turns up the vrtest package, as does searching for Lo and Mackinlay, suggesting that's a good place to start. Sarah On Wed, Oct 5, 2011 at 2:48 PM, rauf ibrahim wrote: > Hello, > I am looking for a code in R for the variance ratio

Re: [R] dynamically creating functions in r

2011-10-05 Thread Duncan Murdoch
On 05/10/2011 10:57 AM, honeyoak wrote: it is possible to dynamically create functions in R using lists? what I want to do is something like this: a = list() for (i in 1:10) a[[i]] = function(seed = i) runif(seed) so that when I call a[i] I get random draws 1,2,i unfortunately

[R] creating a loop for a function

2011-10-05 Thread upananda pani
Dear All, I want to create a loop within a function r. The example follows: Box.test (lfut, lag = 1, type="Ljung") if i want to compute the Box.test for lag 1 to 10, I have to write manually change each time for different lag. So i wan to write a loop for the lag 1 to 10 and return the statisti

Re: [R] SPlus to R

2011-10-05 Thread Scott Raynaud
It seems I have things set up correctly.  I suspect that the arguments sshc(100,10) are the isuue.  It seems that the 100,10 is not necessary since the code itself specifies the arguments.  It runs and produces a power curve if I simply type sshc() but it also seems to try to keep running someth

Re: [R] "stepwise" sum

2011-10-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 behave > Sent: Wednesday, October 05, 2011 7:07 AM > To: r-help@r-project.org > Subject: [R] "stepwise" sum > > dear R-Community > > is there a function which sums data "stepwis

[R] Display a contingency table on the X11 device

2011-10-05 Thread Parker Jones
Hello, I'd like to output a table to the x11 device, but I can't seem to find an easy way to do it. Specifically, I'd like to display a 2x2 contingency table alongside a graphical plot, but can only see how to output to the console. Is there a library that can do this? Thanks for any sugges

Re: [R] "stepwise" sum

2011-10-05 Thread Sarah Goslee
> cumsum(c(2,1,4,5)) [1] 2 3 7 12 On Wed, Oct 5, 2011 at 10:06 AM, behave wrote: > dear R-Community > > is there a function which sums data "stepwise" > > exp: > > 2 > 1 > 4 > 5 > > Desired  result > > 2 = 2 > 2+1 = 3 > 2+1+4 = 7 > 2+1+4+5 = 12 > > Is there a built in function for this? > > T

[R] Needed help with 3 factor anova !!!

2011-10-05 Thread rafal
I am a student from Poland. What I am interested in is 3 factor anova with R. Could you please help me find an example with using this method with R? With all possible countable output for anova as the output presents with 3 factor anova with spss? I would be glad with any help. -- View this messa

Re: [R] dynamically creating functions in r

2011-10-05 Thread Sarah Goslee
Hi, On Wed, Oct 5, 2011 at 10:57 AM, honeyoak wrote: > it is possible to dynamically create functions in R using lists? what I want > to do is something like this: > >      a = list() >      for (i in 1:10) a[[i]] = function(seed = i) runif(seed) > > so that when I call a[i] I get random draws 1,

[R] A question about R image function

2011-10-05 Thread JeffND
Dear folks, I have a question about the image() function in R. I found the following link talking about this but the replies didn't help with my situations. http://r.789695.n4.nabble.com/question-on-image-function-td839275.html#a839276 To be simple, I will keep using the example in the above lin

Re: [R] reporting multiple objects out of a function

2011-10-05 Thread sina rueeger
Hi Andrew I am not sure if I understood your question entirely. You want to store some objects, but not in the global environment. Correct?! I would do it like this (although I am sure that there is a more elegant way to do this). ## ---

Re: [R] about the array transpose

2011-10-05 Thread venerealdisease
many thanks. I will try to figure it out. -- View this message in context: http://r.789695.n4.nabble.com/about-the-array-transpose-tp3866241p3874870.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list http

Re: [R] Reg : read missing values from database using RJDBC

2011-10-05 Thread Raji
Hi All, This seems to be a bug with RJDBC package and it has been fixed in the latest RJDBC_0.1-6 version. I would like to try out RJDBC_0.1-6. can you please guide me to a link where i can find the 64-bit RJDBC_0.1-6.zip . I could find the 32-bit version at http://cran.sixsigmaonline.org/bin/win

Re: [R] Odd gridding pattern when plotting

2011-10-05 Thread Balko, Justin
Thanks Uwe, The patched 2.13.2 solves this issue. Best, Justin M. Balko, Pharm.D., Ph.D. Research Fellow, Arteaga Lab Department of Medicine Division of Hematology/Oncology Vanderbilt University 777 Preston Research Building Nashville TN, 37232-6307 Ph: 615-936-1495 -Original Message- Fr

[R] white on black theme for ggplot2

2011-10-05 Thread Eugene Kanshin
Hello, I'm trying to produce some plots in ggplot2 to use them on the dark-blue gradient background. I am wondering if there is already any theme/set of options that I can use to change the color scheme and add transparency. Thank you very much, Evgeny. [[alternative HTML version deleted]]

[R] Difficulty with lme

2011-10-05 Thread Brad Davis
Hi all, I'm having some difficulty with lme. I am currently trying to run the following simple model anova(lme(x ~ f1 + f2 + f1:f2, data=m, random=~1|r1)) Which is currently producing the error Error in MEEM(object, conLin, control$niterEM) : Singularity in backsolve at level 0, block 1 x i

[R] dynamically creating functions in r

2011-10-05 Thread honeyoak
it is possible to dynamically create functions in R using lists? what I want to do is something like this: a = list() for (i in 1:10) a[[i]] = function(seed = i) runif(seed) so that when I call a[i] I get random draws 1,2,i unfortunately R only uses the last i . I would also like

[R] Usng MCMCpack,error is "initial value in vmmin is not finite"

2011-10-05 Thread yiy83102
__ 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.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Create combinations of rows

2011-10-05 Thread darkgaze
Great, thanks a lot! Don On Wed, Oct 5, 2011 at 2:42 AM, Enrico Schumann [via R] < ml-node+s789695n3873597...@n4.nabble.com> wrote: > ?expand.grid > > Am 05.10.2011 00:21, schrieb darkgaze: > > > I don't quite know how to word what I want, but if I have > > > > (1, 2, 3); (a, b, c); (x, y) > > >

Re: [R] SPlus to R

2011-10-05 Thread Scott Raynaud
Ok, I chased down all the problems.  This is my last output:   > sshc(100,10) [1] 0.8000 0.7908 0.7844 0.7773 0.7785 0.7989 [1]  5.37 10.29 13.27 13.04  9.66  3.54 [1] " old.abs.dev= 0.0701944484789673" [1] " abs.dev= 0.034407699378335" [1] 0.8000 0.8030 0.8057 0.8041 0.8035 0.8180 [1]  5.37 10

[R] gamm: problems with corCAR1()

2011-10-05 Thread Karel V
Dear all, I’m analyzing this dataset containing biodiversity indices, measured over time (Week), and at various contaminant concentrations (Treatment). We have two replicates (Replicate) per treatment. I’m looking for the effects of time (Week) and contaminant concentration (Treatment) on diversi

[R] "stepwise" sum

2011-10-05 Thread behave
dear R-Community is there a function which sums data "stepwise" exp: 2 1 4 5 Desired result 2 = 2 2+1 = 3 2+1+4 = 7 2+1+4+5 = 12 Is there a built in function for this? Thx Dom -- View this message in context: http://r.789695.n4.nabble.com/stepwise-sum-tp3874606p3874606.html Sent from th

[R] variance ratio test

2011-10-05 Thread rauf ibrahim
Hello, I am looking for a code in R for the variance ratio test statistic (the Lo and Mackinlay version or any other versions). Does anybody have such a code they can share or know a library in which I can find this function? Basically I have a number of time series which I need to check for per

[R] best way to further analyse a mixed model?

2011-10-05 Thread Panagiotis
Hi, I want to ask which way is more effective to further analyse (multiple comparisons) a mixed model repeated measures anova with 2 fixed factor and 1 random? anova(lme(expr~treatment*age,random=~1|trial, data) Is searching for an effect of one factor in each of the subsamples defined by the seco

[R] Subsetting a data frame with multiple values and exclusions.

2011-10-05 Thread natalie.vanzuydam
Hi all, I realise that the convention is to provide a working example of my problem but the data are of a sensitive nature so I'm not able to do that in this case. I need to query a database for multiple search terms: db <- structure(list(ind = c("ind1", "ind2", "ind3", "ind4"), test1 = c(1, 2

Re: [R] mean of 3D arrays

2011-10-05 Thread David Winsemius
On Oct 5, 2011, at 8:14 AM, R. Michael Weylandt > wrote: (x1+x2+x3)/3 I'm not aware of a "pmean" function but it wouldn't be hard to homebrew one if you are comfortable with the ... argument I'll draft one up and send it along pmean <- function(lis) Reduce("+",lis)/length(lis) res <- p

[R] How to make an orderly matrix from geostatistical data?

2011-10-05 Thread Tariq
Hi everybody, I used the krige.conv command (geoR package) to create a new data set. The input was a matrix with three spatial coordinates (x, y, z) in the first three columns and the value of a variable in the last column. The output is... a weird sequence of numbers. How can I make this output i

Re: [R] speed up this algorithm (apply-fuction / 4D array)

2011-10-05 Thread William Dunlap
I corrected your code a bit and put it into a function, f0, to make testing easier. I also made a small dataset to make testing easier. Then I made a new function f1 which does what f0 does in a vectorized manner: x <- array(rnorm(50 * 50 * 50 * 91, 0, 2), dim=c(50, 50, 50, 91)) xsmall <- ar

Re: [R] SPlus to R

2011-10-05 Thread William Dunlap
I took the original code, changed all return() calls of the form return(n1=v1,n2=v2) to return(list(n1=v1,n2=v2)) and then sshc(10,100) chugged away and produced some plots and returned something with no errors. It took a couple of minutes. I also changed T->TRUE and F->FALSE, as that makes the c

Re: [R] SPlus to R

2011-10-05 Thread Barry Rowlingson
On Wed, Oct 5, 2011 at 4:54 PM, Scott Raynaud wrote: > It seems I have things set up correctly.  I suspect that the arguments > sshc(100,10) are the isuue.  It seems that the 100,10 is not necessary since > the code itself specifies the arguments.  It runs and produces a power curve > if I simply

[R] Party extract BinaryTree from cforest?

2011-10-05 Thread Chris Hane
Hello, I want to plot one of the trees from a cforest object: >data(iris) >cf <- cforest(Species, data=iris) >From the docs, cf@ensemble contains a list of BinaryTrees: ensemble: Object of class "list", each element being an object of class " BinaryTree <../../party/help/BinaryTree%2dclass>". So

[R] Advice in model construction

2011-10-05 Thread Chris Mcowen
Dear list, I am unsure how to structure my model, i have tried something and it makes sense but i am unsure if i am interpreting it correctly? i have a continuous response variable - the observed quantity of evolutionary history - EH Then i have a number of species which have a hierarchical st

Re: [R] Tinn-R

2011-10-05 Thread Leandro Marino
*Paul, I use Tinn-r and i didn't see anything hard to configure it. You have to install the R, then the Tinn-r. After you have to open Tinn-r go to R >> Configure >> Permanent . This procedure will open the Rprofile.site file, if you want you can change some parameters and save. After that you hav

  1   2   >