Re: [R] Gls function in rms package

2012-04-29 Thread Mark Seeto
Frank, sorry if I seem impatient, but do you know approximately when this will be fixed? In the meantime, if I have library(nlme) library(rms) d <- data.frame(x = rnorm(50), y = rnorm(50)) and I'm interested in the 3 df test for x that I would get from anova(Gls(y ~ rcs(x, 4), data=d, correlati

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Mike Miller
On Sun, 29 Apr 2012, Daniel Nordlund wrote: I don't know what the OP is really trying to accomplish yet, and I am not motivated (yet) to try to figure it out. However, all this "flooring" and "ceiling) and "rounding" is not necessary for generating uniform random integers. For N integers in

Re: [R] Equivalent of Nothing (in VBA) or [] in Matlab in R

2012-04-29 Thread Rui Barradas
Hello, There are other types of "empty" objects in R (zero length or dimension). Maybe some of these x <- list() length(x) x <- matrix(list()) dim(x) <- c(0, 0) x Matlab's [] is the empty matrix so maybe the second works. Other possibilities could be x <- numeric(0) (or integer(0) or character(

Re: [R] Equivalent of Nothing (in VBA) or [] in Matlab in R

2012-04-29 Thread lm
Thanks Michael. I tried with NULL - It throws Type mismatch error and same error while passing c() or defining a<- c() and then passing a as parameter Also tried with not passing any parameter, then it says 'Parameter not optional'. I am afarid no joy. Thanks Regards,lmDate: Sun, 29 Apr 2012

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Mike Miller > Sent: Sunday, April 29, 2012 5:21 PM > To: Vale Fara > Cc: r-help@r-project.org; billy am > Subject: Re: [R] generate random numbers for lotteries > > On Mon, 30 Apr

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Mike Miller
On Mon, 30 Apr 2012, Vale Fara wrote: ok, what to do is to generate two sets (x,y) of integer uniform random numbers so that the following condition is satisfied: the sum of the numbers obtained in x,y matched two by two (first number obtained in x with first number obtained in y and so on) is

Re: [R] generate random numbers for lotteries

2012-04-29 Thread R. Michael Weylandt
On Sun, Apr 29, 2012 at 4:38 PM, Vale Fara wrote: > Hi, > > thank you both for your replies, I really appreciate it! > > To Mike: yes, random integers. Can I use the function round() as in > the example with 5 random numbers below? > > To Billy: for the second part I got an error, but it may be th

Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread Rui Barradas
Right. Michael Weylandt wrote > > I'd use a combination of rownames(), grepl() and sum(). > > Get the names with the first, test with the second and count the positives > (by coercing TRUE -> 1) with the last > > Michael > > On Apr 29, 2012, at 3:46 PM, katarv wrote: > >> Hi,

[R] need help with avg.surv (Direct Adjusted Survival Curve)

2012-04-29 Thread Manish Dalwani
Hello R users,  I am trying to obtain a direct adjusted survival curve. I am sending my whole code (see below). It's basically the larynx cancer data with Stage 1-4. I am using the cox model using coxph option, see the fit3 coxph. When I use the avg.surv option on fit3, I get the following erro

Re: [R] generate random numbers for lotteries

2012-04-29 Thread jim holtman
I would assume that you would use 'sample' to draw the numbers: > sample(0:10,60,TRUE) [1] 2 3 1 2 9 2 2 0 3 [10] 0 4 2 3 9 7 3 10 9 [19] 8 5 8 7 6 3 10 0 6 [28] 8 10 6 3 3 2 7 0 0 [37] 1 4 8 2 10 2 0 7 9 [46] 9 9 7 9 6 10 1 1 6 [55] 1 8 3 8 2

Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread Rui Barradas
Hello, katarv wrote > > Hi, > > I have a large data set that I input as a matrix, where I have 1:x rows > with names AX, then x+1: y rows named AY, etc. The idea is that I have > to count how many rows exactly I have with name AX and how many I have > with name AY (or find which row numbers

[R] CRAN (and crantastic) updates this week

2012-04-29 Thread Crantastic
CRAN (and crantastic) updates this week New packages * anoint (1.0) Maintainer: S. A. Kovalchik Author(s): Ravi Varadhan and Stephanie Kovalchik License: GPL (>= 2) http://crantastic.org/packages/anoint Tools for assessing multiple treatment-covariate interactions with

Re: [R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread R. Michael Weylandt
I'd use a combination of rownames(), grepl() and sum(). Get the names with the first, test with the second and count the positives (by coercing TRUE -> 1) with the last Michael On Apr 29, 2012, at 3:46 PM, katarv wrote: > Hi, > > I have a large data set that I input as a matrix, where I hav

Re: [R] generate random numbers for lotteries

2012-04-29 Thread Vale Fara
Hi, thank you both for your replies, I really appreciate it! To Mike: yes, random integers. Can I use the function round() as in the example with 5 random numbers below? To Billy: for the second part I got an error, but it may be that I didn't properly set "i"...? Here is the R output: x <- runi

[R] Xy plot help

2012-04-29 Thread arun
Dear R group, Tried to turn off the html in yahoo.  So far  not successful.  Apologies! I tried to get xyplot shrink fit for my mixed model.  But, the mixed model line is not seen in the graph. I would like to know if there is anything wrong with my code. Thanks, A.K. (fm1 <- lmer(Response3 ~

Re: [R] [R-sig-ME] Xy plot help

2012-04-29 Thread Hugo . Mildenberger
On Sun, 29 Apr 2012 11:27:06 -0700 (PDT) arun wrote: > I tried to get xyplot shrink fit for my mixed model._ But, the mixed model > line is not seen in the graph. > I would like to know if there is anything wrong with my code. Typo? Try panel.abline(fixef(fm1),... or panel.abline(ff), ... __

[R] Error in if (nuhat < 2) stop("The degrees of freedom must be greater than or equal to 2") : missing value where TRUE/FALSE needed

2012-04-29 Thread Kyriakos Antoniou
Hi, i am trying to run an ANCOVA and a bootstrapped ANCOVA analysis on a specific data set. I am using the ancova and ancboot functions as in the following code: setwd("C:/Users/User/Desktop/Rdatabilingualstudy2012") bilingualismdata<-read.spss("bilingualdataforconferences2012.sav", use.valu

[R] CForest Error Logical Subscript Too Long

2012-04-29 Thread Abigail Clifton
Hi, This is my code (my data is attached): library(languageR) library(rms) library(party) OLDDATA <- read.csv("/Users/Abigail/Documents/OldData250412.csv") OLDDATA$YD <- factor(OLDDATA$YD, label=c("Yes", "No"))  OLDDATA$ND <- factor(OLDDATA$ND, label=c("Yes", "No"))  attach(OLDDATA) defaults <-

Re: [R] generate random numbers for lotteries

2012-04-29 Thread R. Michael Weylandt
On Apr 29, 2012, at 2:25 AM, billy am wrote: > Interesting set of question.. I am completely new to R but let me try my > luck. > > Random number in R > > x <- runif(60 , 0 , 10) # 60 numbers from 0 to 10 > y<- runif(60, 15 , 25) # same as above , from 15 to 25 > > The second part though. D

[R] Count number of rows in a matrix with a character pattern

2012-04-29 Thread katarv
Hi, I have a large data set that I input as a matrix, where I have 1:x rows with names AX, then x+1: y rows named AY, etc. The idea is that I have to count how many rows exactly I have with name AX and how many I have with name AY (or find which row numbers have names AX). Is there any way in R

Re: [R] [R-sig-ME] Xy plot help

2012-04-29 Thread Jeff Newmiller
A) Yes, there is something wrong. Code not reproducible. Behavdat not found. B) Last time I used it, Yahoo Mail could send in plain text. Admittedly that has been awhile, but Google sez read [1] and/or [2]. [1] http://help.yahoo.com/tutorials/mail/mail_persmsg1.html [2] http://email.about.com/od

Re: [R] r2 and p value dispaly in table

2012-04-29 Thread Tal Galili
I am not sure why you would want it, but here it is: individual <- c(1,1,6,8,8,9,9,9,12,12) day <- c(4,17,12,12,17,3,9,22,13,20) condition <- c(0.72, 0.72, 0.67, 0.73, 0.76, 0.65, 0.68, 0.78, 0.73, 0.71) test1 <- data.frame(individual, day, condition) test1 library(plyr) result=ddply(test1, "in

[R] parallel package

2012-04-29 Thread ya
> Hi Uwe and Indrajit, > > Thank you very much for the response. > > Since we are talking about this package, can I ask more about how to > use it to deal with statistical issues please? > > I have this data with categorical missing values in it. Now I am > trying to impute them using a funct

Re: [R] Returning the coef from two coordinates

2012-04-29 Thread Petr Savicky
On Fri, Apr 27, 2012 at 02:08:09PM -0700, Hans Thompson wrote: > I meant (1,1) as an (x,y) coordinate. I am trying to find the function to > return the coefficient of the line running through: > > >B > x y > a 1 1 > > and all the points in: > > >A > x y > a 1 3 > b 2 2 > c

Re: [R] r-package RDCOMClient

2012-04-29 Thread Robert Baer
These sorts of issues are often machine dependent and not R package or R software dependent, especially when it comes to processes like com. I a,m not a RDCOMClient user, but it's been on my list to look at. You don't provide much info on your various component versions (see posting guide) so

Re: [R] Consolidate column contents of equally "named" columns

2012-04-29 Thread Bert Gunter
I believe the regularity of the problem allows a (to me, anyway) simpler procedure. td <- t(apply(d,2, na.omit)) data.frame(split(as.numeric(td[,-1]),td[,1])) -- Bert On Sat, Apr 28, 2012 at 9:33 AM, Rui Barradas wrote: > Hello, > > This solution is not very pretty but it works. > > nms <- un

Re: [R] Equivalent of Nothing (in VBA) or [] in Matlab in R

2012-04-29 Thread R. Michael Weylandt
Perhaps NULL? Or maybe a vector of length 0you can also just leave arguments missing in R thanks to lazy evaluation so there's not a single equivalent to "nothing" Hth, Michael On Apr 28, 2012, at 6:04 PM, lm wrote: > Hi, I am very new to R so please excuse me if I am asking very obvious

Re: [R] Specifying special poisson maximum likelihood

2012-04-29 Thread Ben Bolker
unibas.ch> writes: > > Hi everyone > > I am stuck on specifying my own maximum likelihood function for a > special poisson model. > > My poisson model is as follow: O ~ Pois(b*N + b*RR*E) > > With > O = observed cases > b = constant (known) > N = number of unexposed persons (known) > E = num

Re: [R] RODBC Error Code 202 on Mac OS X 10.6

2012-04-29 Thread julia . jacobson
Unfortunately, I'm not really making any progresses, despite a lot of effort. I've compiled R on Mac OS X for myself using MacPorts and the error is now "state 28000, code 201" which is failed password authentification. __ R-help@r-project.org mailing li

Re: [R] Consolidate column contents of equally "named" columns

2012-04-29 Thread David Winsemius
On Apr 28, 2012, at 10:46 AM, Daniel Malter wrote: Hi, I have a data frame whose first row (not the header) contains the true column names. The same column name can occur multiple times in the dataset. Columns with equal names are not adjacent, and for each observation only one of the eq

Re: [R] r2 and p value dispaly in table

2012-04-29 Thread Kristi Glover
Hi Tal, Thank you so much for the help. I am afraid that I could not make you understand of my problem. The code you wrote is for whole data set, but I wanted to do regression based on "Individual" and put coefficient, r2 and p value. Individual is group variable. Here I again run the script

Re: [R] Writing a Permutation Function

2012-04-29 Thread petermec
Thanks for all the suggestions. This is my final code that seems to be working: alphabet = c("a","b","c","d") holder = c() permute = function(alphabet,n){ while((length(unique(holder))/n)<(length(alphabet)^n)){ perm = sample(alphabet, replace=T, size=n) holder = rbind(holder, perm, deparse

Re: [R] combinations

2012-04-29 Thread Berend Hasselman
On 29-04-2012, at 13:09, Melinda Harwood wrote: > I am trying to make a function "permute" that takes two arguments: 1) > and alphabet consisting of a set of symbols and 2) a length being a > single integer N.With a safety check check in permute() that stops > execution (use the stop() function)

Re: [R] problem in matching numbers in two variables

2012-04-29 Thread Berend Hasselman
On 29-04-2012, at 08:48, sagarnikam123 wrote: > No its not perfectly working see below > >> j<-c(1,1,2,2,3) >> k<-c(2,1,1,1,1) >> j%%k > [1] 1 0 0 0 0 > > problem comes when one of my sequence have 1 Did you try the other solutions that were suggested? Berend ___

Re: [R] "parallel" package

2012-04-29 Thread admin
Ah .. another thing I learnt. Thanks > You seem confused the library Uwe is talking about is a function > not a string > > These work > > library(quantmod) > library("quantmod") > > or > > pkg <- "quantmod" > > library(pkg) # Doesn't work! > > library(pkg, character.only = TRUE) # Works >

Re: [R] problem in matching numbers in two variables

2012-04-29 Thread John Kane
I think I misread the question. Is this what you want j <- c(1,1,2,2,3) k <- c(2,1,1,1,1) xx <- j == k which(xx == TRUE) John Kane Kingston ON Canada > -Original Message- > From: sagarnikam...@gmail.com > Sent: Sat, 28 Apr 2012 23:48:43 -0700 (PDT) > To: r-help@r-project.org > Subjec

Re: [R] "parallel" package

2012-04-29 Thread R. Michael Weylandt
You seem confused the library Uwe is talking about is a function not a string These work library(quantmod) library("quantmod") or pkg <- "quantmod" library(pkg) # Doesn't work! library(pkg, character.only = TRUE) # Works Michael On Sun, Apr 29, 2012 at 3:59 AM, wrote: > I just tri

Re: [R] "parallel" package

2012-04-29 Thread ya
Hi Uwe and Indrajit, Thank you very much for the response. Since we are talking about this package, can I ask more about how to use it to deal with statistical issues please? I have this data with categorical missing values in it. Now I am trying to impute them using a function called "mice"

Re: [R] "parallel" package

2012-04-29 Thread admin
I just tried it. > library <- "quantmod" > library [1] "quantmod" > typeof(library) [1] "character" So how do I , or anyone , assign a string without " "? > library <- quantmod Error: object 'quantmod' not found What about this? > library <- c("quantmod") Does it do the job? Sorry if it has b

Re: [R] generate random numbers for lotteries

2012-04-29 Thread billy am
Interesting set of question.. I am completely new to R but let me try my luck. Random number in R x <- runif(60 , 0 , 10) # 60 numbers from 0 to 10 y<- runif(60, 15 , 25) # same as above , from 15 to 25 The second part though. Do you mean , for( i in 1:length(x)) { z = x[i] + y[i] return z }

Re: [R] problem in matching numbers in two variables

2012-04-29 Thread sagarnikam123
No its not perfectly working see below > j<-c(1,1,2,2,3) > k<-c(2,1,1,1,1) > j%%k [1] 1 0 0 0 0 problem comes when one of my sequence have 1 -- View this message in context: http://r.789695.n4.nabble.com/problem-in-matching-numbers-in-two-variables-tp4594912p4595849.html Sent from the R help ma

[R] combinations

2012-04-29 Thread Melinda Harwood
I am trying to make a function "permute" that takes two arguments: 1) and alphabet consisting of a set of symbols and 2) a length being a single integer N.With a safety check check in permute() that stops execution (use the stop() function) with a warning when the number of permutations would excee

Re: [R] How to custom colorscale in treemap

2012-04-29 Thread nhbnhb
Hi, ur reply is much appreciated and I think that will work. But i don't know how to incorporate that code into map.market function: function (id, area, group, color, scale = NULL, lab = c(TRUE, FALSE), main = "Map of the Market", print = TRUE) { if (any(length(id) != length(area), leng

Re: [R] Hyperspec package: need to change spectra names in a stacked plot

2012-04-29 Thread beleites,claudia
Ciao Roberto, welcome to hyperSpec! 1. reproducible example You can use the example data sets coming with hyperSpec to create examples that everyone can easily reproduce. 2. there's a hyperSpec-help mailing list which you may want to join. You can subscribe at http://lists.r-forge.r-project.o

[R] Specifying special poisson maximum likelihood

2012-04-29 Thread Denis . Aydin
Hi everyone I am stuck on specifying my own maximum likelihood function for a special poisson model. My poisson model is as follow: O ~ Pois(b*N + b*RR*E) With O = observed cases b = constant (known) N = number of unexposed persons (known) E = number exposed persons (known) RR = relative risk (v

Re: [R] r2 and p value dispaly in table

2012-04-29 Thread Tal Galili
You came close. Here is how it might be done: individual <- rep(c(1,1,6,8,8,9,9,9,12,12),2) day <- rep(c(4,17,12,12,17,3,9,22,13,20),2) condition <- rep(c(0.72, 0.72, 0.67, 0.73, 0.76, 0.65, 0.68, 0.78, 0.73, 0.71),2) test <- data.frame(individual, day, condition) #ind.id <- unique(test$individu

Re: [R] RCS (Restriced Cubic Splines)

2012-04-29 Thread peter dalgaard
On Apr 29, 2012, at 09:34 , Noah Silverman wrote: > In the book, "Regression Modeling Strategies", Frank Harrell uses the > function rcs() often. > > The current version or R and Hmisc library don't appear to have this > function. > > What is an appropriate substitute? > The "rms" package

Re: [R] "parallel" package

2012-04-29 Thread Uwe Ligges
On 29.04.2012 09:28, Indrajit Sengupta wrote: You don't need quotes in the library statement, you can just use library(parallel). Yes, a special (mis-)feature of library(). Since we are trying to teach R here, we should provide clean R code. In an ideal world, we would be able to say pkg

[R] RCS (Restriced Cubic Splines)

2012-04-29 Thread Noah Silverman
In the book, "Regression Modeling Strategies", Frank Harrell uses the function rcs() often. The current version or R and Hmisc library don't appear to have this function. What is an appropriate substitute? Thank You -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building

Re: [R] "parallel" package

2012-04-29 Thread Indrajit Sengupta
You don't need quotes in the library statement, you can just use library(parallel).   Regards, Indrajit   From: Uwe Ligges To: ya Cc: r-help@r-project.org Sent: Saturday, April 28, 2012 11:57 PM Subject: Re: [R] "parallel" package On 28.04.2012 20:18, ya w