Re: [R] abline(v= x) in plot with time formated xaxis not working

2009-07-18 Thread Patrick Connolly
Dear Fritz, (had to guess the name as well as most of the other things not given) On Wed, 15-Jul-2009 at 02:25PM -0700, F!! wrote: |> |> Hi, |> |> I try to create a vertical line in my plot, which has a xaxis comprising |> time formated data. |> |> This is what I tried: |> |> ---

Re: [R] get a vector with filenames with a certain extension in a folder

2009-07-18 Thread torpedo fisken
Thanks 'dir()' with glob2rx does what I want. Thanks again 2009/7/17 Peter Dalgaard : > milton ruser wrote: >> >> Hi there, >> >> try this: >> >> setwd("/home/mcr") >> dir(path=".", pattern=".txt$") >> >> OR >> >> dir(path="/home/mcr/.", pattern=".txt$") >> >> $ means finished with ".txt" > > A w

Re: [R] apply/return and reuse

2009-07-18 Thread Gabor Grothendieck
Yes, it just makes it more readable. On Sat, Jul 18, 2009 at 9:55 PM, Mark Knecht wrote: > Yes, I sort of guess at that one and found the answer. I don't quite > really get what this 'with' command is really doing. It seems that I > could have written something like out$Final <- out$Initial+out$Of

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Yes, I sort of guess at that one and found the answer. I don't quite really get what this 'with' command is really doing. It seems that I could have written something like out$Final <- out$Initial+out$Offset. (Untested.) I guess it's primarily a way of not having to write the data.frame's name and

Re: [R] apply/return and reuse

2009-07-18 Thread Gabor Grothendieck
Regarding the Final column the last line should have been out$Final <- with(out, Initial + Offset) On Sat, Jul 18, 2009 at 8:33 PM, Mark Knecht wrote: > Very interesting. Thanks. Very concise! interesting use of cumsum. > I'll have to see if I can work that into my real code where I need to > tak

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Hi, No, it's not about cumsum specifically. It's about building up the list as the events go by. I managed to create this code but it does depend on a for loop. Notice how the Final value on each row becomes the Initial value on the next row. Basically I want to build a data.frame with 5-10

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Very interesting. Thanks. Very concise! interesting use of cumsum. I'll have to see if I can work that into my real code where I need to take a conditional cumsum. I think it will work. On my system the Final column doesn't seem quite right but that's OK. There's enough here for me to study and I

Re: [R] apply/return and reuse

2009-07-18 Thread Gabor Grothendieck
Here `out` is the same as the final value of `MyDF` in your code using cumsum() instead of a loop: set.seed(123) DF <- data.frame(cbind(Event= 1:10, Initial=0, Offset=round(100*rnorm(10), 0), Final=0 )) out <- transform(DF, Initial = 1 + c(0, head(cumsum(DF$Offset), -1))) out$Final <- with(

Re: [R] how to run the R script in background in Windows XP?

2009-07-18 Thread Cedrick Johnson
Jie- This is what I use (contained within a batch file and runs using windows scheduler every day at 4AM): Rscript --verbose MorningStartup.r > morningsummary-log.txt HTH, c -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jie TANG

[R] Comparing loadings (next to each other)

2009-07-18 Thread Adam D. I. Kramer
Dear colleagues, I've been running some principal components analyses, which generate tables of loadings that I'm interested in looking at. print(f1$rot$load,cutoff=.4) is what I use, and it gives me what I want. However, I'm now interested in comparing these loadings across a

Re: [R] (-8)^(1/3) == NaN?

2009-07-18 Thread Ted Harding
On 18-Jul-09 22:04:57, Dave DeBarr wrote: > Why does the expression "(-8)^(1/3)" return NaN, instead of -2? > > This is not answered by > http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-powers-of-negative- > numbers-wrong_003f > > Thanks, > Dave Because R does not try to evaluate (-8)^(1/3)

Re: [R] (-8)^(1/3) == NaN?

2009-07-18 Thread David Winsemius
The correct mathematical "answer" is really one (or perhaps all three?) of three complex numbers that are the solutions to x^3+8=0. Here is one of the others: > as.complex(-8)^(1/3) [1] 1+1.732051i I suspect there is a reason why R is willing to produce this particular solution and not the

Re: [R] apply/return and reuse

2009-07-18 Thread Gabor Grothendieck
I am not entirely clear on what you want to do but if you simply want a cumulative sum use cumsum: cumsum(rep(100, 5)) + 1 or to do cumsum using Reduce and + try: Reduce("+", rep(100, 5), init = 1, acc = TRUE) On Sat, Jul 18, 2009 at 3:59 PM, Mark Knecht wrote: > Hi Gabor, >   Thanks fo

Re: [R] What is the Datasets License?

2009-07-18 Thread Duncan Murdoch
On 18/07/2009 6:06 PM, Skipper Seabold wrote: Hello, I saw that this question has been asked here before but couldn't find an answer. Are the raw datasets in R in the public domain? Most are based on quite old "classic" published results, so I would then assume that the raw data is public doma

Re: [R] Plotting question

2009-07-18 Thread jim holtman
Your data has commas in the numbers causing them to be read in as factors: > x <- read.table(textConnection(" ID Cn read_count + 1 MJ-2000-79 10,000 6876 + 2 MJ-2000-80 10,000 23440 + 3 MJ-2000-87 10,000 18787 + 4 MJ-2000-100 8000 4775 + 5 MJ-2000-81

Re: [R] (-8)^(1/3) == NaN?

2009-07-18 Thread jim holtman
First of all, read FAQ 7.31 to understand that 1/3 is not representable in floating point. Also a^b is actually exp(log(a) * b) and log(-8) is not valid (NaN). You expression is not really taking the cube root; it is taking values to the 1/3 power. If you want to cube root function, then try: >

[R] Plotting question

2009-07-18 Thread ANJAN PURKAYASTHA
Hi I have a data set that needs to be plotted (see below) When I plot it using the simple plot(read_count ~ Cn), I get box plots for the read_count numbers plotted according to Cn. The Cn's on the x-axis are ordered: 1, 100, 1000, 40, 400, 4000... How do I plot so that Cn is plotted on the x-ax

[R] What is the Datasets License?

2009-07-18 Thread Skipper Seabold
Hello, I saw that this question has been asked here before but couldn't find an answer. Are the raw datasets in R in the public domain? Most are based on quite old "classic" published results, so I would then assume that the raw data is public domain rather than GPL. Can anyone answer this defi

[R] (-8)^(1/3) == NaN?

2009-07-18 Thread Dave DeBarr
Why does the expression "(-8)^(1/3)" return NaN, instead of -2? This is not answered by http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-are-powers-of-negative-numbers-wrong_003f Thanks, Dave [[alternative HTML version deleted]] __ R-help@r-

Re: [R] remote database queries

2009-07-18 Thread Cedrick Johnson
Here's my MYSQL setup for retrieving data: library(RMySQL) channel <- dbConnect(MySQL(), user="xx", password="xx", dbname="HistData", host="nomnom.cvgrllc.com") EDM1 = dbGetQuery(channel, paste("select Date, o, h, l, c, v, a from HistBondData Where Symbol = 'EDM1' AND a != 0 ORDER BY Da

Re: [R] remote database queries

2009-07-18 Thread Gabor Grothendieck
That depends on the database, not R. I have done remote database calls using MySQL from R. On Sat, Jul 18, 2009 at 3:04 PM, David Lubbers wrote: > With good and faithful python remote database queries look something > like this: > > url.urlopen("username/pssw...@host",query) > > where query is so

Re: [R] apply/return and reuse

2009-07-18 Thread Mark Knecht
Hi Gabor, Thanks for the pointer to Reduce. It looks quite interesting. I made an attempt to use it but I'm not clear how I would move the output of the Reduce execution on row 1 to become the Initial value on Row 2. In this output: > MyDF Event Initial Offset Final 1 1 1-31

Re: [R] Package norm has been removed. What to use for ML missing data imputation.

2009-07-18 Thread Karin & Martijn
Hello Daniel, You could consider 'mice'. It is not based on ML, but has a fully conditional approach. More information can be found on www.multiple-imputation.com Greetings, Karin Oudshoorn [[alternative HTML version deleted]] __ R-help@r-pro

Re: [R] remote database queries

2009-07-18 Thread Duncan Murdoch
On 18/07/2009 3:04 PM, David Lubbers wrote: With good and faithful python remote database queries look something like this: url.urlopen("username/pssw...@host",query) where query is something like "select * from table where " Does R support queries on remote hosts with username and passwor

[R] remote database queries

2009-07-18 Thread David Lubbers
With good and faithful python remote database queries look something like this: url.urlopen("username/pssw...@host",query) where query is something like "select * from table where " Does R support queries on remote hosts with username and password? What does a simple example look like? Tha

Re: [R] Calculating the trading days

2009-07-18 Thread spencerg
You also need to know which days are trading vs. non-trading days. To find functions to provide this additional information, I first tried the following: library(RSiteSearch) td <- RSiteSearch.function('trading days') HTML(td) This produced nothing. Therefore, I divided the task

Re: [R] Question on qplot

2009-07-18 Thread David Winsemius
On Jul 18, 2009, at 3:13 PM, RON70 wrote: Ah..now it is working as expected :) Package "plyr" was not loaded automatically. Is it a bug for "ggplot2"? All other dependencies like proto, grid, and reshape are loaded automatically. Before throwing in the bug flag, you should start

Re: [R] Question on qplot

2009-07-18 Thread RON70
Ah..now it is working as expected :) Package "plyr" was not loaded automatically. Is it a bug for "ggplot2"? All other dependencies like proto, grid, and reshape are loaded automatically. Thanks, David Winsemius wrote: > > When I try: > > ?is.formula > > I find that that one version

Re: [R] Question on qplot

2009-07-18 Thread Gabor Grothendieck
Suggest you update everything. Your ggplot2 is still not the most recent. Use the Packages | Update Packages menu and then try again. On Sat, Jul 18, 2009 at 2:32 PM, RON70 wrote: > > I have updated the ggplot2 package as well as R, how got some new error. > >> qplot(x, z) > Error in get("new",

[R] svm works but tune.svm give error

2009-07-18 Thread Noah Silverman
Hello, I'm using the e1071 library for SVM functions. I can quickly train an SVM with: svm(formula = label ~ ., data = testdata) That works well. I want to tune the parameters, so I tried: tune.svm(label ~ ., data=testdata[1:2000, ], gamma=10^(-6:3), cost=10^(1:2)) THIS FAILS WITH AN ERROR: '

Re: [R] Question on qplot

2009-07-18 Thread David Winsemius
When I try: ?is.formula I find that that one version is in package plyr. Perhaps you did not install the dependencies for ggplot2, or they weren't loaded? sessionInfo() ## ? -- DW. > sessionInfo() R version 2.9.1 Patched (2009-07-04 r48897) x86_64-apple-darwin9.7.0 locale: en_US.UTF-8/e

Re: [R] Question on qplot

2009-07-18 Thread RON70
I have updated the ggplot2 package as well as R, how got some new error. > qplot(x, z) Error in get("new", env = FacetGrid, inherits = TRUE)(FacetGrid, ...) : could not find function "is.formula" I cannot understand what is happening with my system. Here I am providing the details of my syst

Re: [R] assignments to function return values

2009-07-18 Thread Duncan Murdoch
On 18/07/2009 1:08 PM, Barry Rowlingson wrote: On Sat, Jul 18, 2009 at 5:47 PM, Bernd wrote: colnames(m) = c("a", "b") I am fairly new to R and trying to understand this language. Having learned quite a few other programming languages the above statement when i saw it first immediately led to t

[R] classification task with RBF neural networks

2009-07-18 Thread Francesco Tatullo
Hello everybody, I'm looking for a way to build an RBF classification network with R but I can't find any. I know there is the 'neural' package, but apparently the RBF networks I can build with that are for approximation tasks only. Is there any package I can use to build an RBF network for a class

Re: [R] assignments to function return values

2009-07-18 Thread Gabor Grothendieck
To get help on a "replacement function" try this: ?"colnames<-" and to see its source: `colnames<-` On Sat, Jul 18, 2009 at 12:47 PM, Bernd wrote: > colnames(m) = c("a", "b") > > I am fairly new to R and trying to understand this language. Having > learned quite a few other programming languag

Re: [R] assignments to function return values

2009-07-18 Thread Barry Rowlingson
On Sat, Jul 18, 2009 at 5:47 PM, Bernd wrote: > colnames(m) = c("a", "b") > > I am fairly new to R and trying to understand this language. Having > learned quite a few other programming languages the above statement > when i saw it first immediately led to two reactions: > > (1) wtf? > > (2) maybe

[R] assignments to function return values

2009-07-18 Thread Bernd
colnames(m) = c("a", "b") I am fairly new to R and trying to understand this language. Having learned quite a few other programming languages the above statement when i saw it first immediately led to two reactions: (1) wtf? (2) maybe they made the function return an object with overloaded assig

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread David Winsemius
On Jul 18, 2009, at 11:14 AM, Elizabeth Stanny wrote: Frank, I had already tried q=c(0.7,0.8,0.9,0.95) as an argument in plot.summary.Design and it did not work (i.e., CIs were not plotted). Could you point me to an example using plot.summary.Design that uses q as argument and has outp

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread David Winsemius
On Jul 18, 2009, at 9:58 AM, Frank E Harrell Jr wrote: David Winsemius wrote: I am completely puzzled by this exchange, first because changing the conf.int argument _does_ affect the output of plot.Design in the expected manner, and second, because the help page of plot.Design includes a

Re: [R] Problem With Repeated Use Of Load/Save/Close Commands

2009-07-18 Thread Duncan Murdoch
On 18/07/2009 11:08 AM, Duncan Murdoch wrote: On 17/07/2009 7:57 PM, Marilyn & Rich Short wrote: Hello, I'm having a problem in R with repeated use of the "load", "save", and "close" commands. I'm getting an error message that reads, "Too many open files". I'm opening files and closing them (

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread Elizabeth Stanny
Frank, I had already tried q=c(0.7,0.8,0.9,0.95) as an argument in plot.summary.Design and it did not work (i.e., CIs were not plotted). Could you point me to an example using plot.summary.Design that uses q as argument and has output? I would greatly appreciate it. Thanks. Elizabeth Usi

Re: [R] storing lm() results and other objects in a list

2009-07-18 Thread Uwe Ligges
Dieter Menne wrote: Idgarad wrote: ... Very long non-self-contained code removed Suggestions on how to handle the whole linearModel and the child data? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Problem With Repeated Use Of Load/Save/Close Commands

2009-07-18 Thread Duncan Murdoch
On 17/07/2009 7:57 PM, Marilyn & Rich Short wrote: Hello, I'm having a problem in R with repeated use of the "load", "save", and "close" commands. I'm getting an error message that reads, "Too many open files". I'm opening files and closing them (and unlinking them), but when I go through tha

[R] package X12

2009-07-18 Thread Ana Quiterio
Dear All. I can't execute X12GUI() from package x12. I have problems in the step : "Please choose the x12 binaries". Can anyone help me? Thanks in advance, AnaQ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://st

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread Frank E Harrell Jr
David Winsemius wrote: I am completely puzzled by this exchange, first because changing the conf.int argument _does_ affect the output of plot.Design in the expected manner, and second, because the help page of plot.Design includes a description of conf.int as a parameter and says its default

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread David Winsemius
I am completely puzzled by this exchange, first because changing the conf.int argument _does_ affect the output of plot.Design in the expected manner, and second, because the help page of plot.Design includes a description of conf.int as a parameter and says its default _is_ 0.95. Using

Re: [R] Question on qplot

2009-07-18 Thread David Winsemius
Also get the expected behavior with: R version 2.9.1 Patched (2009-07-04 r48897) x86_64-apple-darwin9.7.0 #run as 64-bit GUI version under Mac OX X 10.5.7 ggplot2_0.8.2 #installed as CRAN binary zoo_1.5-5 #imstalled as CRAN binary chron_2.3-30 lattice_0.17-25 -- DW On Jul 18, 20

Re: [R] Hmisc, Design, summary.Design plot- changing confidence intervals, adding color or decreasing font size

2009-07-18 Thread Frank E Harrell Jr
Elizabeth Stanny wrote: Hi, 1. I want 95% not 99% confidence intervals in my summary.Design plot using the Design package. Putting conf.int=.95 as an argument in plot does not work. The default appears to be .99 not .95 as stated in the package Design manual (p. 164). Please check the doc

Re: [R] Question on qplot

2009-07-18 Thread Gabor Grothendieck
Although there is no explicit support for ggplot2 in zoo currently (hopefully there will be in the future) both your qplot commands do work for me using: > packageDescription("ggplot2")$Version [1] "0.8.3" > packageDescription("zoo")$Version # devel version [1] "1.6-0" > R.version.string # Windows

[R] Building a big.matrix using foreach

2009-07-18 Thread Michael Knudsen
Hi there! I have become a big fan of the 'foreach' package allowing me to do a lot of stuff in parallel. For example, evaluating the function f on all elements in a vector x is easily accomplished: foreach(i=1:length(x),.combine=c) %dopar% f(x[i]) Here the .combine=c option tells foreach to comb

Re: [R] Question on qplot

2009-07-18 Thread RON70
the plots I am getting is here : http://www.2shared.com/file/6739681/d4c6c9d3/plot.html and http://www.2shared.com/file/6739673/bd50b430/plot.html How you are getting transposed one? smu-2 wrote: > > hey, > > On Sat, Jul 18, 2009 at 01:52:34AM -0700, RON70 wrote: >> >> Hi, suppose I have fol

Re: [R] Question on qplot

2009-07-18 Thread smu
hey, On Sat, Jul 18, 2009 at 01:52:34AM -0700, RON70 wrote: > > Hi, suppose I have following codes : > > library(zoo); library(ggplot2) > dat <- matrix(rnorm(500*2), 500); dat <- zooreg(dat, start = > as.Date("01/01/01", "%m/%d/%y"), frequency=1); plot(dat) > head(dat); month.no <- format(index(

[R] Question on qplot

2009-07-18 Thread RON70
Hi, suppose I have following codes : library(zoo); library(ggplot2) dat <- matrix(rnorm(500*2), 500); dat <- zooreg(dat, start = as.Date("01/01/01", "%m/%d/%y"), frequency=1); plot(dat) head(dat); month.no <- format(index(dat), "%m"); dat1 <- cbind(coredata(dat), as.numeric(month.no)) x <- dat1[

Re: [R] how to run the R script in background in Windows XP?

2009-07-18 Thread Andrej Kastrin
Check out http://akastrin.wordpress.com/2009/06/18/batch-processing-with-r/ HTH, Andrej On Jul 18, 6:04 am, Gabor Grothendieck wrote: > Check out: > > ?Rscript > > > > On Fri, Jul 17, 2009 at 10:14 PM, Jie TANG wrote: > > Hello ,everyone. > > >  I am a fresh user of R. I wrote several several R

Re: [R] Question regarding package submission to CRAN

2009-07-18 Thread Martin Maechler
> "VG" == Vikneswaran Gopal > on Fri, 17 Jul 2009 08:51:55 -0700 writes: VG> It usually gets uploaded within a day if it passes all VG> the checks run by Kurt Hornik. Then the Windows version VG> gets built within the next 24 hours as well. Vik Jim "usually", yes indeed.

Re: [R] Problems generating image from tiff file

2009-07-18 Thread Paul Hiemstra
Hi Mehdi, No problem, we all have to start somewhere! Glad to have helped. If you take a look at http://wiki.r-project.org/rwiki/doku.php?id=tips:spatial-data:spatial_data_visualization you will find some tips on how to plot spatial data using spplot. Including how to plot a grid together wit