Re: [R] How to get last day of a month?

2009-09-13 Thread Diethelm Wuertz
jim holtman wrote: just use timeDate from Rmetrics, there you will find several functions like ... # timeLastDayInMonthComputes the last day in a given month and year # timeFirstDayInMonth Computes the first day in a given month and year # timeLastDayInQuarter Computes t

[R] How to set default plotting colors by treatment?

2009-09-13 Thread Remko Duursma
Dear R-helpers, I have a number of dataframes that looks something like this: mydfr <- data.frame(treatment=c(rep("A",3),rep("B",3)), Xmeas=1:6, Ymeas=c(2,4,3,3,5,6)) # except with many more variables, which I plot all the time colored by treatment to quickly check things: with(mydfr, plot(Xmeas

Re: [R] (no subject)

2009-09-13 Thread Schalk Heunis
Karen You can copy and paste data directly into R from Excel: 1. Mark the data including the headings in Excel 2. Ctrl-C 3. In R: myDF <- read.delim("clipboard") Following from Milton: hist(myDF$VARNAME) or hist(myD[,1]) #to plot 1st collumn hist(myD[,2]) #to plot 2nd collumn Schalk Heunis On M

Re: [R] Question about Factors

2009-09-13 Thread Schalk Heunis
On Mon, Sep 14, 2009 at 5:19 AM, Schalk Heunis wrote: > Chris > try this (assume your dataset is in a dataframe called ms): > library(lattice) > xyplot(Value~Time|Name,data = ms) > > HTH > Schalk > > > > On Mon, Sep 14, 2009 at 2:19 AM, Chris Li wrote: > >> >> Hi all, >> >> I am new to R and I hav

[R] How to specify knots and knots boundary in GAM

2009-09-13 Thread Yan Li
Dear all, I have 10 studies. I want to fit a generalized additive model for each of 8 studies. For combining the results from 10 studies, I have to specify the same knots (30,40,50,60,70,80,90) and knots boundary, 20 and 100, in gam(mgcv). Now I just found knots= option in the gam function, so I a

Re: [R] Question about Factors

2009-09-13 Thread cls59
Chris Li wrote: > > Hi all, > > I am new to R and I have got a question in regards to factors. > > Say I have a simple dataset like the following: > > Name Time Value > a 1:00 1.25 > a 2:00 1.26 > b 1:00 1.29 > b 2:00 1.28 > c 1:0

Re: [R] turning a list into a function's params

2009-09-13 Thread Rolf Turner
On 14/09/2009, at 2:34 PM, Jack Tanner wrote: Apologies for the noob question. I need to split setting up a plot and drawing it into two functions. One determines the properties of a plot (data, axis, labels, etc.), and the other plots it (using a preferred device, image dimensions, etc.).

[R] turning a list into a function's params

2009-09-13 Thread Jack Tanner
Apologies for the noob question. I need to split setting up a plot and drawing it into two functions. One determines the properties of a plot (data, axis, labels, etc.), and the other plots it (using a preferred device, image dimensions, etc.). get.props = function() { list(x=x, y=y, xlab="foo",

[R] Question about Factors

2009-09-13 Thread Chris Li
Hi all, I am new to R and I have got a question in regards to factors. Say I have a simple dataset like the following: Name Time Value a 1:00 1.25 a 2:00 1.26 b 1:00 1.29 b 2:00 1.28 c 1:00 1.21 c 1:30 1.20 c

Re: [R] ountour "resolution"

2009-09-13 Thread David Winsemius
On Sep 13, 2009, at 6:54 PM, (Ted Harding) wrote: Greetings all! I'm wanting to plot contours of a function, and I don't want to evaluate it at a dense grid of points (i.e. I don't want a huge array of values). Say I have a vector of x-values such as x <- 0.1*c(1:10), and the same for y <- 0.1

Re: [R] Way to iteratively change line color and line style

2009-09-13 Thread Steve Lianoglou
Hi, On Fri, Sep 11, 2009 at 8:12 PM, Jason Rupert wrote: > I would like to have a way to automatically change the line color and line > style. For auto-generating colors, try ?rainbow Not sure about what you can do about alternating the line style ... -steve -- Steve Lianoglou Graduate Stud

Re: [R] (no subject)

2009-09-13 Thread milton ruser
Hi Karen, As you are just starting (I guess), I suggest you take a shortcut: 1. copy and paste the data from Excel to the notepad, and save it as .TXT 2. If all is ok, you will have a tab-delimited file. 3. Be sure that your variables have its names on first line 4. read your data using setwd("c:

Re: [R] R on Multi Core

2009-09-13 Thread Michael Bibo
Noah Silverman smartmediacorp.com> writes: > > Hi, > > Our discussions about 64 bit R has led me to another thought. > > I have a nice dual core 3.0 chip inside my Linux Box (Running Fedora 11.) > > Is there a version of R that would take advantage of BOTH cores?? > (Watching my system perfo

[R] CRAN (and crantastic) updates this week

2009-09-13 Thread Crantastic
CRAN (and crantastic) updates this week New packages * ant (0.0-6) Romain Francois http://crantastic.org/packages/ant Version of the ant apache build tool, with a few R specific tasks to ease use of ant within an R package * caroline (0.1-1) David M. Schruth http://cran

[R] (no subject)

2009-09-13 Thread Karen Federico
How would I make a histogram using R from a table in excel that has 4 variables, but I only want to use 2 of the columns to make the histogram? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailm

Re: [R] ountour "resolution"

2009-09-13 Thread David Winsemius
Have you looked at lowess? That is the function that Harrell's perimeter function calls for that purpose. -- David On Sep 13, 2009, at 6:54 PM, (Ted Harding) wrote: Greetings all! I'm wanting to plot contours of a function, and I don't want to evaluate it at a dense grid of points (i.e. I don

[R] ountour "resolution"

2009-09-13 Thread Ted Harding
Greetings all! I'm wanting to plot contours of a function, and I don't want to evaluate it at a dense grid of points (i.e. I don't want a huge array of values). Say I have a vector of x-values such as x <- 0.1*c(1:10), and the same for y <- 0.1*(0:10). I then evaluate a 10*10 matrix z of values o

Re: [R] lean text label below barplot table

2009-09-13 Thread Ilai
par(xpd=T) bp<- barplot(matrix(1:50,5,10),names=F) text(bp,-2,c('these labels','are tooo','looong'),pos=2,srt=45) Xiaogang Yang wrote: > > Hi, everyone: > I am plotting an graph with bar plot, but the label after every bar is too > long, I wanna if I can draw the label lean to an angle > t

Re: [R] Brand new To R

2009-09-13 Thread czarjosh
Thanks everyone for all of the help. -- View this message in context: http://www.nabble.com/Brand-new-To-R-tp25424799p25426303.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/m

Re: [R] making package interface with FORTRAN under windows

2009-09-13 Thread cls59
Carrie Li wrote: > > Dear r-help group, > > I am creating a package that has some FORTRAN code under windows. I have > read through "Writing R Extension" but still not so clear about the steps. > > Before R CMD build, how can I create a dynamic library and later in my R > function using dyn

Re: [R] Brand new To R

2009-09-13 Thread Ted Harding
On 13-Sep-09 16:47:07, czarjosh wrote: > > I am trying to learn R right now. I came from minitab and wanted > to learn something a bit more robust. I am trying to figure out > some simple probability to measures but I do not know the commands. > I am using > OSX. Are there resources for figuring o

Re: [R] Brand new To R

2009-09-13 Thread cls59
czarjosh wrote: > > I am trying to learn R right now. I came from minitab and wanted to > learn something a bit more robust. I am trying to figure out some simple > probability to measures but I do not know the commands. I am using OSX. > Are there resources for figuring out simple events

Re: [R] How to get last day of a month?

2009-09-13 Thread Gabor Grothendieck
That should have been yearmon (not yearqtr): > library(zoo) # as.yearqtr > > # test data > x <- c("sep2009", "oct2009") > > # convert to "yearmon" class and from that to Date using frac = 1 > # where frac is between 0 and 1 inclusive indicating where > # in the month the output date should be set

Re: [R] How to get last day of a month?

2009-09-13 Thread Gabor Grothendieck
Try this: > library(zoo) # as.yearqtr > > # test data > x <- c("sep2009", "oct2009") > > # convert to "yearqtr" class and from that to Date using frac = 1 > # where frac is between 0 and 1 inclusive indicating where > # in the month the output date should be set to > > as.Date(as.yearqtr(x, "%b%Y"

Re: [R] Brand new To R

2009-09-13 Thread David Winsemius
On Sep 13, 2009, at 12:47 PM, czarjosh wrote: I am trying to learn R right now. I came from minitab and wanted to learn something a bit more robust. I am trying to figure out some simple probability to measures but I do not know the commands. I am using OSX. Are there resources for

Re: [R] How to get last day of a month?

2009-09-13 Thread jim holtman
Does this help. Shows how to use the basic functions to get at the answer: > # add first day of month to make it valid > x <- as.POSIXct(paste('1', 'sep2009', sep=''), format="%d%b%Y") > # now advance one month and then go back one day for the end of the month > next.mon <- seq(x, length=2, by='1

[R] How to get last day of a month?

2009-09-13 Thread megh
Is there any R function to calculate automatically the last day of a particular month? For example "sep2009" should be converted to last day of September of 2009? Thanks -- View this message in context: http://www.nabble.com/How-to-get-last-day-of-a-month--tp25425645p25425645.html Sent from the

Re: [R] Triangular distribution for kernel regression

2009-09-13 Thread Gabor Grothendieck
If by chance you have an objective function you could automatically calculate the optimum number of nearest neighbors by cross validation eliminating the need to set it in the first place. On Sun, Sep 13, 2009 at 10:19 AM, Bryan wrote: > Is this option (number of nearest neighbors) translate-able

[R] Brand new To R

2009-09-13 Thread czarjosh
I am trying to learn R right now. I came from minitab and wanted to learn something a bit more robust. I am trying to figure out some simple probability to measures but I do not know the commands. I am using OSX. Are there resources for figuring out simple events? If I have data distributed

Re: [R] Manage an unknown and variable number of data frames

2009-09-13 Thread Mark Knecht
Hi David, Thanks. This has really helped me clarify my needs and the results are now far closer to what I need. I've dropped stuff I didn't really need to keep out of the data array and clarified the subset equation. The one place where I still need some help is in the automatic creation of

Re: [R] How can I get "predict.lm" results with manual calculations ? (a floating point problem)

2009-09-13 Thread David Winsemius
On Sep 13, 2009, at 1:19 PM, Tal Galili wrote: Hello dear r-help group I am turning for you for help with FAQ number 7.31: "Why doesn't R think these numbers are equal?" http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f *My story* is this: I

[R] making package interface with FORTRAN under windows

2009-09-13 Thread Carrie Li
Dear r-help group, I am creating a package that has some FORTRAN code under windows. I have read through "Writing R Extension" but still not so clear about the steps. Before R CMD build, how can I create a dynamic library and later in my R function using dyn.load ("xxx.dll") ? If I already have

[R] How can I get "predict.lm" results with manual calculations ? (a floating point problem)

2009-09-13 Thread Tal Galili
Hello dear r-help group I am turning for you for help with FAQ number 7.31: "Why doesn't R think these numbers are equal?" http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f *My story* is this: I wish to run many lm predictions and need to have them

[R] is it possible: predict.lm on a matrix instead of a data.frame ?

2009-09-13 Thread Tal Galili
Hello dear R-help members. I need to run many "predict.lm" routines, and was hoping to have it run faster then it does now. One way I was thinking about was to have it run on a matrix instead on a data.frame (since in my situation a matrix will suffice). Can someone suggest to me of ways to have

Re: [R] Help with Loop Please!

2009-09-13 Thread Henrique Dallazuanna
Try this: apply(subset.models[,-1], 1, function(x)lm(as.formula(paste('y ~', paste(names(freeny[,-1])[x], collapse = "+"), sep = "")), data = freeny)) On Sun, Sep 13, 2009 at 10:57 AM, Axel Urbiz wrote: > Hi, > > I’d like to fit one GLM model for each possible combination of inputs (i.

Re: [R] Triangular distribution for kernel regression

2009-09-13 Thread Bryan
Is this option (number of nearest neighbors) translate-able into bandwidth? In reading the kknn article, it seems like it might be but I'm still not exactly sure how. Unfortunately this is an important issue as the end users are used to using certain bandwidth values for their work. It may be more

Re: [R] how to determine if a variable is already set?

2009-09-13 Thread Michael Knudsen
On Fri, Sep 11, 2009 at 7:15 PM, carol white wrote: > It might be a primitive question but how it is possible to determine if a > variable is initialized in an environment? What about this? > "x" %in% ls() [1] FALSE > x = 41 > "x" %in% ls() [1] TRUE Best, Michael -- Michael Knudsen micknud.

[R] Help with Loop Please!

2009-09-13 Thread Axel Urbiz
Hi, I’d like to fit one GLM model for each possible combination of inputs (i.e. exhaustive search). The package leaps can help me to generate all possible variable subsets, but I’ll appreciate your guidance as of how to generate one model for each of those possible subsets. I’m new in R! Thanks i

Re: [R] Sorting

2009-09-13 Thread Erich Neuwirth
months<-c("jan","feb","mar","apr","may","jun", "jul","aug","sep","oct","nov","dec") sortorder<-order(as.numeric(date2[,2]),match(date2[,1],months)) date2[sortorder,] is probably what you want. megh wrote: > I have following object : > >> date2 >[,1] [,2] > [1,] "ap

Re: [R] how to find maximum for multivariable data

2009-09-13 Thread caroline choong
Many thanks, truly a simple and elegant solution! Caroline On Sun, Sep 13, 2009 at 12:08 AM, David Winsemius wrote: > > On Sep 12, 2009, at 11:36 AM, caroline choong wrote: > >> Dear all, >> I have a data set as follows: >> >>        ID               cycle.number      cycle.result >> 1     2525

Re: [R] R on Multi Core

2009-09-13 Thread Michael Knudsen
On Fri, Sep 11, 2009 at 10:05 PM, Noah Silverman wrote: > Is there a version of R that would take advantage of BOTH cores?? Well, if your job is parallelizable, it's actually fairly easy. When I discovered the package 'foreach', I wrote the following piece completely overwhelmed by enthusiasm:

[R] Stability VAR plot

2009-09-13 Thread Arif Chandra
I have created stability plot for Vector Auto Regressive model. But, how can I find the boundary for stability plot? Thanks in advance _ [[alternative HTML version deleted]] __ R

Re: [R] zoo plot: yearly marks on X-Axis

2009-09-13 Thread lanczos
Many thanks, the solution is simple and elegant, as usual ;). R is a great tool, the best I know, unfortunately I need more time to practice ... regards Tomas On Sat, 2009-09-12 at 22:52 -0400, Gabor Grothendieck wrote: > Try this: > > library(zoo) > x <- zoo(rnorm(1:6000), as.Date("1992-11-11"

Re: [R] How to visualize paired t-test results?

2009-09-13 Thread johannes rara
Thanks Tal. I modified my code based on your suggestion (below). It would be nice to see other solutions also. data ## sam1 <- c(51.7, 54.2, 53.3, 57, 56.4, 61.5, 57.2, 56.2, 58.4, 55.8) sam2 <- c(62.5, 65.2, 67.6, 69.9, 69.4, 70.1, 67.8, 67, 68.5, 62.4) DF <- stack(data.frame(sam1 = sam1,

[R] Regarding Performance and Prediction routines of rattle library and XML package

2009-09-13 Thread Abbas R. Ali
Hi   Can anybody tell me in which library Performance and Prediction routines exist to find AUC and I am unable to find a dependency of rattle library, XML, for Windows can any body tell me about that.   Thanks [[alternative HTML version deleted]] ___