Re: [R] ifelse returns

2011-07-29 Thread Tyler Rinker
Thanks toy Jim and Michael for their response. The suggestion to use regular if/else was spot on. > From: tyler_rin...@hotmail.com > To: r-help@r-project.org > Date: Sat, 30 Jul 2011 01:48:21 -0400 > Subject: [R] ifelse returns > > > Greetings R Community, > > I am working with the ifelse

Re: [R] ifelse returns

2011-07-29 Thread R. Michael Weylandt
So the thing is this, ifelse puts together a vector elementwise from two other vectors (or other things, but vectors is vague enough for now) based on a series of T/F values: you only put in one logical test, so you only get a vector of length 1 back, here MODE1[1]=4. It seems like a regular if/els

Re: [R] ifelse returns

2011-07-29 Thread jim holtman
You might want to breakdown some of the expressions you are using; for example: > x<-c(2,3,4,4,5,5,6,6,8,10) > > df<-as.data.frame(table(x)) > df<-df[order(df$Freq),] > m<-max(df$Freq) > (MODE1<-as.vector(as.numeric(as.character(subset(df,Freq==m)[,1] [1] 4 5 6 > ifelse(sum(df$Freq)/length(df$

[R] ifelse returns

2011-07-29 Thread Tyler Rinker
Greetings R Community, I am working with the ifelse function and it is returning something unexpected. In the code the line with the MODE1 assignment the output is a vector [1] 4 5 6 but when I put the MODE1 object into the ifelse function [R}'s output for MODE1 is the first number from the

Re: [R] running slope

2011-07-29 Thread R. Michael Weylandt
Also, if it works for you and there are no data irregularities, might I suggest you look at making use of the runSD() and runCov or runCor functions of the TTR package. If you know the relationship between slope of an intercept -- beta = cov(x,y) / var(x) -- it should be pretty easy to implement fo

Re: [R] How to install "adapt" package

2011-07-29 Thread Prof Brian Ripley
Beyond that, the files at the URL given are not zip files, so we are not being told the whole truth. My guess is that 'Lei Liu' is using Windows without telling us. In which case (s)he needs to follow the rw-FAQ about installing packages from the source. Also note that CRAN packages are arc

Re: [R] How to install "adapt" package

2011-07-29 Thread Joshua Wiley
Hi Lei, This is likely a problem related to your OS or your version of R; however, you have not provided us with either (as the posting guide linked to below requests), so it is impossible to tell. The easiest way to let us know is to copy and paste the output from running: sessionInfo() at you

[R] How to install "adapt" package

2011-07-29 Thread Lei Liu
Hi there, I want to install the "adapt" package, which is available at http://cran.r-project.org/src/contrib/Archive/adapt/. This package cannot be directly installed by "install packages" menu in R. So I downloaded the zip file into the hard drive. But I couldn't install it using "install pa

Re: [R] bug in dev.copy2pdf output?

2011-07-29 Thread Rolf Turner
On 29/07/11 19:57, Martin Maechler wrote: but *also* see the *workaround* for the bug that has been on R's ?pdf help page for years [] --> search for "q" (including the quotes). Why oh why oh why ... are people always thinkg of bugs in R when they notice something and why oh w

Re: [R] Limited number of principal components in PCA

2011-07-29 Thread Joshua Wiley
Hi Billy, Can you provide your data? You could attach it as a text file or provide it by pasting the output of: dput(Q) into an email. It would help if we could reproduce what you are doing. You might also consider a list or forum that is more statistics oriented than Rhelp, as your questions

Re: [R] running slope

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 8:22 PM, Byerly, Mike M (DFG) wrote: Is there a function in R that will calculate a running linear slope similar to the way the function filter() will calculate a moving average? If you are happy with the return from filter, then why not take the first differences as th

[R] running slope

2011-07-29 Thread Byerly, Mike M (DFG)
Is there a function in R that will calculate a running linear slope similar to the way the function filter() will calculate a moving average? Mike Byerly Fisheries Biologist Commercial Fisheries Division Alaska Dept. of Fish and Game 3298 Douglas Place Homer, AK 99603 mike.bye...@alask

Re: [R] read.table only reads part of file

2011-07-29 Thread Peter Langfelder
On Fri, Jul 29, 2011 at 6:00 PM, Sarah Goslee wrote: > Hi Peter, > > I'm not going to look at your large file on what for me is Friday evening, but > the usual cause of that kind of problem is a single or double quote in the > text. bingo! Setting quote = "" solved the problem. Thanks, Peter

Re: [R] read.table only reads part of file

2011-07-29 Thread Sarah Goslee
Hi Peter, I'm not going to look at your large file on what for me is Friday evening, but the usual cause of that kind of problem is a single or double quote in the text. One way to diagnose the problem is to look at the rows in the text file itself right around 25952 - there's always something th

[R] read.table only reads part of file

2011-07-29 Thread Peter Langfelder
Hi all, I encountered a problem when trying to read in an Illumina chip annotation file. The offending file is large, so I zipped it up and posted it at http://www.genetics.ucla.edu/labs/horvath/CoexpressionNetwork/tmp/ProbeInfo_Expression.txt.bz2 Executing this: annot = read.table(bzfile("Prob

Re: [R] plot, graphic

2011-07-29 Thread Dennis Murphy
Hi: This is simple to do in any of the supported graphics systems in R, and there are a number of kind people who are willing to and capable of providing help. Unfortunately, since you didn't supply any data or code, you've made it difficult for them to help you. Please read the Posting Guide that

Re: [R] finding a faster way to run lm on rows of predictor matrix

2011-07-29 Thread Dennis Murphy
Hi: The reason why you can fit N linear models to the same predictor quickly is because the model matrix X is fixed and you can store the multiple Y's as a matrix. Consequently, you can run the N linear regressions in one shot using least squares, and lm() implements this efficiently by allowing t

Re: [R] problems with image.plot()

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 6:38 PM, Sumukh Sathnur wrote: Hi all, I used image.plot() to create a heat map of a matrix: as.matrix(read.table("Matrix.txt", sep="\t"))->x HeatBrk<-seq(5,25,2.5) MyCol= gray((7:0)/7) library(fields) image.plot(x, col=MyCol, breaks=HeatBrk, legend.shrink=0.3) dev.copy(d

Re: [R] 'breackpoints' (package 'strucchange'): 2 blocking error messages when using for multiple regression model testing

2011-07-29 Thread Achim Zeileis
On Fri, 29 Jul 2011, Michel Lutz wrote: Achim, Thank you so much for this prompt answer. Really appreciated ! Anyway, I am still a bit lost... don't you mind if I ask you somme additional questions? * *one standard approach is to employ a HACcovariance matrix* I did many researches but I nev

Re: [R] http://www.r-project.org/contributors.html: display problem, because no character set is defined

2011-07-29 Thread peter dalgaard
Fixed (both). Wait for the autoupdate or check https://svn.r-project.org/R-project-web/trunk/contributors.html -pd On Jul 29, 2011, at 23:23 , Hadley Wickham wrote: > And I think Uwe is missing from that list! > Hadley > > On Fri, Jul 29, 2011 at 3:34 PM, Paul Menzel > wrote: >> Dear R webma

Re: [R] Reading name-value data

2011-07-29 Thread Stavros Macrakis
Perfect! Thanks! By the way, I see that, unlike base rbind, it does not work for vectors and lists: rbind(c(a=1),c(b=2)) => matrix(1:2,2,1,dimnames=list(NULL,"a")) == as.matrix(data.frame(a=1:2)) but rbind.fill(c(a=1),c(b=2)) => NULL Shouldn't it give something like matrix(c(1,

Re: [R] help with rpart

2011-07-29 Thread Greg Snow
Well there is the "esp" package, though it is still very pre-alpha. Let's see what it has to suggest for this question: > source('g:/R/esp/esp.R') > esp() [1] "tabulation overabundant positron carfare contaminant sprawl station swat aversion" > Wow, that almost looks like it should make some s

Re: [R] http://www.r-project.org/contributors.html: display problem, because no character set is defined

2011-07-29 Thread Hadley Wickham
And I think Uwe is missing from that list! Hadley On Fri, Jul 29, 2011 at 3:34 PM, Paul Menzel wrote: > Dear R webmasters, > > > my browser defaults to the charset UTF-8 and since [1] seems to be > encoded in ISO-8859-1 the umlauts are not displayed correctly. It would > be great if the encoding

[R] http://www.r-project.org/contributors.html: display problem, because no character set is defined

2011-07-29 Thread Paul Menzel
Dear R webmasters, my browser defaults to the charset UTF-8 and since [1] seems to be encoded in ISO-8859-1 the umlauts are not displayed correctly. It would be great if the encoding could be added to the header [2]. (Or the page converted to UTF-8 and the problem would be solved for me. ;-) )

Re: [R] change pch in 3dplot, export graph

2011-07-29 Thread Jean V Adams
Jack, There is no pch= argument for plot3d() or points3d(). You can change the color and the size of the symbols. Or you can use characters as symbols using text3d(). I found that suggestion by searching the rhelp archives. It is helpful to share code that will work. x <- c(-4, -2, 0, 2, 4)

Re: [R] change pch in 3dplot, export graph

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 4:02 PM, jack hietpas wrote: Hello I was wondering if anyone has been able to change the pch value for points in 3dplot()? I am able to change point colors just not symbol types. I have included a portion of my code below. I realize this won't work outside of my script

Re: [R] example for plot.compare.datasets() in package rioja fails

2011-07-29 Thread Jason Paul Joines
Sarah Goslee wrote: I get the same error on a clean R session with rioja 0.5-6. sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETAR

[R] change pch in 3dplot, export graph

2011-07-29 Thread jack hietpas
Hello I was wondering if anyone has been able to change the pch value for points in 3dplot()? I am able to change point colors just not symbol types. I have included a portion of my code below. I realize this won't work outside of my script, but thought, maybe there is something obvious that I a

Re: [R] example for plot.compare.datasets() in package rioja fails

2011-07-29 Thread Sarah Goslee
I get the same error on a clean R session with rioja 0.5-6. > sessionInfo() R version 2.13.1 (2011-07-08) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSA

Re: [R] plot, graphic

2011-07-29 Thread Paul Menzel
Dear Simon, Am Freitag, den 29.07.2011, 12:32 -0700 schrieb Crock: > i`m trying to use the plot function to show more variable-funktions in one > graphic. so for example i would like to show Chinas Income in different > sectors in one graphic. obviousely typing plot(ChinaIncome) the graphics are

Re: [R] plot, graphic

2011-07-29 Thread R. Michael Weylandt
Can you be a little more specific as to the structure of your data - time series, single point, levels, relative values, etc? I think that will let us help you along the way to a specific set of plot tools...For now check out the R plots/graphics gallery (easy google). Also see ?plot Michael We

[R] forecasting- number of items to replace is not a multiple of replacement length error

2011-07-29 Thread ap88ma
Hi all I write below code for simulation and forecasting a stochastic mortality model with parameters kappa2(t) and gamma3(t-x) where t is the time and x the age but I got this message:"Error in G3.sim[, k] = G3.aug : number of items to replace is not a multiple of replacement length" Any sugge

[R] plot, graphic

2011-07-29 Thread Crock
hi, i`m trying to use the plot function to show more variable-funktions in one graphic. so for example i would like to show Chinas Income in different sectors in one graphic. obviousely typing plot(ChinaIncome) the graphics are split and there is one graphic for agriculture, one for industry i

[R] example for plot.compare.datasets() in package rioja fails

2011-07-29 Thread Jason Paul Joines
I'm using rioja 0.5-6 with R 2.12.1 / x86_64-pc-linux-gnu on Kubuntu 11.04. When I run this example from the rioja reference manual: library(rioja) # compare diatom data from core from Round Loch of Glenhead # with SWAP surface sample dataset data(RLGH) data(SWAP) result <- compare.data

[R] Limited number of principal components in PCA

2011-07-29 Thread William Armstrong
Hi all, I am attempting to run PCA on a matrix (nrow=66, ncol=84) using 'prcomp' (stats package). My data (referred to as 'Q' in the code below) are separate river streamflow gaging stations (columns) and peak instantaneous discharge (rows). I am attempting to use PCA to identify regions of that

Re: [R] finding a faster way to run lm on rows of predictor matrix

2011-07-29 Thread Christopher Park
Thank you so much for the help! I got it down to 1sec per run. -Chris On Fri, Jul 29, 2011 at 1:12 PM, "Dénes TÓTH" wrote: > > Hi, > > you can solve the task by simple matrix algebra. > Note that I find it really inconvenient to have a matrix with variables in > rows and cases in columns, so I t

Re: [R] "inside" argument in barplot

2011-07-29 Thread Colin Bergeron
Thanks again, I like the idea of adding transparency. I will try it. For now, I resigned myself to add points to the original barplot using points as such: plotV<-barplot(Value[,1],space=0) dev.off() par(mar=c(4,5,3,1)) barplot(Value[,1],space=0, col="grey30",axis.lty=2) points(plotV, sampledept

Re: [R] Lattice: choice of symbol and symbol position in legend

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 1:23 PM, marcel wrote: This solution worked well, There is no "this solution" visible to most of us. Please learn to post edited context. and the key section under ?xyplot was very helpful in adjusting lots of details in the key, including position and even the dist

Re: [R] Lattice: choice of symbol and symbol position in legend

2011-07-29 Thread marcel
This solution worked well, and the key section under ?xyplot was very helpful in adjusting lots of details in the key, including position and even the distance between text and key symbols, using "between". One thing I didn't see described very well was how to toggle from a transparent key symbol t

Re: [R] Can R (without GUI) be compiled with static linking?

2011-07-29 Thread Jonathan Callahan
> Personally, given that R can't do much anything without all its base > packages (ie the single /usr/local/bin/R.bin executable can't do > anything on its own) I can't see the point in a single static binary. > If the client is worried about library compatibility then build R with > dynamic linki

Re: [R] Can R (without GUI) be compiled with static linking?

2011-07-29 Thread Jonathan Callahan
Barry Rowlingson wrote: > > Personally, given that R can't do much anything without all its base > packages (ie the single /usr/local/bin/R.bin executable can't do > anything on its own) I can't see the point in a single static binary. > If the client is worried about library compatibility then b

Re: [R] finding a faster way to run lm on rows of predictor matrix

2011-07-29 Thread Dénes TÓTH
Hi, you can solve the task by simple matrix algebra. Note that I find it really inconvenient to have a matrix with variables in rows and cases in columns, so I transposed your predictors matrix. # your data regress.y = rnorm(150) predictors = matrix(rnorm(6000*150), ncol=150, nrow=6000) tpreds <

Re: [R] Apostrophes in R Commander in recode

2011-07-29 Thread John Fox
Dear Simon and David, The Rcmdr does indeed use the recode() function in the car package for recodes. When recode() is called directly, it works to escape the apostrophe, but this doesn't work in the Rcmdr dialog, which then sees the apostrophe and complains. I can suggest two solutions, of whi

Re: [R] "inside" argument in barplot

2011-07-29 Thread Jannis
Why dont you plot a stacked barplot with the two values for each depth (or whatever is on the x axis) besides each other? Another option would be to add transparency to the fill color of the plot (col=rgb(1,1,1,0.5)). On 07/29/2011 05:21 PM, Colin Bergeron wrote: Thanks Jannis, I am including

Re: [R] coordinates from locator function in POSIXct format

2011-07-29 Thread jim holtman
I keep the following function handy so that I can change the numeric value from POSIXct back to POSIXct; I tend to keep the numeric in matrices since it allows faster operations in some cases. This just puts the appropriate classes on the object; quicker than using as.POSIXct(z, origin="1970-01-01

Re: [R] splitting a string based on the last underscore

2011-07-29 Thread Dimitri Liakhovitski
Thanks a lot, Jim! Dimitri On Fri, Jul 29, 2011 at 12:48 PM, jim holtman wrote: > But your requirements said "last underscore"; so we now have a change > that really says the first underscore.  So we change the regex to: > >> strsplit(sub("[^_]+_(.+)_(.+).o$", "\\1 \\2", x), ' ') > [[1]] > [1] "a

Re: [R] splitting a string based on the last underscore

2011-07-29 Thread jim holtman
But your requirements said "last underscore"; so we now have a change that really says the first underscore. So we change the regex to: > strsplit(sub("[^_]+_(.+)_(.+).o$", "\\1 \\2", x), ' ') [[1]] [1] "a1" "2.5" [[2]] [1] "a2" "2.53" [[3]] [1] "a3_bla" "1" > On Fri, Jul 29, 2011 at 12:4

Re: [R] splitting a string based on the last underscore

2011-07-29 Thread Dimitri Liakhovitski
Thank you, Jim. It's close but not all the way. The desired result is: > [[1]] > [1] "a1" "2.5" > > [[2]] > [1] "a2" "2.53" > > [[3]] > [1] "a3_bla" "1" Dimitri On Fri, Jul 29, 2011 at 12:35 PM, jim holtman wrote: > try this: > >> x<-c("name_a1_2.5.o","name_a2_2.53.o","name_a3_bla_1.o") >> st

Re: [R] coordinates from locator function in POSIXct format

2011-07-29 Thread cristabel.duran
Thanks David and Janis, now the result is logic! have a nice WE, Cristabel. On 07/29/2011 06:32 PM, David Winsemius wrote: On Jul 29, 2011, at 12:21 PM, cristabel.duran wrote: Hi Janis, thank you for you answer. Actually already I did exactly what you said. However, when I convert the num

Re: [R] finding a faster way to run lm on rows of predictor matrix

2011-07-29 Thread Joshua Wiley
Hi, If you are doing repeated fits in this specialized case, you can benefit by skipping some of the fancy overhead and going straight to lm.fit. ## what you had data.residuals <- t(apply(predictors, 1, function(x)( lm(regress.y ~ -1 + as.vector(x))$residuals))) ## passing the matrices directly

Re: [R] splitting a string based on the last underscore

2011-07-29 Thread jim holtman
try this: > x<-c("name_a1_2.5.o","name_a2_2.53.o","name_a3_bla_1.o") > strsplit(sub(".*?([^_]+)_([^-]+).o$", "\\1 \\2", x), ' ') [[1]] [1] "a1" "2.5" [[2]] [1] "a2" "2.53" [[3]] [1] "bla" "1" > On Fri, Jul 29, 2011 at 12:08 PM, Dimitri Liakhovitski wrote: > Hello! > Hope you could help me

Re: [R] coordinates from locator function in POSIXct format

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 12:21 PM, cristabel.duran wrote: Hi Janis, thank you for you answer. Actually already I did exactly what you said. However, when I convert the number of "seconds" from the first measurement (some day in July 2010) then a I get a date in the year 2050 which is impossib

Re: [R] coordinates from locator function in POSIXct format

2011-07-29 Thread cristabel.duran
Hi Janis, thank you for you answer. Actually already I did exactly what you said. However, when I convert the number of "seconds" from the first measurement (some day in July 2010) then a I get a date in the year 2050 which is impossible. The latest date possible is 29March2011. my value in

Re: [R] special recursive filter

2011-07-29 Thread R. Michael Weylandt
Oh darn, I missed the recursive-ness entirely. You condition on the filtered series, not the signal itself. In that case, I have a solution which is pretty fast, but not particularly R-esque. In effect your filter just says, take x but if you see a 1, sit out for the next wait periods. This seems

Re: [R] Animated gif or something similar in R?

2011-07-29 Thread Gene Leynes
I wasn't at my normal computer yesterday, so I didn't run the example. I thought "rgl" was one of those color palette generator packages. So, my suggestion of using animation was completely off base (oops). But I did notice two other things: 1) your color column changes from a factor to a charac

Re: [R] Apostrophes in R Commander in recode

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 11:32 AM, Simon Kiss wrote: Dear colleagues, I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander. It's probably in a package named 'car'. library(car) ?recode The application cannot deal with apostrpohes ( ' ) d

[R] finding a faster way to run lm on rows of predictor matrix

2011-07-29 Thread cypark
Hi, everyone. I need to run lm with the same response vector but with varying predictor vectors. (i.e. 1 response vector on each individual 6,000 predictor vectors) After looking through the R archive, I found roughly 3 methods that has been suggested. Unfortunately, I need to run this task multi

[R] splitting a string based on the last underscore

2011-07-29 Thread Dimitri Liakhovitski
Hello! Hope you could help me split the strings. I have a set of strings: x<-c("name_a1_2.5.o","name_a2_2.53.o","name_a3_bla_1.o") I need to extract from each string: 1. Its unique part that comes before the last "_", i.e.: "a1","a2","a3_bla". 2. The part that comes after the last "_" and befor

[R] rpart, resolution

2011-07-29 Thread mark
Thank you for all your help. The unexpected solution to my predict() problem was to use the Misc menu and remove all objects before proceeding further. The final digits of the trees continue to be clipped but I can live with that. Mark __ R-help@r-pr

Re: [R] special recursive filter

2011-07-29 Thread R. Michael Weylandt
I'm not sure I understand what your filter intends to do, but could this not be done more efficiently with logicals and the which? You also might need the cumsum() function and diff() with the optional lag argument if I've misunderstood your filter. Specifically try this: res = c(x,rep(NA,wait))

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Barry Rowlingson
On Fri, Jul 29, 2011 at 4:32 PM, Roy Mendelssohn wrote: > Actually this file, as it contents state, follow the CF convention, which is > widely used in climate science, oceanography and atmospheric science  (see > http://cf-pcmdi.llnl.gov/documents/cf-conventions).  The particular > projection

Re: [R] help with predict.rpart

2011-07-29 Thread Sarah Goslee
On Fri, Jul 29, 2011 at 11:26 AM, wrote: >        data=read.table("http://statcourse.com/research/boston.csv";, , > sep=",", header = TRUE) >        library(rpart) >        fit=rpart (MV~ CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+ > PT+B+LSTAT) >        predict(fit,data[4,]) > > plot only reve

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Ana
Hi! Thank you all. I finally understood the way to solve the problem from Barry's mail. >From the file created with coordinates(Lat,Long) using fan, everything looks ok (wgs84). I will now try Bryan's approach in R. Ana On Fri, Jul 29, 2011 at 4:22 PM, Barry Rowlingson wrote: >>        float l

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Roy Mendelssohn
> > > The rlat and rlon variables are the grid coordinate system, which > appears to be some non-standard conical projection. Climate > scientists! > Actually this file, as it contents state, follow the CF convention, which is widely used in climate science, oceanography and atmospheric scienc

[R] Apostrophes in R Commander in recode

2011-07-29 Thread Simon Kiss
Dear colleagues, I'm using R64 (2.13) on Mac OS 10.6.8 and I've encountered a problem with the recode function in Rcommander. The application cannot deal with apostrpohes ( ' ) do not. I've got a factor from the 2008 Canada Election study (highest level of schooling) and some of the values i

Re: [R] help with plot.rpart

2011-07-29 Thread mark
Your plot only shows part of the tree provided by print(fit). I would like to plot the entire tree. Original Message Subject: Re: [R] help with plot.rpart From: Joshua Wiley <[1]jwiley.ps...@gmail.com> Date: Fri, July 29, 2011 8:25 am To: [2]m...@statcourse

Re: [R] effect size

2011-07-29 Thread h_bumann
I understand, that eta^2 presents a useful measure of effect sizes. However, the power-calculation-tool G*Power I intend to use, requires an "Effect size f" which is calculated like this: "Variance explained by special effect" / "Variance explained by special effect" + "Variance within groups" I

Re: [R] Data aggregation question

2011-07-29 Thread David Warren
Hi all, table() did the trick, and very efficiently, too! Thanks for the advice, Dave On Thu, Jul 28, 2011 at 5:39 PM, David Winsemius wrote: > > On Jul 28, 2011, at 4:24 PM, David Warren wrote: > > Hi all, >> >>I'm working with a sizable dataset that I'd like to summarize, but I >>

[R] special recursive filter

2011-07-29 Thread Konrad Schubert
Hi, I have a question about a special recursive filter problem. What I have: - given variables: x: time series with rather randomly occuring '0' and '1' wait: non negative integer - a working but ineffectiv implementation (see below) How the implementation works (what I want): The filter s

Re: [R] help with predict.rpart

2011-07-29 Thread mark
 data=read.table("http://statcourse.com/research/boston.csv";, , sep=",", header = TRUE)  library(rpart)  fit=rpart (MV~ CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+ PT+B+LSTAT) predict(fit,data[4,]) plot only reveals part of the tree in contrast to the results on obtai

Re: [R] help with plot.rpart

2011-07-29 Thread Joshua Wiley
Mark, The below is not directly reproducible. There is no "MV" or "PT" variable in the dataset you reference. I am assuming you meant: dat <- read.table("http://statcourse.com/research/boston.csv";, , sep=",", header = TRUE) fit <- rpart(MEDV ~ CRIM + ZN + INDUS + CHAS + NOX + RM + AGE + DIS

Re: [R] help with plot.rpart

2011-07-29 Thread Sarah Goslee
Ah, now we're getting somewhere. Think how easy this would be if you'd provided this information initially. On Fri, Jul 29, 2011 at 11:11 AM, wrote: > Ø  data=read.table("http://statcourse.com/research/boston.csv";, , sep=",", > header = TRUE) > Ø  library(rpart) > Ø  fit=rpart (MV~ CRIM+ZN+INDU

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Barry Rowlingson
>        float lat(rlat, rlon) ; >                lat:standard_name = "latitude" ; >                lat:long_name = "latitude" ; >                lat:units = "degrees_north" ; >        float lon(rlat, rlon) ; >                lon:standard_name = "longitude" ; >                lon:long_name = "longi

Re: [R] "inside" argument in barplot

2011-07-29 Thread Colin Bergeron
Thanks Jannis, I am including an example code of what I am trying to do: par(mar=c(4,5,3,1)) barplot(Value[,1],space=0, col="grey30",axis.lty=2) barplot(sampledepth[,1]/2, space=0, col="grey30", inside=FALSE, add=TRUE) sampledepth is divided by two to have the same axis scale as Valu

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Jannis
Well, the CF ncdf convention (for example) suggests to use variables with identical names as the dimensions as coordinate variables. In your case the dimensions are called rlat/rlong so the software uses these rotated axes. In your file you however also have variables lat and long and they seem

[R] help with plot.rpart

2011-07-29 Thread mark
à data=read.table("http://statcourse.com/research/boston.csv";, , sep=",", header = TRUE) à library(rpart) à fit=rpart (MV~ CRIM+ZN+INDUS+CHAS+NOX+RM+AGE+DIS+RAD+TAX+ PT+B+LSTAT) Please: Show me the tree. Mark Original Message Subject: Re: [R] help

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Roy Mendelssohn
Hi Ana: On Jul 29, 2011, at 8:03 AM, Ana wrote: > netcdf precip.DMI.HS1 { > dimensions: > rlat = 84 ; > rlon = 90 ; > time = 10800 ; > time_bnds = 2 ; > variables: > float lat(rlat, rlon) ; > lat:standard_name = "latitude" ; > lat:long_name

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Ana
Hi Roy and David, My main problem is how to interpret the coordinate system. If I try to open it directly in a GIS software that supports necdf format, the location is far away from where it should be (plots rlong,rlat). All I want to do is to get a data.frame with a column for long, another for l

Re: [R] "inside" argument in barplot

2011-07-29 Thread Jannis
Dear Collin, as always, a reproducible example code would help us to understand what you want to do. This way I can only guess And my guess would be that it is much easier to use: par(new=TRUE) and to superimpose the barplot with whatever curve you want to include. You may need to set

Re: [R] HIRHAM netcdf files

2011-07-29 Thread David William Pierce
On Fri, Jul 29, 2011 at 7:44 AM, Ana wrote: > Can someone help me out with a "small" problem? > > I've started using netcdf files recently, and I want to extract the grid id > and also the coordinates from a HIRHAM netcdf file. > I know how to extract a slice of dataset both in space and in time

Re: [R] Animated gif or something similar in R?

2011-07-29 Thread Dale Coons
Thanks to several who responded--I should have looked (doh!) in the documentation. play3d() and movie3d() were just the ticket! On 7/28/2011 4:48 PM, Jean V Adams wrote: > > Dale, > > I do not have the same color problem when I run your code on my PC. > The colors in both devices look the sam

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Jannis
This problem may be more related to netcdf files than to RAnd the answer to your question very much depends on which netcdf convention the AWI folks who created your data followed. Additionally it depends on the Software you use to read these ncdf files. Regarding the grid locations there

Re: [R] HIRHAM netcdf files

2011-07-29 Thread Roy Mendelssohn
I am not familiar with the HIRHAM netcdf files. Do you have the netcdf library installed and can you print the output of the "ncdump -h" command on one of the files? -Roy On Jul 29, 2011, at 7:44 AM, Ana wrote: > Can someone help me out with a "small" problem? > > I've started using netcdf

Re: [R] HIRHAM netcdf files

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 10:44 AM, Ana wrote: Can someone help me out with a "small" problem? I've started using netcdf files recently, and I want to extract the grid id and also the coordinates from a HIRHAM netcdf file. I know how to extract a slice of dataset both in space and in time and I

[R] "inside" argument in barplot

2011-07-29 Thread Colin Bergeron
Dear list, I want to plot a sample depth curve over a barplot. It would be perfect if the argument "inside" in the barplot function would be functional, cause I could just add this curve to the actual barplot, but it seems like it is not (not yet implemented). Argument "inside" would allow not to

Re: [R] help with rpart

2011-07-29 Thread Sarah Goslee
Mark, The R-help list is not telepathic. I asked entirely reasonable follow-up questions intended to elicit from you a more extensive explanation of your problem. On Fri, Jul 29, 2011 at 10:26 AM, wrote: > 1. I did not receive your reply, which, not incidentally, does not address > either of my

[R] HIRHAM netcdf files

2011-07-29 Thread Ana
Can someone help me out with a "small" problem? I've started using netcdf files recently, and I want to extract the grid id and also the coordinates from a HIRHAM netcdf file. I know how to extract a slice of dataset both in space and in time and I also know the area that this file should cover, h

Re: [R] coordinates from locator function in POSIXct format

2011-07-29 Thread Jannis
Well,if you would have had a look at ?POSIXct the documentation would have given you quite a comprehensive explanation of the meaning of the values of your time vector as they are the values these POSIXct values are actually stored in (they are seconds since 1970-01-01). Additionally you would

Re: [R] R in Linux (Ubuntu)

2011-07-29 Thread Rainer M Krug
On Fri, Jul 29, 2011 at 3:49 PM, gaiarrido wrote: > Thanks very much, > and...Which do you recommend? > I am using emacs + ESS - but as you have mentioned "options", I assume you would like to e.g. manage package installation from the GUI - which you can do with both mentioned GUIs. Which one I

Re: [R] R in Linux (Ubuntu)

2011-07-29 Thread ONKELINX, Thierry
Dear Mario, Have a look at Eclipse with the StatET plugin. One of the benefits is that is available for both Linux and Windows which simplifies things when you need to switch often between Windows and Linux (e.g. Windows at work and Linux at home). Best regards, Thierry --

Re: [R] boxplots

2011-07-29 Thread Joshua Wiley
Hi Martin, As Sarah said, I do not know of any way to "change the default", but you can certainly do it manually each time. Here is an example: ## generate some data set.seed(10) x <- rnorm(101) ## store boxplot results s <- boxplot(x, plot = FALSE) ## look at them s ## replace the stats with lo

Re: [R] Changing font type within y axis labels

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 10:10 AM, Eik Vettorazzi wrote: Hi Philip, have a look at ?plotmath and try mtext(expression(paste("Total Landings of"~~italic("Pecten maximus"),"(tonnes)")), side=2,line=2) "~~" is used for extra space between plain and italic font, but that might be a matter of taste.

Re: [R] R in Linux (Ubuntu)

2011-07-29 Thread gaiarrido
Thanks very much, and...Which do you recommend? - Mario Garrido Escudero PhD student Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola Universidad de Salamanca -- View this message in context: http://r.789695.n4.nabble.com/R-in-Linux-Ubuntu-tp3703329p3704107.html

[R] example for plot.compare.datasets() in package rioja fails

2011-07-29 Thread Jason Paul Joines
I'm using rioja 0.5-6 with R 2.12.1 / x86_64-pc-linux-gnu on Kubuntu 11.04. When I run this example from the rioja reference manual: library(rioja) # compare diatom data from core from Round Loch of Glenhead # with SWAP surface sample dataset data(RLGH) data(SWAP) result <- compare.data

Re: [R] Changing font type within y axis labels

2011-07-29 Thread Eik Vettorazzi
Hi Philip, have a look at ?plotmath and try mtext(expression(paste("Total Landings of"~~italic("Pecten maximus"),"(tonnes)")), side=2,line=2) "~~" is used for extra space between plain and italic font, but that might be a matter of taste. hth. Am 29.07.2011 15:34, schrieb Philip Boulcott: > I w

Re: [R] [solved] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-29 Thread Paul Menzel
Dear Eik, Am Freitag, den 29.07.2011, 15:46 +0200 schrieb Eik Vettorazzi: > how about this > for (i in 1:2) { print( do.call(paste("f",i,sep=""),list(2, 3) )) } > > or using get > for (i in 1:2) { print( get(paste("f",i,sep=""))(2, 3) ) } works great for me. Thank you very much. Regarding searc

Re: [R] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-29 Thread David Winsemius
On Jul 29, 2011, at 9:28 AM, Paul Menzel wrote: Dear R folks, wanting to compare different implementations of a solution I want to script it to iterate over the different implementations. Is there a way to do this in the R shell/command line? You might consider examining the short and se

Re: [R] boxplots

2011-07-29 Thread Sarah Goslee
Martin, I don't know of an easy way to make that change, but do note: The two ‘hinges’ are versions of the first and third quartile, i.e., close to ‘quantile(x, c(1,3)/4)’. The hinges equal the quartiles for odd n (where ‘n <- length(x)’) and differ for even n. Whereas the q

Re: [R] scripting/littler: How to call function named iteratively (`f1`, `f2`, …)?

2011-07-29 Thread Eik Vettorazzi
Hi Paul, how about this for (i in 1:2) { print( do.call(paste("f",i,sep=""),list(2, 3) )) } or using get for (i in 1:2) { print( get(paste("f",i,sep=""))(2, 3) ) } cheers Am 29.07.2011 15:28, schrieb Paul Menzel: > Dear R folks, > > > wanting to compare different implementations of a solution

Re: [R] converting factor to numeric gives "NAs introduced by coercion"

2011-07-29 Thread Dennis Murphy
Hi: The argument stringsAsFactors = FALSE will suppress character data from being converted to factors. For more control, see the arguments colClasses and as.is in ?read.table - they should carry over to read.delim[2] but don't quote me on that :) HTH, Dennis On Fri, Jul 29, 2011 at 1:45 AM, ang

  1   2   >