Re: [R] Find missing days

2008-01-01 Thread Lauri.Nikkinen
Thanks Gabor for your reply. Your script will find missing days in date1 range but my intention was to find missing days in each level (df$lev) in corresponding month. The resulting df could look like this: lev date1 1 lev1 2007-09-03 2 lev1 2007-09-04 4 lev1 2007-09-24 5 lev1 2007-09

Re: [R] Find missing days

2008-01-01 Thread Gabor Grothendieck
Try this. It creates a sequence of dates from the range of df$date1 and then does a setdiff between that and the original dates. The result is numeric so we create a Date structure out of it. structure(setdiff(do.call(seq, as.list(range(df$date1))), df$date1), class = "Date") On Jan 2, 2008 1:

[R] Find missing days

2008-01-01 Thread Lauri.Nikkinen
Hi, I have a data.frame like this: y <- rnorm(60) lev <- gl(3,20, labels=paste("lev", 1:3, sep="")) date1 <- as.Date(seq(ISOdate(2007,9,1), ISOdate(2007,11,5), by=60*60*24)) date1 <- date1[-c(3,4,15,34,38,40)] df <- data.frame(lev=lev, date1=date1, y=y) I would like to produce a new data.frame w

Re: [R] How to convert day-month-year to Julian data number?

2008-01-01 Thread Prof Brian Ripley
On Tue, 1 Jan 2008, jim holtman wrote: Is this what you want? x <- c('5/5/2007', '12/31/2007') # convert to day of year (Julian date) -- use POSIXlt strptime(x, "%m/%d/%Y")$yday+1 [1] 125 365 I don't think that is the usual definition of JDN: see http://en.wikipedia.org/wiki/Julian_day. A

[R] USA map with all states

2008-01-01 Thread Edna Bell
Hi R Gurus! There was a function in S called "usa()" which would plot the US. I found map('usa') in R for the lower 48 states. Is there a way to include Alaska and Hawaii as well, please? Thanks, Edna Bell __ R-help@r-project.org mailing list https:/

[R] How to select a reasonable shrinkage coefficient in stepplr?

2008-01-01 Thread Tirthadeep
Dear R-users, I am using stepplr for L2 regularized logistic regression. Since number of attribute is too large i discarded interaction terms. Everything is fine but only problem i have faced that i cannot choose a good shrinkage coefficient (lambda). If CV is the best way to estimate, can you pl

Re: [R] Subsetting data frame problem....

2008-01-01 Thread Simon Blomberg
Or use complete.cases df.complete <- df[complete.cases(df),] Simon. On Wed, 2008-01-02 at 13:21 +1000, Ross Darnell wrote: > You could try > > > > complete.case.df <- na.omit(df) > > > Ross Darnell > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On B

Re: [R] COMPAR.GEE error with logistic model

2008-01-01 Thread Simon Blomberg
My guess is that this combination of variables produces separation in the data: Too many (all?) of the response 1's are in at level of VAR3, and the 0's are at the other level (or vice versa). HTH, Simon. On Sat, 2007-12-29 at 18:39 -0500, Charles Willis wrote: > Hello, > > I am trying to run t

Re: [R] Subsetting data frame problem....

2008-01-01 Thread Ross Darnell
You could try > complete.case.df <- na.omit(df) Ross Darnell -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marko Milicic Sent: Wednesday, 2 January 2008 11:50 AM To: r-help@r-project.org Subject: [R] Subsetting data frame problem Dear R users,

Re: [R] Subsetting data frame problem....

2008-01-01 Thread jim holtman
?complete.cases On Jan 1, 2008 8:50 PM, Marko Milicic <[EMAIL PROTECTED]> wrote: > Dear R users, > > I'm new but already fascinated R user so please forgive for my > ignorance. I have the problem, I read most of help pages but couldn't > find the solution. The problem follows > > I have large

[R] Subsetting data frame problem....

2008-01-01 Thread Marko Milicic
Dear R users, I'm new but already fascinated R user so please forgive for my ignorance. I have the problem, I read most of help pages but couldn't find the solution. The problem follows I have large data set 10,000 rows and more than 100 columns... Say something like var1,var2,var2,var4.

Re: [R] Symbolic substitution in parallel; use infinity symbol?

2008-01-01 Thread John Maindonald
Actually this works beautifully as it stands: breaks <- c(-Inf, -1, 1, Inf) zz <- lapply(breaks, function(x) if(x==-Inf) quote(-infinity) else if (x==Inf) quote(infinity) else format(x)) lbl <- mapply(function(x,y) bquote("(" * .(x) * "," * .(y) * "]"),

Re: [R] if statement problem

2008-01-01 Thread Gabor Grothendieck
Try: das$danger <- with(das, (age > 65) * (bmi > 30)) On Jan 1, 2008 5:03 PM, Gerard Smits <[EMAIL PROTECTED]> wrote: > Hi All, > > I have a small dataset named das (43 cases) in which I am trying to > create a binary outcome (1/0) based on the following code: > > if (das$age>65 && das$bmi>30) {

Re: [R] if statement problem

2008-01-01 Thread Gerard Smits
Hi Domenico, I was incorrectly assuming it would use a vector of equal length to my data. frame. Thanks for the clarification. Also, thanks for the many alternate programming approaches provided by others. Gerard At 02:25 PM 1/1/2008, Domenico Vistocco wrote: >You should look for your answer

Re: [R] if statement problem

2008-01-01 Thread Tim Calkins
you could try the following: >das$danger <- 0 >das$danger[das$bmi > 30 & das$age > 65] <- 1 On Jan 2, 2008 9:16 AM, Gerard Smits <[EMAIL PROTECTED]> wrote: > > Thanks, but I tried the single ampersand, but got a warning msg with > the same lack of correct assignment: > > > if (das$age>65 & das

Re: [R] if statement problem

2008-01-01 Thread Domenico Vistocco
You should look for your answer using the help for the if statement (?"if"). The cond argument should be a scalar (otherwise only the first element is used). ?"if" . cond: A length-one logical vector that is not 'NA'. Conditions of length greater than one are accepted with a warnin

Re: [R] if statement problem

2008-01-01 Thread Gerard Smits
Thanks, but I tried the single ampersand, but got a warning msg with the same lack of correct assignment: > if (das$age>65 & das$bmi>30) {das$danger<-1} else das$danger<-0 Warning message: In if (das$age > 65 & das$bmi > 30) { : the condition has length > 1 and only the first element will be

Re: [R] if statement problem

2008-01-01 Thread Christos Hatzis
You need to use '&' instead of '&&': A shorter version of your code using ifelse: das$danger <- with(das, ifelse(age>65 & bmi>30, 1, 0)) HTH -Christos > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Gerard Smits > Sent: Tuesday, January 01, 200

Re: [R] How to convert day-month-year to Julian data number?

2008-01-01 Thread jim holtman
Is this what you want? > x <- c('5/5/2007', '12/31/2007') > # convert to day of year (Julian date) -- use POSIXlt > strptime(x, "%m/%d/%Y")$yday+1 [1] 125 365 On Jan 1, 2008 4:59 PM, Nüzhet Dalfes <[EMAIL PROTECTED]> wrote: > Hi, > > Is there a package for converting day-month-year type date to

[R] if statement problem

2008-01-01 Thread Gerard Smits
Hi All, I have a small dataset named das (43 cases) in which I am trying to create a binary outcome (1/0) based on the following code: if (das$age>65 && das$bmi>30) {das$danger<-1} else das$danger<-0 I am setting a flag called 'danger' to 1 of the subject is over 65 and has a BMI > 30. I fin

[R] How to convert day-month-year to Julian data number?

2008-01-01 Thread Nüzhet Dalfes
Hi, Is there a package for converting day-month-year type date to julian day number (JDN)? I looked around and I couldn't find any (I am pretty new to R...) Thanks and happy New Year to everybody! H. Nüzhet Dalfes Professor, Istanbul Technical University Eurasia Institute of Earth Scienc

Re: [R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-01 Thread Charles C. Berry
On Tue, 1 Jan 2008, zhijie zhang wrote: > Dear all, > I have two variables, y and x. It seems that the relationship between them > is Piecewise Linear Functions. The cutpoint is 20. That is, when x<20, there > is a linear relationship between y and x; while x>=20, there is another > different lin

Re: [R] How to import ENSEMBL text data using R

2008-01-01 Thread Jean lobry
Dear Anisah, ENSEMBL data are at your hand under R: > library(seqinr) > choosebank("ensembl") > cat(banknameSocket$details, sep = "\n") ACNUC Data Base Content Ensembl Release 47 Last Updated: Dec 12, 2007 76,798,685,993 bases; 3,138,133 s

[R] predicted proximity in cforest

2008-01-01 Thread Joesph
Hello there, Happy new year. As I know, we can get proximity of new data in randomForest package. How to get the proximity matrix of new data in party package then? Thanks. Joseph [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Trying to install rjags on Mac OS X 10.5

2008-01-01 Thread 0093
Dear Lindsay, If you "pkgconfig" installed by MacPorts. Maybe it likely to be caused by JAGS install. You'll better to do sudo make uninstall ./configure --prefix=/usr/local --mandir=/usr/local/share/man make sudo make install sudo R CMD INSTALL -l /Library/Frameworks/R.framework/Resources/li

Re: [R] Alignment and Labeling of a color key in a xyplot?

2008-01-01 Thread Gabor Grothendieck
Is this what you want (same as your except the draw.key and reference to grid is removed key=... is added in the xyplot call: library(lattice) x <- 1:3 colorseq < c(0.2, 0.5, 0.8) mycolors <- gray(colorseq) xyplot(x ~ x, col = mycolors, aspect = 1, key = list(rect = list(col = mycolors), text =

Re: [R] Alignment and Labeling of a color key in a xyplot?

2008-01-01 Thread Deepayan Sarkar
On 1/1/08, Hofert Marius <[EMAIL PROTECTED]> wrote: > Happy New Year to all R users! > > I have two short questions concerning a xyplot with a color key: > > 1) How do I properly place (align) the color key beside the xyplot? > As you can see from the code listed below, the placement of the color >

Re: [R] passing args from the command line

2008-01-01 Thread Uwe Ligges
Richard Müller wrote: > Happy New Year to all! > > I want to run a script from a directory on a central server on different > machines, linux and windows. To determine which machine is calling the script > I want to pass an argument with the call (e.g. for choosing the display > device, for w

Re: [R] access data inside package

2008-01-01 Thread Uwe Ligges
baptiste Auguié wrote: > Dear all, > > Happy new year! > > I posted a very similar question a few days ago, but probably too > cluttered. Here is a tidy, minimal version: > > I want to make a package, with a data.frame d and a function f given > below. Now, the function f needs to use the

[R] Specify a correct formula in R for Piecewise Linear Functions?

2008-01-01 Thread zhijie zhang
Dear all, I have two variables, y and x. It seems that the relationship between them is Piecewise Linear Functions. The cutpoint is 20. That is, when x<20, there is a linear relationship between y and x; while x>=20, there is another different linear relationship between them. How can i specify t

Re: [R] Bootstrap Confidence Intervals

2008-01-01 Thread _Fede_
Thank you very much for your help, Chuck. But I don't understand the function "statistic" nor that his arguments make. Those arguments do not take value at any moment, according to I understand (I have not given values to "d" nor "ind"). It is not thus? Can you explain me, please? Thanks. _Fede

Re: [R] Bootstrap Confidence Intervals

2008-01-01 Thread Chuck Cleland
_Fede_ wrote: > Hi again. > > Watching this example that appears in the help page > > ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) > city.boot <- boot(city, ratio, R = 999, stype = "w",sim = "ordinary") > boot.ci(city.boot, conf = c(0.90,0.95),type = > c("norm","basic","perc","bca")) > > I

Re: [R] Non-Linear Quantile Regression

2008-01-01 Thread Philippe Grosjean
Hello, You use nlrq() pretty much the same as nls(). Look at ?nls and you will find there many examples on how to use it. The easiest way is to use with a "self-start model". Do apropos("^ss") to get the list of self-starting models defined, and look at their respective help pages to see if on

[R] Non-Linear Quantile Regression

2008-01-01 Thread Humberto Marotta
Please, I have a problem with nonlinear quantile regression. My data shows a large variability and the quantile regression seemed perfect to relate two given variables. I got to run the linear quantile regression analysis and to build the graph in the R (with quantreg package). However, the up p

Re: [R] Bootstrap Confidence Intervals

2008-01-01 Thread _Fede_
Hi again. Watching this example that appears in the help page ratio <- function(d, w) sum(d$x * w)/sum(d$u * w) city.boot <- boot(city, ratio, R = 999, stype = "w",sim = "ordinary") boot.ci(city.boot, conf = c(0.90,0.95),type = c("norm","basic","perc","bca")) I have tried to do the following (c

[R] passing args from the command line

2008-01-01 Thread Richard Müller
Happy New Year to all! I want to run a script from a directory on a central server on different machines, linux and windows. To determine which machine is calling the script I want to pass an argument with the call (e.g. for choosing the display device, for writing path names etc.) I tried the

[R] Variable scope R 2.6.1

2008-01-01 Thread Stefan Eichenberger
I have the following procedure which worked just fine for in R 2.2.0. Recently I upgraded to 2.6.1 and now get an error: > ScatterOutlier(pass_500_506[1:1000,6:12], marginal_500_506[,6:12]) Error in eval(expr, envir, enclos) : object "out" not found Note that I use the same workspace (and h

[R] Alignment and Labeling of a color key in a xyplot?

2008-01-01 Thread Hofert Marius
Happy New Year to all R users! I have two short questions concerning a xyplot with a color key: 1) How do I properly place (align) the color key beside the xyplot? As you can see from the code listed below, the placement of the color key is not correct. I would like the upper and lower end poin

[R] proximity on prediction in cforest

2008-01-01 Thread Joesph
Hello there, How to get the proximity matrix of new data in party package? Thanks. Joseph [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide h

[R] access data inside package

2008-01-01 Thread baptiste Auguié
Dear all, Happy new year! I posted a very similar question a few days ago, but probably too cluttered. Here is a tidy, minimal version: I want to make a package, with a data.frame d and a function f given below. Now, the function f needs to use the data.frame d. I could (and that's what I'

Re: [R] help on ROC analysis

2008-01-01 Thread zhijie zhang
Thanks. library(ROCR) was used finally. It also automatically generate a plot beside the value of AUC. On Dec 31, 2007 11:38 PM, Frank E Harrell Jr <[EMAIL PROTECTED]> wrote: > zhijie zhang wrote: > > Dear all, > > Some functions like 'ROC(Epi)' can be used to perform ROC analyssi, > but it > >