Re: [R] Unusual separators

2011-08-20 Thread peter dalgaard
On Aug 17, 2011, at 05:57 , Jim Holtman wrote: just read in the file using the tab as the separator. if this is a problem because a tab might appear by itself, then use readLines to read in the file, gsub to replace the blank/tab with a new separator, writeLines to write out to a

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread peter dalgaard
On Aug 19, 2011, at 20:40 , David Winsemius wrote: On Aug 19, 2011, at 1:28 PM, Stephen Davies wrote: I'm using chisq.test() on a matrix of categorical data, and I see that the residuals attribute of the returned object will give me the Pearson residuals. That's cool. However, what I'd

[R] Raw epoch time from XTS

2011-08-20 Thread Noah Silverman
Hi, I have a very large data set stored as an xts object. xts is very nice about showing row labels as human readable dates and times. I want the actual epoch values that are stored internally. The only way I can find to access them is one-at-a-time using the internal function: xcoredata()

Re: [R] Raw epoch time from XTS

2011-08-20 Thread Joshua Wiley
Hi Noah, This is one of those cases where following the posting guide (particularly the minimal, reproducible example part) would have really helped. Are you saying that calling: xcoredata(your_xts_object) does not give you the internal representation of time that you want? data(sample_matrix)

[R] hetlp_type text doen't work on Ubuntu

2011-08-20 Thread Amol Jadhav
Hi, I' using Ubuntu 10.10/11.04 and on both of the systems help doesn't work unless I set options(help_type=html). I hate to change context and help_type='html' distracts me. I want text based help inside console. Where should I look to fix this problem? -- Amol

Re: [R] Unusual separators

2011-08-20 Thread Jim Holtman
In the current version (2.13.1) textConnection is much slower if you have a large file (1 lines) than using a temporary output file. Try timing a script using the two different approachs to get an appreciation for the difference. Sent from my iPad On Aug 20, 2011, at 3:39, peter dalgaard

[R] Groups and bwplot

2011-08-20 Thread Sébastien Bihorel
Dear R-users, A while ago, Deepayan Sarkar suggested some code that uses the group argument in bwplot to create some 'side-by-side' boxplots (https://stat.ethz.ch/pipermail/r-help/2010-February/230065.html). The example he gave was relatively specific and I wanted to generalize his approach into

Re: [R] How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction

2011-08-20 Thread khosoda
Dear Mark, Thank you very much for your advice. I will try it. I really appreciate your all kind advice. Thanks a lot again. Best regards, Kohkichi (11/08/19 22:28), Mark Difford wrote: On Aug 19, 2011 khosoda wrote: I used x10.homals4$objscores[, 1] as a predictor for logistic

Re: [R] Build a package - check error

2011-08-20 Thread Uwe Ligges
On 20.08.2011 00:41, Eduardo Mendes wrote: Hi I have modified the path to dyn.load(paste(Sys.getenv(R_LIBS_USER),/fortran/src/fortran.so,sep=)) Hmmm, looks like you never took a look into the relevant manual Writing R Extensions nor in the help files I cited below. ?.First.lib has an

Re: [R] hetlp_type text doen't work on Ubuntu

2011-08-20 Thread Uwe Ligges
On 20.08.2011 08:25, Amol Jadhav wrote: Hi, I' using Ubuntu 10.10/11.04 and on both of the systems help doesn't work unless I set options(help_type=html). I hate to change context and help_type='html' distracts me. I want text based help inside console. Where should I look to fix this

Re: [R] How to add horizontal lines above bar graph to display p-values?

2011-08-20 Thread Uwe Ligges
On 19.08.2011 22:27, Sébastien Vigneau wrote: Hi, I would like to draw horizontal lines above a bar graph, in order to display the p-values of a Fisher test. Here is an examplehttp://thejns.org/action/showPopup?citid=citart1id=f3-1060501doi=10.3171%2Fped.2007.106.6.501of the type of display I

Re: [R] adding text to a plot created with strat.plot() from package rioja

2011-08-20 Thread Uwe Ligges
On 19.08.2011 18:40, Jason Paul Joines wrote: I have a plot created with strat.plot() from package rioja. When the plot is created with scale.percent=FALSE, each x axes is labeled at 0 and its maximum. However, when scale.percent=TRUE, the x axes are not labeled. I need to use

Re: [R] questions about metafor package

2011-08-20 Thread Michael Dewey
At 16:21 17/08/2011, Emilie MAILLARD wrote: Hello,  I would like to do a meta-analysis with the package « metafor ». Ideally I would like to use a mixed model because I’m interested to see the effect of some moderators. But the data set I managed to collect from literature presents

[R] R training course

2011-08-20 Thread Mehrshad Koleini
Dear Sir/Madam Hi. I am a general paediatrician who works in Middle-East. I will be in UK on September, and October 2011. Would you mind writing for me, please, if you suggest a good and appropriate training course for *new R* users in UK? -- Kind regards Mehrshad Koleini, MD General

[R] How to extract smoothed plot data?

2011-08-20 Thread derek
Dear R, I have this script which from my data points creates smoothed plot: require(graphics) require(stats) A=read.table(some.txt,header =FALSE,sep = , dec = ,,fileEncoding = , encoding = unknown, skip=18,nrows=400) attach(A) plot(A$V1, A$V2,col=white) lines(smooth.spline(A$V1,

Re: [R] hetlp_type text doen't work on Ubuntu

2011-08-20 Thread Amol Jadhav
Don't know the internals behind, but when I did this: help.search('qplot', rebuild=T) the text help started working. It would be interesting to know why it worked that way. Also if it is happens always, it should have been documented somewhere -- so that new users (who needs help) will not get

Re: [R] How to extract smoothed plot data?

2011-08-20 Thread Uwe Ligges
On 20.08.2011 12:57, derek wrote: Dear R, I have this script which from my data points creates smoothed plot: require(graphics) require(stats) A=read.table(some.txt,header =FALSE,sep = , dec = ,,fileEncoding = , encoding = unknown, skip=18,nrows=400) attach(A) plot(A$V1, A$V2,col=white)

[R] Pattern names matching

2011-08-20 Thread Orvalho Augusto
Dear R magic guys.. I have two tables (actually will be dataframes), both with names to be matched. The names on the first dataframe are from a study with antenatal visits on some health centers here. It happens that we need the delivery info. And half and some thing else of the women decided to

Re: [R] Build a package - check error

2011-08-20 Thread Eduardo M. A. M.Mendes
Hi there Many thanks. Just to be clear I did read the manual (section 5 and all) and have even looked at the package expm which has a src dir with codes in fortran and C to understand what it is going on. I have also read the help for .First.lib. Cheers Ed -Original Message-

[R] RMysql on Windows 7

2011-08-20 Thread Twaha Mlwilo
Hello all, good day I have installed R 1.13.0 on windows 7. then configured R + latex + sweave to use eclipse indigo.Then would like to be able to work with R + mysql 5.5(full package + connectors) which I have already installed.My problem is to build RMYSQL binary package, using

Re: [R] Pattern names matching

2011-08-20 Thread Doran, Harold
See the stringMatch function in the MiscPsycho package for an implementation of Levenshtein From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Orvalho Augusto [orvaq...@gmail.com] Sent: Saturday, August 20, 2011 11:08 AM To:

Re: [R] RMysql on Windows 7

2011-08-20 Thread Uwe Ligges
On 20.08.2011 17:22, Twaha Mlwilo wrote: Hello all, good day I have installed R 1.13.0 on windows 7. then configured R + latex + sweave to use eclipse indigo.Then would like to be able to work with R + mysql 5.5(full package + connectors) which I have already installed.My problem is to

Re: [R] AFT model time-dependent with weibull distribution

2011-08-20 Thread Göran Broström
On Sat, Aug 20, 2011 at 4:19 AM, JPF xpfen...@gmail.com wrote: JPF wrote: weibullaft-aftreg(Surv(sta,time,S) ~ TDC1 + TIC1, dist=weibull, data.frame=Data) ## aftreg gives an error when I add an ID argument... That should be used for controlling for time-varying variables. Error in

[R] help with nls fitting

2011-08-20 Thread Paola Lecca
Dear all, I'm trying to fit the following function slope_pp3_mrna = ( (k3 * v3_K_d *p1^v3_h) / ( (v3_Kd^v3_h) + p2^v3_h ) ) * ( 1/(1 + (p2/v4_Kd)^v4_h) ) - pp3_mrna to this experimental data in the datafraeme Data_pp3_mrna (see it at the end of this e-mail) I'm using the

Re: [R] Groups and bwplot

2011-08-20 Thread Weidong Gu
You may want to consult a recent post by Felix (https://stat.ethz.ch/pipermail/r-help/2011-August/286707.html) on how to pass group parameter. Weidong Gu On Sat, Aug 20, 2011 at 6:59 AM, Sébastien Bihorel pomc...@free.fr wrote: Dear R-users, A while ago, Deepayan Sarkar suggested some code

Re: [R] Extract p value from coxme object

2011-08-20 Thread Uwe Ligges
Cleaning up some old messages, I found this one: The p-values are not stored in the coxme object. They are calculated on the fly when you ask to rpint the object. See coxme:::print.coxme for the code. Uwe Ligges On 02.08.2011 17:26, Catarina Miranda wrote: Dear R experts; I am trying

Re: [R] Problem Installing/Uninstalling Rattle

2011-08-20 Thread Uwe Ligges
Cleaning up some old messages, I found this one On 02.08.2011 14:51, adarwish wrote: Rattle won't install properly on my Windows 7 64 bit laptop. Here is what I've tried: I've followed the instructions here: http://rattle.togaware.com/rattle-install-mswindows.html I had R installed

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 3:43 AM, peter dalgaard wrote: On Aug 19, 2011, at 20:40 , David Winsemius wrote: On Aug 19, 2011, at 1:28 PM, Stephen Davies wrote: I'm using chisq.test() on a matrix of categorical data, and I see that the residuals attribute of the returned object will give me the

Re: [R] Pattern names matching

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 11:25 AM, Doran, Harold wrote: See the stringMatch function in the MiscPsycho package for an implementation of Levenshtein The agrep function in base R also returns a Levenshtein distance. -- David. From:

[R] reshape a matrix

2011-08-20 Thread Wendy
Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and 'control' and 'sample' in columns. Is

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread Stephen Davies
I'm using chisq.test() on a matrix of categorical data, and I see that the residuals attribute of the returned object will give me the Pearson residuals. Actually they are not an attribute in the R sense, but rather a list value. Oh. I was just going by:

Re: [R] reshape a matrix

2011-08-20 Thread Uwe Ligges
On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 12:04 PM, Stephen Davies wrote: I'm using chisq.test() on a matrix of categorical data, and I see that the residuals attribute of the returned object will give me the Pearson residuals. Actually they are not an attribute in the R sense, but rather a list value. Oh.

Re: [R] t() prior to data rotation

2011-08-20 Thread Carl Witthoft
Well, did you try it with a simple test case to see what comes out? Do you have a sample mydata.txt file so you know how it's ordered in the first place? Carl quote From: christopher stratton cfstratton_at_gmail.com Date: Fri, 19 Aug 2011 23:10:07 -0400 Dear All, I have come upon an R-mode

Re: [R] hetlp_type text doen't work on Ubuntu

2011-08-20 Thread Ben Bolker
Amol Jadhav amolj.1306 at gmail.com writes: Don't know the internals behind, but when I did this: help.search('qplot', rebuild=T) the text help started working. It would be interesting to know why it worked that way. Also if it is happens always, it should have been documented somewhere --

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread peter dalgaard
On Aug 20, 2011, at 18:04 , Stephen Davies wrote: As for $stdres, that would be wonderful, but as you can see from the above list of attributes, it's not one of the 8 returned. What am I missing? An upgrade, most likely. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the

Re: [R] chisq.test(): standardized (adjusted) Pearson residuals

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 12:57 PM, peter dalgaard wrote: On Aug 20, 2011, at 18:04 , Stephen Davies wrote: As for $stdres, that would be wonderful, but as you can see from the above list of attributes, it's not one of the 8 returned. What am I missing? An upgrade, most likely. Whoosh.

Re: [R] reshape a matrix

2011-08-20 Thread Uwe Ligges
On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500)

Re: [R] Groups and bwplot

2011-08-20 Thread Sébastien Bihorel
Thanks for your input and this link. I realize that there was a typo in my example code that impacted the group argument... That's king of stupid. However, even with the implementation of Felix's syntax, the Error using packet 1, 'x' is missing error message is still displayed, even if the call

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 1:21 PM, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3)

[R] 'install package(s) from local zip files': what is the syntax for that?

2011-08-20 Thread Bogaso Christofer
Dear all, if I want to install a package in windows system then generally I use the 'install package(s) from local zip files' from the 'package' menu. However I am interested to know that whether there is any syntax which I can use in the R console instead. I have tried with

Re: [R] 'install package(s) from local zip files': what is the syntax for that?

2011-08-20 Thread Uwe Ligges
On 20.08.2011 20:07, Bogaso Christofer wrote: Dear all, if I want to install a package in windows system then generally I use the 'install package(s) from local zip files' from the 'package' menu. However I am interested to know that whether there is any syntax which I can use in the R console

Re: [R] Pattern names matching

2011-08-20 Thread Orvalho Augusto
Thank you. Orvalho On Sat, Aug 20, 2011 at 6:02 PM, David Winsemius dwinsem...@comcast.netwrote: On Aug 20, 2011, at 11:25 AM, Doran, Harold wrote: See the stringMatch function in the MiscPsycho package for an implementation of Levenshtein The agrep function in base R also returns a

Re: [R] t() prior to data rotation

2011-08-20 Thread christopher stratton
Yes. I know for certain that mydata.txt is ordered as an nxm matrix with n objects and m variables. Being that the data is transposed prior to performing the PCA, the rotation matrix ends up being given in terms of object loadings on the principal components, rather than variables as it's

Re: [R] Build a package - check error

2011-08-20 Thread Eduardo M. A. M.Mendes
Hello I managed to find what was wrong and it has nothing to do with .First.lib. The clue was in NAMESPACE and in the way the fortran was called (don't use dyn.load). I thank the author of the package digest where I found the lines that help me to crack what was wrong and Uwe Ligges for pushing

Re: [R] adding text to a plot created with strat.plot() from package rioja

2011-08-20 Thread Jason Paul Joines
I'm pretty new to R and finding the responsible line would not have been obvious to me without your help. I downloaded the source for package Rioja and was surprised to see that each function was supplied in it's own file. That made it pretty straightforward to copy, modify, and use my

[R] How to abort function execution after x-seconds

2011-08-20 Thread Immanuel
Hello all, I'm running a parameter grid optimization ( ksvm, kernlab package) and the optimizer seems not to converge for certain parameters and stays in a infinity loop. Would it be possible to abort the execution after x-seconds and continue with the next parameter set? Which R function do

Re: [R] How to abort function execution after x-seconds

2011-08-20 Thread Bert Gunter
?proc.time e.g. something like time0 - proc.time()[2] state - not converged while(proc.time()[2] time0[2] + 600 ) ## 10 minutes { ##... Do your thing... if(get an answer) {state - converged; break} } Refinement required, but you get the idea. Cheers, Bert On Sat, Aug 20, 2011 at 1:52 PM,

Re: [R] How to abort function execution after x-seconds

2011-08-20 Thread Bert Gunter
I should have said: The below only works if you can get it into the function code. If you cannot, and the function has no options that allow you to limit execution time or iterations, then I don't see how you can do it. -- Bert On Sat, Aug 20, 2011 at 2:16 PM, Bert Gunter bgun...@gene.com wrote:

[R] val.surv

2011-08-20 Thread Salvo Mac
 Dear R-users,   I  have two questions regarding validation and calibration of Survival regression models.   1.  I am trying to calibrate and validate a cox model using val.surv. here is my code:  f.1-cph(Surv(time,event)~age, x=T, y=T, data=train)  test1-test[,age]  val.surv(f.1,

Re: [R] AFT model time-dependent with weibull distribution

2011-08-20 Thread JPF
Göran Broström wrote: Good. Do you still need answers to your other questions? Yes. Could answer the following two questions: 1- Can I use phreg function to estimate a model with time-dependent covariates? In case of a positive answer, how? 2- I could not find any example that

[R] I have a problem with R!!

2011-08-20 Thread nferreri
Dear all i´m working with a program i´ve made in R (using functions that others created) to run my program i need a sample. if i generate the sample using for example, rnorm(n, mu, sigma) i have no problem but if i obtain a sample from a column in excel and i copy it, the program says that

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-20 Thread Campomizzi, Andrew J
My question isn't related to homework. It is a small part of an actual problem I'm trying to solve. I've been unable to find a solution in R help files and discussions, in statistics books, or from colleagues. The solution may not be overly complicated, but any assistance is appreciated.

Re: [R] How to abort function execution after x-seconds

2011-08-20 Thread Immanuel
Hello Bert, thanks for the suggestion. I should have mentioned that, sadly I can NOT change the function that does the optimization. best, Immanuel __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] val.surv

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 3:32 PM, Salvo Mac wrote: Dear R-users, I have two questions regarding validation and calibration of Survival regression models. 1. I am trying to calibrate and validate a cox model using val.surv. here is my code: f.1-cph(Surv(time,event)~age, x=T, y=T,

Re: [R] adding text to a plot created with strat.plot() from package rioja

2011-08-20 Thread Jason Paul Joines
I completely missed that entering just the function name prints the code for that function making it even easier to copy and create a custom version. Jason === Original Message Subject: Re: [R] adding text to a plot created with strat.plot() from package

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-20 Thread David Winsemius
On Aug 19, 2011, at 6:20 PM, Andrew Campomizzi wrote: Hello, I'm having trouble figuring out how to calculate a p-value for a 1- tailed test of beta_1 in a linear model fit using command lm. My model has only 1 continuous, predictor variable. I want to test the null hypothesis beta_1

[R] Best way to setClass and setMethod for an R package?

2011-08-20 Thread Jonathan Greenberg
Folks: I'm putting together an R package, and I was wondering where, specifically, I put both class definitions (via setClass) as well as setMethod calls? Is there a particular file name I need to use? Thanks! --j -- Jonathan A. Greenberg, PhD Assistant Project Scientist Center for Spatial

Re: [R] reshape a matrix

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 1:39 PM, David Winsemius wrote: On Aug 20, 2011, at 1:21 PM, Uwe Ligges wrote: On 20.08.2011 19:04, David Winsemius wrote: On Aug 20, 2011, at 12:32 PM, Uwe Ligges wrote: On 20.08.2011 17:04, Wendy wrote: Hi all, I have a data.frame like following

Re: [R] val.surv

2011-08-20 Thread Salvo Mac
Thanks David However, I tried your trick on val.surv with newdata=test['age'] but still didn't work.  Still gives the same error message: Error in val.surv(f.1, newdata = test1[age], u = 10) :    dims [product 1797] do not match the length of object [2496] In addition: Warning message: In

Re: [R] reshape a matrix

2011-08-20 Thread Rolf Turner
On 21/08/11 03:04, Wendy wrote: Hi all, I have a data.frame like following A-c('d0','d0','d1','d1','d2','d2') B-rep(c('control','sample'),3) C-c(rep(10,2),200,300,400,500) dataframe-data.frame(A,B,C) I want to reshape the matrix, so the matrix with 'd0', 'd1' and 'd2' in rows and

Re: [R] I have a problem with R!!

2011-08-20 Thread Rolf Turner
No, you don't have a problem with R. You have a problem with Excel. Solution: Don't use Excel. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] val.surv

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 8:08 PM, Salvo Mac wrote: Thanks David However, I tried your trick on val.surv with newdata=test['age'] but still didn't work. Still gives the same error message: Error in val.surv(f.1, newdata = test1[age], u = 10) : dims [product 1797] do not match the length of

Re: [R] val.surv

2011-08-20 Thread Salvo Mac
The test and train are like split data sets, contain similar variables but from different countries so the two sets are somehow  independent. And yes it is a data frame.  So I extracted age, time and event. So test is data frame,(age, time, event). does that suffice?

Re: [R] val.surv

2011-08-20 Thread David Winsemius
On Aug 20, 2011, at 10:25 PM, Salvo Mac wrote: The test and train are like split data sets, contain similar variables but from different countries so the two sets are somehow independent. And yes it is a data frame. What is a data.frame? test and train may be dataframes, but test[,

Re: [R] AFT model time-dependent with weibull distribution

2011-08-20 Thread JPF
question 2 *aftreg vs. survreg* for aftreg = S0 *{t/exp(b-BXi)]^a} a= shape and b= log(scale) for survreg and stata S0 *{t*exp(intercept+BXi)]^1/p} p=shape /intercept, log(scale) and estimates are equivalent with reversed sign./ *PH and AFT* /phreg.Bhat= aftreg.Bhat * shape /