[R] What is 'freeny.x' object?

2012-03-29 Thread Christofer Bogaso
Dear all, I have discovered an object named 'freeny.x' which seems in-built. Can somebody tell me why it is there and what purpose it is serving? 'ls()' syntax does not seem to catch this object in the environment. Thanks, __ R-help@r-project.org maili

Re: [R] What is 'freeny.x' object?

2012-03-29 Thread Petr Savicky
On Thu, Mar 29, 2012 at 12:56:30PM +0530, Christofer Bogaso wrote: > Dear all, I have discovered an object named 'freeny.x' which seems > in-built. Can somebody tell me why it is there and what purpose it is > serving? Hi. See ?freeny.x Petr Savicky.

Re: [R] discrepancy between paired t test and glht on lme models

2012-03-29 Thread peter dalgaard
On Mar 28, 2012, at 20:23 , Rajasimhan Rajagovindan wrote: > Hi folks, > > > > I am working with repeated measures data and I ran into issues where the > paired t-test results did not match those obtained by employing glht() > contrasts on a lme model. While the lme model itself appears to be

Re: [R] What is 'freeny.x' object?

2012-03-29 Thread peter dalgaard
On Mar 29, 2012, at 09:26 , Christofer Bogaso wrote: > Dear all, I have discovered an object named 'freeny.x' which seems > in-built. Can somebody tell me why it is there and what purpose it is > serving? > > 'ls()' syntax does not seem to catch this object in the environment. help(freeny.x) d

[R] subtract a list of vectors from a list of data.frames in an elegant way

2012-03-29 Thread Eric Fail
Dear R experts, I've realized that it might not be possible to define a negative SELCET statement in a SQL call so now I'm looking for the smoothest way to generate a list of what I would like from my large database by first pulling all the names with a query like this "SELECT top 1 * FROM your

[R] Calling Dynamic Variables names

2012-03-29 Thread santoshdvn
HI, Need help in calling the dynamic variables I have 2 datasets . FIrst one(mdata) is having the metadata and second one(dataset) has got the data. sample *mdata * Variable (header) attribute1 attribute2 attribute3 attribute4 *dataset * attribute1 attribute2 attribute3attribut

Re: [R] Exporting a data.frame to excel using sqlSave - adds a character ' to values

2012-03-29 Thread Juliette Fabre
OK, finally the problem comes from the argument colnames = TRUE in the sqlSave function. It transforms all the columns into string in Excel .. Ivan Calandra-2 wrote > > Hi, > > I cannot test with RODBC because it doesn't work on my Mac, but if RODBC > is not necessary to you, you could do

Re: [R] Exporting a data.frame to excel using sqlSave - adds a character ' to values

2012-03-29 Thread Juliette Fabre
RODBC seems to be the most appropriate library to export multiple dataframes into several sheets (undetermined number) of an Excel file. Apparently the sqlSave() function usually exports data into the appropriate Excel format, I can't understand why in this case all columns are transformed into str

[R] time my process

2012-03-29 Thread threshold
Dear R users, given a simple plotting procedure below, how can I make the figures changing on a slower rate (say every 2 sec) for(i in 1:100){ts.plot(rnorm(i))} Best, robert -- View this message in context: http://r.789695.n4.nabble.com/time-my-process-tp4514836p4514836.html Sent from the R he

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-29 Thread maxbre
Elai Ok, this is my reproducible example tm<-structure(list(name_short = structure(1:29, .Label = c("D4", "D5", "D6a", "D6b", "D6c", "D7", "D8", "F4", "F5a", "F5b", "F6a", "F6b", "F6c", "F6d", "F7a", "F7b", "F8", "P105", "P114", "P118", "P123", "P126", "P156", "P157", "P167", "P169", "P189", "

Re: [R] Calling Dynamic Variables names

2012-03-29 Thread Petr PIKAL
Hi First of all you shall change your dataset structure to list. It will help you in future. > > HI, > > Need help in calling the dynamic variables > > I have 2 datasets . FIrst one(mdata) is having the metadata and second > one(dataset) has got the data. > > sample > *mdata * > Variable

[R] hclust and plot functions work, cutree does not

2012-03-29 Thread Vinod Hegde
Hi, I have the distance matrix computed and I feed it to hclust function. The plot function produces a dense dendrogram as well. But, the cutree function applied does not produce the desired list. Here is the code x=data.frame(similarity_matrix) colnames(x) = c(source_tags_vec) rownames(x

Re: [R] Reading spss files into R - warnings

2012-03-29 Thread Marion Wenty
Hello Steve, sorry that I haven't written back earlier, I was ill and didn't check my mails. Thank you very much for your reply. Thanks for the information about the duplicate levels. I also didn't find any errors in my data after getting the "unknown type warnings". Marion 2012/2/26 Steve Ta

Re: [R] subtract a list of vectors from a list of data.frames in an elegant way

2012-03-29 Thread Jim Holtman
?setdiff Sent from my iPad On Mar 29, 2012, at 4:28, "Eric Fail" wrote: > Dear R experts, > > I've realized that it might not be possible to define a negative SELCET > statement in a SQL call so now I'm looking for the smoothest way to generate > a list of what I would like from my large dat

[R] FIML in R

2012-03-29 Thread Andrew Miles
Does anyone know if someone is developing full-information maximum likelihood (FIML) estimation algorithms for basic regression functions, like glm()? I think that having FIML options for workhorse functions that typically use ML would give R an edge over other statistical software, given how w

Re: [R] simple matrix calculation

2012-03-29 Thread Kehl Dániel
Dear David, Ted, Kjetil, Petr, thank you, you guys did a great job, I'll use your ideas in the future for sure. After I sent the question I figured a way, see below. x <- 1:81 b <- 1:3 Q <- matrix(x,9,9) result <- matrix(matrix(colSums(matrix(t(Q),3)),,3,TRUE) %*% b,3,3) I hope there is no er

Re: [R] Spatstat users.

2012-03-29 Thread Graham Smith
Yes I am an active spatstat use On Wednesday, 28 March 2012, Rolf Turner wrote: > > This is a cry for help. My apologies for taking up bandwidth > with an issue that is not really on topic. But I really do want > to acquire the requested information. > > In the course of preparing my PBRF (perf

[R] Adding duration (hh:mm:ss)\Converting factor column into duration class

2012-03-29 Thread drr
Hi All, I have a data frame: Time1Time2 1 176:46:1041:48:06 2 171:28:5761:19:10 3 178:25:1534:05:35 4 74:04:20 25:01:55 5 136:11:2037:59:32 6 138:17:1730:22:27 7 183:04:4829:25:02 8 179:35:0119:29:

[R] how to calculate predicted probability of Cox model

2012-03-29 Thread JiangGZ
Dear List, Because Cox proportional hazards model didn't give the baseline hazard function, how to calculate the predictive probability for each test sample at a special time point,such as 5-year or 10-year ? In survival package, predict.coxph() function gives three different type of predict

[R] Replace NaN with 0

2012-03-29 Thread garima_sharma
I need help with replacing NaN with zero (the value '0') in my dataset. How can I do this? Thanks Garima Sharma -- View this message in context: http://r.789695.n4.nabble.com/Replace-NaN-with-0-tp4514894p4514894.html Sent from the R help mailing list archive at Nabble.com. __

[R] Data handling/optimum glm method.

2012-03-29 Thread abigailclifton
Hi there, I am trying to fit a generalised linear model to some loan application and default data. The purpose of this is to eventually work out the probability an applicant will default. However, R seems to crash or die when I run "glm" on anything greater than a 5-way saturated model for my

[R] How to calculate the Deviance for test data based on Cox model

2012-03-29 Thread ChiangKevin
Dear List, If I got a Cox model based on training set, then how should I calculate the Cox log partial likelihood for the test data? Actually I am trying to calculate the deviance on test dataset to evaluate the performance of prediction model, the equation is as follows: D = -2{L(test)[bet

Re: [R] How to get the input of a function right?

2012-03-29 Thread Dorothea Busse
Hi Michael and Sarah,   Thank you for offering help. I finally managed to construct an example with all essentials of my problem:   x1<-c(1,2,3,4) x2<-c(2,3,4,5) x3<-c(3,4,5,6) x<-rbind(x1,x2,x3) time<-c(1,3,9) fit<-function(xx,t,tcc){slope <- coefficients(lm(log(xx) ~ 0 + t))[1] alpha<-slope-log

[R] TR: [e1071] Load an SVM model exported with write.svm

2012-03-29 Thread Alexandre Marié
Dear R help mailing list, I work on a project using the SVM implementation from e1071 R package and I really need your help in order to use correctly the write.svm function. I trained my SVM model in R and I would like to use this model in Java. To do that, I would like to use the libsvm J

Re: [R] simple matrix calculation

2012-03-29 Thread Berend Hasselman
On 29-03-2012, at 13:16, Kehl Dániel wrote: > Dear David, Ted, Kjetil, Petr, > > thank you, you guys did a great job, I'll use your ideas in the future for > sure. > After I sent the question I figured a way, see below. > > x <- 1:81 > b <- 1:3 > Q <- matrix(x,9,9) > result <- matrix(matrix(co

[R] how to increase speed for function?/time efficiency of below function

2012-03-29 Thread sagarnikam123
i am using sarima() function as below ___ sarima=function(data,p,d,q,P=0,D=0,Q=0,S=-1,tol=.001){ n=length(data) constant=1:n xmean=matrix(1,n,1) if (d>0 & D>0) fitit=arima(data, order=c(p,d,q),

Re: [R] Data handling/optimum glm method.

2012-03-29 Thread Ben Bolker
me.com> writes: > I am trying to fit a generalised linear model to some loan > application and default data. The purpose of this is to eventually > work out the probability an applicant will default. > However, R seems to crash or die when I run "glm" on anything > greater than a 5-way satur

Re: [R] Replace NaN with 0

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 5:19 AM, garima_sharma wrote: I need help with replacing NaN with zero (the value '0') in my dataset. How can I do this? Search on: "replace NaN with zero" http://markmail.org/search/?q=list%3Aorg.r-project.r-help+%22replace+NaN+with+zero%22 -- David Winsemius, MD Wes

Re: [R] How to get the input of a function right?

2012-03-29 Thread Petr PIKAL
Hi > > > Hi Michael and Sarah, > > Thank you for offering help. I finally managed to construct an example > with all essentials of my problem: > > x1<-c(1,2,3,4) > x2<-c(2,3,4,5) > x3<-c(3,4,5,6) > x<-rbind(x1,x2,x3) > time<-c(1,3,9) > fit<-function(xx,t,tcc){slope <- coefficients(lm(log(xx

[R] Subject: Re: Problems with R Commander version 1.8-3

2012-03-29 Thread petretta
Subject: Re: [R] Problems with R Commander version 1.8-3 Many thanks for your kindly replay. I just use a At this time I use an earlier version of the package. I try to install the Rcmdr from R-Forge. Many tanks again Message: 21 Date: Wed, 28 Mar 2012 08:04:09 -0400 From: "John Fox" To

Re: [R] simple matrix calculation

2012-03-29 Thread Petr Savicky
On Thu, Mar 29, 2012 at 01:16:49PM +0200, Kehl Dániel wrote: > Dear David, Ted, Kjetil, Petr, > > thank you, you guys did a great job, I'll use your ideas in the future > for sure. > After I sent the question I figured a way, see below. > > x <- 1:81 > b <- 1:3 > Q <- matrix(x,9,9) > result <- m

Re: [R] time my process

2012-03-29 Thread R. Michael Weylandt
?Sys.sleep() or set par(ask=TRUE) Michael On Mar 29, 2012, at 4:43 AM, threshold wrote: > Dear R users, > given a simple plotting procedure below, how can I make the figures changing > on a slower rate (say every 2 sec) > > for(i in 1:100){ts.plot(rnorm(i))} > > Best, robert > > -- > View t

Re: [R] Data handling/optimum glm method.

2012-03-29 Thread Bert Gunter
Ben: On Thu, Mar 29, 2012 at 5:41 AM, Ben Bolker wrote: >   me.com> writes: > > >> I am trying to fit a generalised linear model to some loan >> application and default data. The purpose of this is to eventually >> work out the probability an applicant will default. > >> However, R seems to crash

Re: [R] hclust and plot functions work, cutree does not

2012-03-29 Thread Sarah Goslee
What does "does not work" mean? Do you get an error message? Or a warning? Or a result, but one that isn't what you expected? Did you look at the results of the example in ?cutree to make sure what the function does is what you think it should do? > hc <- hclust(dist(USArrests)) > cutre

Re: [R] How to calculate the Deviance for test data based on Cox model

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 6:03 AM, ChiangKevin wrote: Dear List, If I got a Cox model based on training set, then how should I calculate the Cox log partial likelihood for the test data? Actually I am trying to calculate the deviance on test dataset to evaluate the performance of prediction mo

[R] SVM works slowly with 1M observations

2012-03-29 Thread Alekseiy Beloshitskiy
Dear All, I m just curious if this is okay that SVM takes several hours to build the model based on training data set with ~1 million observations and 7 columns (6 variables + 1 class variable). Here is my code: model<-svm(result ~ ., data=trainset) where 'trainset' has 997594 obs. and 7 varia

Re: [R] simple matrix calculation

2012-03-29 Thread Petr Savicky
On Thu, Mar 29, 2012 at 03:13:25PM +0200, Petr Savicky wrote: > On Thu, Mar 29, 2012 at 01:16:49PM +0200, Kehl Dániel wrote: > > Dear David, Ted, Kjetil, Petr, > > > > thank you, you guys did a great job, I'll use your ideas in the future > > for sure. > > After I sent the question I figured a wa

Re: [R] how to increase speed for function?/time efficiency of below function

2012-03-29 Thread R. Michael Weylandt
It's rather inappropriate to use someone else's code and not to give them credit: http://www.mirrorservice.org/sites/lib.stat.cmu.edu/general/tsa2/Rcode/itall.R Michael On Thu, Mar 29, 2012 at 7:54 AM, sagarnikam123 wrote: > i am using sarima() function as below > __

[R] histogram break width

2012-03-29 Thread Vihan Pandey
Hi all, I am generating histograms with the following R script : #!/usr/bin/Rscript out_file = "histo.png" png(out_file) scan("values.csv") -> myvalues hist(myvalues, breaks = 50) dev.off() print(paste("Plot was saved in:", getwd())) I want the histogram to have a larger number of breaks, b

Re: [R] histogram break width

2012-03-29 Thread Sarah Goslee
See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: > Hi all, > > I am generating histograms with the following R script : > > #!/usr/bin/Rscript > > out_file = "histo.png" > png(out_file) > > scan("values.csv") -> myvalues > hist(myvalues, breaks = 50) > > dev.off() > > print(paste(

Re: [R] histogram break width

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 10:12 AM, Sarah Goslee wrote: See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: Hi all, I am generating histograms with the following R script : #!/usr/bin/Rscript out_file = "histo.png" png(out_file) scan("values.csv") -> myvalues hist(myvalues, brea

[R] multiple plots in vis.gam()

2012-03-29 Thread Mabille, Geraldine
Hi, I'm working with gamm models of this sort: gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1)) gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1)) with a dataset of about 7 rows and 110 levels for Group if I use plot(gm1$gam), I obtain 3 different surface plots, one for

[R] Re : Replace NaN with 0

2012-03-29 Thread Pascal Oettli
Hi, try ?is.nan Regards - Mail original - De : garima_sharma À : r-help@r-project.org Cc : Envoyé le : Jeudi 29 mars 2012 18h19 Objet : [R] Replace NaN with 0 I need help with replacing NaN with zero (the value '0') in my dataset. How can I do this? Thanks Garima Sharma -- View

[R] Error, Variable is missing

2012-03-29 Thread Guaramy
Hi, I am writing a function to plot a pdf of a distribution x=seq(-4,4,length=200) mu = 0 sigma = 0.01 alpha = 17.5 beta = 17.5 rho = 0.1 GNL.pdf.fn = function(x,mu,sigma,alpha,beta,rho) { y = x-rho*mu cf.fn = function(s){ cplex = complex(1,0,1)

[R] matrix with Loop

2012-03-29 Thread Christopher Kelvin
Hello! I got something to ask..whether you can help me with the R program...i got this for example 5x4 matrix..and i want to find:  i) mean for each row of the matrix ii) median for each column of the matrix and i need to do this using a loop function...below is my program..u try to check it for

[R] Error, Variable is Missing

2012-03-29 Thread Guaramy
Hi, I am writing a function to plot a pdf of a distribution, GNL.pdf.fn = function(x,mu,sigma,alpha,beta,rho) { y = x-rho*mu cf.fn = function(s){ cplex = complex(1,0,1) temp1 = alpha*beta*exp(-sigma*s^2/2) temp2 = (alpha-cplex*

[R] How to create arbitrary number of loops in R

2012-03-29 Thread Dai, Hongying,
Dear R users, I'm wondering how I can generate an arbitrary number of loops in R. For instance, I can generate two "for" loops to get ICC among any two-way combination among 10 variables. Here is the code n<-10 for (i in 1:(n-1)) { for (j in (i+1):n) { icc(cbind(DATA[,i],DATA[,j])) } } If I need

[R] How to get the most frequent value of the subgroup

2012-03-29 Thread Jung, Yongsuhk
Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, > aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if I want to get "the most frequent value of the subgr

[R] problem with the MLE of the skew-normal shape parameter

2012-03-29 Thread knouri
Hi everyone: my likelihood function involves the shape parameter of the skew-normal in addition to other parameters. I used both optim and nlm function to find the MLS's. However, every time that I use a different initial value for the shape parameter, I get a different estimate for it. No such p

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 3:04 AM, maxbre wrote: > To answer your question: > - I did not put relation=’same’ because that is not what I want: i.e **for > each single panel** (in my case 4) I want to set the same limits for both x > and y axes (I want the diagonal line exactly bisect each panel);

Re: [R] How to get the most frequent value of the subgroup

2012-03-29 Thread R. Michael Weylandt
What you are looking for is commonly called the mode, but (surprisingly?) there doesn't seem to be a standard implementation for mode() in R. (the mode function gives you something else entirely) -- this SO thread may be of help: http://stackoverflow.com/questions/2547402/standard-library-function-

Re: [R] How to get the most frequent value of the subgroup

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 9:30 AM, Jung, Yongsuhk wrote: Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
To cbind, you don't need a loop (M <- matrix(1:50,nc=10)) c2way <- combn(ncol(M),2) MM <- M[,c2way] dim(MM) <- c(nrow(M),nrow(c2way),ncol(c2way)) MM c3way <- combn(ncol(M),3) MMM <- M[,c3way] dim(MMM) <- c(nrow(M),nrow(c3way),ncol(c3way)) MMM etc. etc. Than you can (untested for icc) loop your

Re: [R] Error, Variable is missing

2012-03-29 Thread R. Michael Weylandt
I believe you need to actually pass the values to your function: pdf(x, mu, sigma, alpha, beta, rho) # Works pdf(x) # Doesn't. If not, please show us how you are calling pdf(). Michael On Thu, Mar 29, 2012 at 9:25 AM, Guaramy wrote: > Hi, I am writing a function to plot a pdf of a distribution

Re: [R] matrix with Loop

2012-03-29 Thread R. Michael Weylandt
apply(x, 1, mean) apply(x, 2, median) or for more speed rowMeans() ? apply Michael On Thu, Mar 29, 2012 at 9:00 AM, Christopher Kelvin wrote: > Hello! > I got something to ask..whether you can help me with the R program...i got > this for example 5x4 matrix..and i want to find: >  i) mean for

Re: [R] Adding duration (hh:mm:ss)\Converting factor column into duration class

2012-03-29 Thread R. Michael Weylandt
Factor -> numeric is tricky sometimes: you need to do this as.numeric(as.character(x)) but that's not going to work for you here because you don't really want numbers. Instead try something like this (untested though): parseDuration <- function(t1, t2){ t1 <- as.numeric(unlist(strsplit(as.ch

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 9:27 AM, ilai wrote: Oops, sent to fast. A (maybe) clearer solution: f <- function(x,m){ cmway <- combn(ncol(x),m) xx <- x[,cmway] dim(xx) <- c(nrow(x),nrow(cmway),ncol(cmway)) xx } f(M,3) str(sapply(2:4,f,x=M)) And again lapply / apply , or even return icc(xx) in f C

Re: [R] binomial sample size calculation

2012-03-29 Thread Marc Schwartz
On Mar 28, 2012, at 4:26 PM, McGuire, Rhydwyn wrote: > Hi everyone. > > > I need to do a sample size calculation for a one sample based on a CI > interval of +- 5% of the proportion, we expect to have a rate of 0.07 based > on similar studies. I have looked at the pwr-package as well as the

[R] mb.long {timecourse}

2012-03-29 Thread statfan
How do you identify the genes which are differentially expressed using the mb.long function? More specifically, in the fruitfly example (see below), we begin with an expression matrix containing 2000 genes. How do I obtain not only the proportion of differentially expressed genes, but also the su

[R] How to get the most frequent value of the subgroup

2012-03-29 Thread Yongsuhk Jung
Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, > aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if I want to get "the most frequent value of the subgro

[R] split list

2012-03-29 Thread konika chawla
Hi Is there a function like splitstr, for splitting lists? I want to divide a list of gene names based on a recurring value like "batch" the list is like [1,] "AT4G25480" [2,] "AT3G20810" [3,] "AT2G46670" [4,] "AT4G27310" [5,] "batch" [6,] "AT1G04570" [7,] "AT5G62360" [8,] "AT2G

[R] copy matrix another matrix

2012-03-29 Thread MSousa
> results val_user v_source v_destine count average 1 7 2222 4 186.25 2 7 2222 2 383.50 3 7 2222 1 19.00 4 7 9797 1 196.00 5 7 16197 1 68.00 6 7 22 130 1 21

[R] Load datasets

2012-03-29 Thread Hua Liang
I am trying to use datasets within R with a loaded package, for example, MASS. When I use the dataset phones, it can be done using data(phones, package=”MASS”). I am thinking about an alternative but more flexible way to load this dataset. Because phones is the 70th dataset in this package, I

Re: [R] Load datasets

2012-03-29 Thread R. Michael Weylandt
Perhaps something like get(data(list = arg)) 2012/3/29 Hua Liang : > > I am trying to use datasets within R with a loaded package, for example, > MASS. When I use the dataset phones, it can be done using data(phones, > package=”MASS”). I am thinking about an alternative but more flexible way to

Re: [R] split list

2012-03-29 Thread Martin Morgan
On 03/29/2012 08:18 AM, konika chawla wrote: Hi Is there a function like splitstr, for splitting lists? I want to divide a list of gene names based on a recurring value like "batch" the list is like [1,] "AT4G25480" [2,] "AT3G20810" [3,] "AT2G46670" [4,] "AT4G27310" [5,] "batch" [6,] "AT1G04570"

[R] SVM performance/optimization

2012-03-29 Thread Alekseiy Beloshitskiy
Dear All, I m trying to build SVM model with large dataset. However, svm from package e1071 works slowly (takes hours) to build model for like 1 million observations. I was thinking about CVM (Core Vector Machines: http://www.cse.ust.hk/~jamesk/papers/jmlr05.pdf

[R] abline with xyplot does not work

2012-03-29 Thread John Sorkin
I am trying to plot the results of a random effects model where each subject is allowed to have his, or her, own intercept. I use xyplot to plot the data, lme to compute the regression and then try to put a summary regression line on the xyplot. As can be seen by the output pasted below, I am ge

Re: [R] Load datasets

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 12:13 PM, R. Michael Weylandt wrote: Perhaps something like alldata = data(package="MASS") arg = alldata$results[70,3] ineed <- data(arg, package="MASS") get(data(list = arg)) I think the get() is superfluous: > rm(phones) > exists("phones") [1] FALSE > data(list=arg

[R] Handling functions as objects

2012-03-29 Thread Julio Sergio
I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(foo) { +foo(1,2) + } > > f1(f) [1] 1 [1] 2 > I also know that operators are functions, so, I ca

Re: [R] split list

2012-03-29 Thread Bert Gunter
Here's a more "minimalist" and perhaps faster approach (asit uses indexing) Let "gl" be the the vector with the gene list. omit <- gl == "batch" yourlist <- split( gl[omit], ,cumsum(omit)[!omit]) Cheers, Bert On Thu, Mar 29, 2012 at 9:25 AM, Martin Morgan wrote: > On 03/29/2012 08:18 AM, konik

Re: [R] abline with xyplot does not work

2012-03-29 Thread Bert Gunter
?panel.abline You need grid/lattice functions for xyplot ! -- Bert On Thu, Mar 29, 2012 at 9:38 AM, John Sorkin wrote: > I am trying to plot the results of a random effects model where each subject > is allowed to have his, or her, own intercept. I use xyplot to plot the data, > lme to comput

Re: [R] split list

2012-03-29 Thread Bert Gunter
Sorry -- that 2nd line should of course be: yourlist <- split( gl[!omit], ,cumsum(omit)[!omit]) -- Bert On Thu, Mar 29, 2012 at 10:07 AM, Bert Gunter wrote: > Here's a more "minimalist" and perhaps faster approach (asit uses indexing) > > Let "gl" be the the vector with the gene list. > > omit

Re: [R] Handling functions as objects

2012-03-29 Thread Duncan Murdoch
On 29/03/2012 1:02 PM, Julio Sergio wrote: I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(foo) { +foo(1,2) + } > > f1(f) [1] 1 [1] 2 > I also

Re: [R] Handling functions as objects

2012-03-29 Thread Gabor Grothendieck
On Thu, Mar 29, 2012 at 1:02 PM, Julio Sergio wrote: > I learnt that functions can be handled as objects, the same way the variables > are. So, the following is perfectly valid: > >> f = function(a, b) { > +    print(a) > +    print(b) > + } >> >> f1 = function(foo) { > +    foo(1,2) > + } >> >> f

Re: [R] Handling functions as objects

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 1:34 PM, Duncan Murdoch wrote: On 29/03/2012 1:02 PM, Julio Sergio wrote: I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(f

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
Duncan Murdoch gmail.com> writes: > You are seeing the effects of the evaluator and parser being helpful. > When you say > > foo(1,2) > > Thanks Duncan! --Sergio __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
Gabor Grothendieck gmail.com> writes: > > See ?match.fun > > There is also an enhanced version, match.funfn, in the gsubfn package. > Thanks Gabor! --Sergio. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Is it possible to de-select with sqlQuery from the RODBC library?

2012-03-29 Thread Bart Joosen
Another way is to use VBA to create a table which contains all the table names and column names. Then use select from this table to create your query. I didn't find any other solutions Bart -- View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-de-select-with-sqlQuery-

Re: [R] Load datasets

2012-03-29 Thread R. Michael Weylandt
Yes, but if the OP wants to assign the values to "ineed" (which I think is the request), he'll need get() Michael On Mar 29, 2012, at 12:50 PM, David Winsemius wrote: > > On Mar 29, 2012, at 12:13 PM, R. Michael Weylandt wrote: > >> Perhaps something like > >>> alldata = data(package="MASS"

Re: [R] Load datasets

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 1:50 PM, R. Michael Weylandt wrote: Yes, but if the OP wants to assign the values to "ineed" (which I think is the request), he'll need get() Perhaps. I assumed he wanted to load 'phones'. (That's what he said he wanted.) If he did this : ineed <- get(data(list = arg)

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
David Winsemius comcast.net> writes: > > > There is also the `do.call` function to construct proper calls from a > character that matches the name of a function > > f1 = function(foo) { > do.call(foo, list(1,2)) >} > > f1("+") > [1] 3 > Thanks David, this information has bee

Re: [R] matrix with Loop

2012-03-29 Thread R. Michael Weylandt
apply() will hit all the rows/columns at once so you don't need the loop construct at all. E.g., x <- matrix(rnorm(20), ncol = 5) ## One Line y1 <- apply(x, 1, mean) ## Or Four y2 <- numeric(nrow(x)) for(i in 1:nrow(x)){ y2[i] <- mean(x[i,]) } ## But they're the same identical(y1, y2) # TR

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
Thanks very much for the response. That was a very good article and gives me a good appreciation for the history and covers the structure of the two date/time formats well. What I was specifically looking for is a feel for the situations when one format should be used over the other. In my wor

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread R. Michael Weylandt
That's generally my reaction to them, but you should also read "R News 4/1 -- Help Desk" (http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf) which gives some tips on Date()s and the various time classes. Best, Michael On Thu, Mar 29, 2012 at 2:19 PM, Steven R Corsi wrote: > Thanks very much f

Re: [R] How to test for the difference of means in population, please help

2012-03-29 Thread ali_protocol
Dear Wu, Thank you indeed very much for your response. Is it possible that I use this method to compare the distribution of original population that this observations come from? Thank you ideed very much. On 3/28/12, alan wu [via R] wrote: > > > try anova if they have same observe points. >

[R] Retrieving matrix column and row names by index value

2012-03-29 Thread Lanna Jin
Hi all, So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example, > mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2"

Re: [R] Retrieving matrix column and row names by index value

2012-03-29 Thread R. Michael Weylandt
This seems to work: namesFromIndex <- function(indx, obj){ mapply(`[`, dimnames(obj), arrayInd(indx, dim(obj))) } Michael On Thu, Mar 29, 2012 at 2:20 PM, Lanna Jin wrote: > Hi all, > > So let's say I have a matrix, mdat and I only know the index number. How do > I retrieve the column and r

[R] simulate correlated binary, categorical and continuous variable

2012-03-29 Thread Burak Aydin
Hi, I d like to simulate 9 variables; 3 binary, 3 categorical and 3 continuous with a known covariance matrix. Using mvtnorm and later dichotimize/categorize variables is not efficient. Do you know any package or how to simulate mixed data? -- View this message in context: http://r.789695.n4.nabb

Re: [R] Hosmer-Lemeshow 'goodness of fit'

2012-03-29 Thread JimeBoHe
I am a new user in R, so I am sorry if this is a basic question but I am kind of lost here and I really would appreciatte your help. I have behavioral information of sea lions and I've done a binomial Generalized Linear model using Rcmdr, to understand what variables are affecting the place where

[R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread inkhorn
Hello, Let's say I've drawn a random sample (sample1.df) from a large data frame (main.df), and I want to create a second random sample (sample2.df) where the values in its ID column *are not* in the equivalent ID column in the first sample (sample1.df). How would I go about doing this? In other

[R] Error: argument of length 0

2012-03-29 Thread ens
Problem: I keep getting: "Error in (index - 9):index : argument of length 0" when I run this code in an automated loop, but when I step through it by hand, I have no problems. It keep crashing when i<-10. I cannot figure this out to save my life! Please help and THANK YOU in advance! variables:

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
Thanks for the link Michael. This is a very good explanation with some very useful tips on which date classes to use for different purposes. It generally strengthened the concept that POSIXct is the way to go unless you need to extract specific components of the date from POSIXlt. Since strptim

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread MacQueen, Don
I also find that POSIXct is generally the most useful, and only use POSIXlt in special cases. But have you considered as.POSIXct() instead of strptime()? It works for me, and I can't remember the last time I had to use strptime() for converting character to date/time. (But I mostly don't work with

Re: [R] How to calculate the Deviance for test data based on Cox model

2012-03-29 Thread Thomas Lumley
On Thu, Mar 29, 2012 at 11:03 PM, ChiangKevin wrote: > > > Dear List, > > If I got a Cox model based on training set, then how should I calculate the > Cox log partial likelihood for the test data? > Actually I am trying to calculate the deviance on test dataset to evaluate > the performance of

Re: [R] Rcmd build -binary -- problem

2012-03-29 Thread Uwe Ligges
On 28.03.2012 22:22, jack306 wrote: After I used rtools 2.15 and R-2.14.2 to create an R package, I have some thoughts that some R users may try: 1. If rcmd is not recognized even the path is set under advanced environmental variables, use "path C:\Program Files\R\R-2.14.2\bin\x64" if you try

[R] How to improve, at all, a simple GLM code

2012-03-29 Thread Abigail Clifton
Hi There, I am trying to fit a logit model to some data in a CSV file in R. Here is my code: Prepared_Data = read.csv("Prepared_Data.csv", header=TRUE) Prepared_Data attach(Prepared_Data) lrfit<-glm(C3~A1*B2*D4*E5,family = binomial) anova(lrfit, test="Chisq") write.csv(anova(lrfit, test="Chisq")

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 2:37 PM, inkhorn wrote: Hello, Let's say I've drawn a random sample () from a large data frame (main.df), and I want to create a second random sample (sample2.df) where the values in its ID column *are not* in the equivalent ID column in the first sample (sample1.df).

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
That is a good tip. I have tried it and found that it works if I make sure it was converted to character first. strptime appears to accept factor variables which is the default when reading in the file originally. Thanks Steve On 3/29/2012 2:31 PM, MacQueen, Don wrote: I also find that POSIXc

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Prof Brian Ripley
On 29/03/2012 21:05, Steven R Corsi wrote: That is a good tip. I have tried it and found that it works if I make sure it was converted to character first. strptime appears to accept factor variables which is the default when reading in the file originally. I would say that POSIXct is the way to

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Worik R
I have a reproducible example of my problem below On Mon, Mar 26, 2012 at 9:22 AM, Joshua Ulrich wrote: > > Given two identical string representations of POSIXct objects, can the > two > > objects represent different times? > > > Yes. Here's an example (from my Ubuntu machine) of one way: > > >

  1   2   >