[R] Dynamically defining dplyr across statements (was dplyr: summarise across using variable names and a condition)

2021-03-29 Thread Paul Miller via R-help
quot;{col}_{fn}"   )) %>%   select(starts_with(vars_num) | ends_with("mean")) %>%   rename_at(vars(!starts_with(vars_num)), list(~ str_replace(., "mean$", "prop"))) %>%   all.equal(need) On Friday, March 26, 2021, 1:08:58 p.m. EDT, Rui Barradas wrot

[R] dplyr: summarise across using variable names and a condition

2021-03-26 Thread Paul Miller via R-help
Hello All, Would like to be able to summarize across in dplyr using variable names and a condition. Below is an example "have" data set followed by an example "need" data set. After that, I've got a vector of numeric variable names. After that, I've got the very humble beginnings of a dplyr-bas

[R] Running list of drugs taken and dropped (via Reduce and accumulate = TRUE or by other means)

2019-01-10 Thread Paul Miller via R-help
Hello All, Would like to keep a running total of what drugs cancer patients have taken and what drugs have been dropped. Searched the Internet and found a way to cumulatively paste a series of drug names. Am having trouble figuring out how to make the paste conditional though. Below is some s

Re: [R] R code for if-then-do code blocks

2018-12-19 Thread Paul Miller via R-help
Hi Gabor, Richard, and Thierry, Thanks very much for your replies. Turns out I had already hit on Gabor's idea of "factor out" in writing an initial draft of the code converting from SAS to R. Below is the link Gabor sent describing this and other approaches. https://stackoverflow.com/questio

[R] R code for if-then-do code blocks

2018-12-17 Thread Paul Miller via R-help
Hello All, Season's greetings! Am trying to replicate some SAS code in R. The SAS code uses if-then-do code blocks. I've been trying to do likewise in R as that seems to be the most reliable way to get the same result. Below is some toy data and some code that does work. There are some thing

Re: [R] Extracting sentences with combinations of target words/terms from cancer patient text medical records

2017-07-13 Thread Paul Miller via R-help
tern <- "([^.?!]*(?=[^.?!]*\\bbreast\\b)(?=[^.?!]*\\b(metastatic|stage > IV)\\b)(?=[\\s.?!])[^.?!]*[.?!])" > regmatches(txt, gregexpr(pattern, txt, perl=TRUE, ignore.case=TRUE))[[1]] [1] "Patient had stage IV breast cancer." [2] " Metastatic and breast

Re: [R] Extracting sentences with combinations of target words/terms from cancer patient text medical records

2017-07-12 Thread Paul Miller via R-help
quate? Bert On Jul 11, 2017 10:49 AM, "Paul Miller via R-help" wrote: Hello All, > >I need some help figuring out how to extract combinations of target >words/terms from cancer patient text medical records. I've provided some >sample data and code below to illustr

[R] Extracting sentences with combinations of target words/terms from cancer patient text medical records

2017-07-11 Thread Paul Miller via R-help
Hello All, I need some help figuring out how to extract combinations of target words/terms from cancer patient text medical records. I've provided some sample data and code below to illustrate what I'm trying to do. At the moment, I'm trying to extract sentences that contain the word "breast" p

Re: [R] Survival Analysis with an Historical Control

2014-07-22 Thread Paul Miller
Hi Chris, Thanks for your reply. Certainly no need to apologize for a delayed response. Appreciate your taking the time to answer my question. My concern was about the value of "16". My understanding is it is based on one expert's opinion. I wondered if this is in keeping with whatever the sta

Re: [R] Survival Analysis with an Historical Control

2014-07-10 Thread Paul Miller
Hi Chris, Thanks for pointing out the use of "View page source". Very helpful to know. Do you happen to know anything about how to perform the analysis itself? I haven't been able to find anything confirming that the approach described in my original email (below) is correct. Thanks, Paul

Re: [R] Survival Analysis with an Historical Control

2014-07-10 Thread Paul Miller
Hi Dr. Therneau, Thanks for your response. This is very helpful. My historical control value is 16 weeks. I've been having some trouble though determining how this value was obtained. Are you able to indicate how people normally go about determining a value for the historical control? Or do you

[R] Survival Analysis with an Historical Control

2014-07-08 Thread Paul Miller
Hello All, I'm trying to figure out how to perform a survival analysis with an historical control. I've spent some time looking online and in my boooks but haven't found much showing how to do this. Was wondering if there is a R package that can do it, or if there are resources somewhere that s

[R] Analysis of censored cost data

2014-04-23 Thread Paul Miller
Hello All, Am intested in using R to analyze censored cost data. Looks like I'd need to estimate some means and associated variances. I've got a few papers describing this. These talk about the use of re-weighted estimators (Lin), inverse probability weighted estimators (Bang-Tsiatis), phase-ba

Re: [R] Trouble Computing Type III SS in a Cox Regression

2013-04-26 Thread Paul Miller
ning this is a > re-education issue, and I can't much help with that. Fortune nomination! cheers, Rolf --- On Thu, 4/25/13, Terry Therneau wrote: > From: Terry Therneau > Subject: Re: Trouble Computing Type III SS in a Cox Regression > To: "Paul Miller&qu

Re: [R] Trouble Computing Type III SS in a Cox Regression

2013-04-25 Thread Paul Miller
Therneau wrote: > From: Terry Therneau > Subject: Re: Trouble Computing Type III SS in a Cox Regression > To: r-help@r-project.org, "Paul Miller" > Received: Wednesday, April 24, 2013, 5:55 PM > I should hope that there is trouble, > since "type III" is an u

[R] Trouble Computing Type III SS in a Cox Regression using drop1 and Anova

2013-04-24 Thread Paul Miller
Hello All, Am having some trouble computing Type III SS in a Cox Regression using either drop1 or Anova from the car package. Am hoping that people will take a look to see if they can tell what's going on. Here is my R code: cox3grp <- subset(survData, Treatment %in% c("DC", "DA", "DO"), c("PT

Re: [R] odfWeave: Some questions about potential formatting options

2013-04-22 Thread Paul Miller
uchet-Valat Subject: Re: [R] odfWeave: Some questions about potential formatting options To: "Paul Miller" Cc: "Max Kuhn" , r-help@r-project.org Received: Wednesday, April 17, 2013, 11:17 AM Le mardi 16 avril 2013 à 10:15 -0700, Paul Miller a écrit : > Hi Milan and Max, &

Re: [R] odfWeave: Some questions about potential formatting options

2013-04-16 Thread Paul Miller
Hi Milan and Max, Thanks to each of you for your reply to my post. Thus far, I've managed to find answers to some of the questions I asked initially. I am now able to control the justification of the leftmost column in my tables, as well as to add borders to the top and bottom. I also downloade

Re: [R] Convert results from print(survfit(formula, ...)) into a matrix or data frame

2013-04-15 Thread Paul Miller
Hi Marc, Oh, yes. That is quite simple. Silly me for not recognizing this. Thanks very much for your help. Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org

[R] Convert results from print(survfit(formula, ...)) into a matrix or data frame

2013-04-15 Thread Paul Miller
Hello All, Below is some sample survival analysis code. I'd like to able to get the results from print(gehan.surv) into a matrix or data frame, so I can manipulate them and then create a table using odfWeave. Trouble is, I'm not quite sure how make such a conversion using the results from a pri

[R] odfWeave: Some questions about potential formatting options

2013-04-11 Thread Paul Miller
Hello All, Learning to use the odfWeave package. I really like the package. It has good documentation, makes some very nice looking tables, and seems to have lots of options for customizing output. There are a few things I'd like to do that don't seem to be covered in the documentation though.

Re: [R] Table with n(%) formatting: A better way to do this?

2013-04-11 Thread Paul Miller
Hello Dr. Murdoch, Thanks for your reply. Your tables package is interesting. Spent some time experimenting with it yesterday and it looks like something I can use. The n(%) format seems to be the standard for what I'm doing. So I can't directly use the output your package produces. It does pro

[R] Table with n(%) formatting: A better way to do this?

2013-04-10 Thread Paul Miller
Hello All, Am learning to create tables with n(%) formatting using R. Below is a working example. I think this is not bad but wondered if there are better ways of doing it. Although it can be quite humbling, seeing good code helps me assess my progress as an R programmer. Ultimately want to h

Re: [R] Converting matrix to data frame without losing an assigned dimname

2013-04-10 Thread Paul Miller
Hi David, Gabor, Arun, and Rolf,   Thanks for your replies to my question. Very interesting and very helpful. I particularly liked the one-line solutions proposed by David and Gabor. I had a suspicion that this conversion could be done using only a minimal amount of code.   For what I'm doing, i

[R] Converting matrix to data frame without losing an assigned dimname

2013-04-09 Thread Paul Miller
Hello All, Would like to be able to convert a matrix to a dataframe without losing an assigned dimname. Here is an example that should illustrate what I'm talking about. tableData <- state.x77[c(7, 38, 20, 46), c(7, 1, 8)] names(dimnames(tableData)) <- c("State", "") tableData State F

Re: [R] odfWeave: Trouble Getting the Package to Work

2013-02-20 Thread Paul Miller
Hi Max,   It works! Updating the odfWeave and xml software did the trick. Thanks very much for your help.   Paul [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do r

Re: [R] odfWeave: Trouble Getting the Package to Work

2013-02-18 Thread Paul Miller
expected '&' 1: paste(levels(iris$Species), collapse = &       ^ > > --- On Mon, 2/18/13, Max Kuhn wrote: From: Max Kuhn Subject: Re: [R] odfWeave: Trouble Getting the Package to Work To: "Paul Miller" Cc: "r-help@r-p

[R] odfWeave: Trouble Getting the Package to Work

2013-02-18 Thread Paul Miller
Hello All, Have recently started learning Sweave and Knitr. Am now trying to learn odfWeave as well. Things went pretty smoothly with Sweave and Knitr but I'm having some trouble with odfWeave. My understanding was that odfWeave should work in pretty much the same way as Sweave. With odfWeave,

Re: [R] Retain last grouping after a strsplit()

2012-12-12 Thread Paul Miller
Hi Steven, Not sure if you want to understand regular expressions in general or just the solution to your particular problem. If it's the former and you'd be willing to read a book on the subject, I'd recommend "Mastering Regular Expressions" by Jeffrey Friedl. I'm about halfway through now, an

Re: [R] SEM validation: Cross-Validation vs. Bootstrapping

2012-11-02 Thread Paul Miller
Hi Joshua, Thanks for your very helpful reply. I took a look at your mediation tutorial, MplusAutomation, and semutils. I may not need any of this for the current project, but it was very interesting and I could imagine using it in the future. I also looked at the Hastie, Tibshirani, & Friedman

[R] SEM validation: Cross-Validation vs. Bootstrapping

2012-11-01 Thread Paul Miller
Hello All, Recently, I was asked to help out with an SEM cross-validation analysis. Initially, the project was based on "sample-splitting" where half of cases were randomly assigned to a training sample and half to a testing sample. Attempts to replicate a model developed in the training sample

[R] Text mining? Text manipulation? Both? Predicting KRAS test results in cancer patients

2012-09-28 Thread Paul Miller
Happy Friday Everyone,   Hope Friday afternoon doesn't turn out to be a terrible time to post a question. I've been doing a little data mining of patient text medical records as of late. I started out trying to predict whether or not cancer patients had received KRAS mutation testing and did qui

Re: [R] A LaTeX question -- Hope people won't mind

2012-08-20 Thread Paul Miller
rom: Marc Schwartz > Subject: Re: [R] A LaTeX question -- Hope people won't mind > To: "Paul Miller" > Cc: r-help@r-project.org > Received: Monday, August 20, 2012, 3:27 PM > On Aug 20, 2012, at 3:13 PM, Paul > Miller > wrote: > > > Hello All, > >

[R] A LaTeX question -- Hope people won't mind

2012-08-20 Thread Paul Miller
Hello All, Hope people won't mind my posting a LaTeX question here. I know a lot of people who use R are also using LaTeX. I'm in a bit of a rush to complete a document and am having trouble with one aspect of the formatting. I'm creating a list of tables using: \listoftables I also have som

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-18 Thread Paul Miller
-varying covariate To: "Marc Schwartz" , "Greg Snow" <538...@gmail.com>, r-help@r-project.org, "Paul Miller" Received: Wednesday, July 18, 2012, 8:24 AM Marc gave the referencer for Schoenfeld's article.  It's actually quite simple. Sample size for a C

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-15 Thread Paul Miller
he actual analysis itself, I'll start out using the steps you've listed and see where that takes me.   Paul   --- On Fri, 7/13/12, Greg Snow <538...@gmail.com> wrote: From: Greg Snow <538...@gmail.com> Subject: Re: [R] Power analysis for Cox regression with a time-varying covari

[R] Power analysis for Cox regression with a time-varying covariate

2012-07-13 Thread Paul Miller
Hello All, Does anyone know where I can find information about how to do a power analysis for Cox regression with a time-varying covariate using R or some other readily available software? I've done some searching online but haven't found anything. Thanks, Paul _

Re: [R] How can I get this function to work?

2012-06-01 Thread Paul Miller
Hi Sarah, That I was making things too complicated doesn't surprise me. A skilled programmer makes everything look easy I think. And someone who is still learning does just the opposite. Am going to spend some time now looking through your tweaks. Thank you very much for your help. Paul

Re: [R] How can I get this function to work?

2012-06-01 Thread Paul Miller
Hello Bert and Sarah, Thank you for your replies. Helped me understand how people might perceive my question and why they might not respond. Spent some time learning about R's debugging tools this morning. Began to realize why my function didn't work. My second argument was the name of a vari

[R] How can I get this function to work?

2012-05-31 Thread Paul Miller
Hello All, Can anyone tell help me understand why the function below doesn't work and how I can fix it? Below are some sample data, some code that works on individual rows of the data, and my attempt to translate that code into a function. My hope is to get the function working and then to appl

Re: [R] Complex text parsing task

2012-05-21 Thread Paul Miller
g task > To: "Paul Miller" > Cc: "Nick Gayeski" , r-help@r-project.org > Received: Monday, May 21, 2012, 11:01 AM > Hi Paul, > > I do not think that Nick's comment was really meant to be > directed at > you.  He is probably just tired of getting so man

Re: [R] Complex text parsing task

2012-05-21 Thread Paul Miller
Hi Nick, Can you elaborate (hopefully in a constructive way) on what it is that you find objectionable about my post? Thanks, Paul --- On Mon, 5/21/12, Nick Gayeski wrote: > From: Nick Gayeski > Subject: RE: [R] Complex text parsing task > To: "'Paul Miller'

[R] Complex text parsing task

2012-05-21 Thread Paul Miller
Hello Everyone, I have what I think is a complex text parsing task. I've provided some sample data below. There's a relatively simple version of the coding that needs to be done and a more complex version. If someone could help me out with either version, I'd greatly appreciate it. Here are my

Re: [R] Correlation in Rattle

2012-05-18 Thread Paul Miller
u could try contacting Graham Williams to see what he suggests. Or you could turn this over to an IT person if you have one. Sorry I can't be of more help. Paul --- On Fri, 5/18/12, avideh yesharim wrote: From: avideh yesharim Subject: Re: Correlation in Rattle To: "Paul Miller"

Re: [R] Correlation in Rattle

2012-05-18 Thread Paul Miller
Hi Avideh, I have Rattle installed on the 64-bit version of R 2.15.0 and this seems to work OK. I had a dataset of my own loaded into Rattle when I saw your email. Tried creating the plot using these data but got a warning saying I should limit the number of variables to 40. So I changed to the

[R] Finding words that are within +/- X words of "KRAS" using tm package or other means

2012-05-16 Thread Paul Miller
Hello All, This will probably be easy for some but isn't for me. Currently am working on a text mining exercise. Want to be able to predict whether cancer patients got KRAS testing, and, if so, whether the test yielded a result of wild type/negative or mutant/positive. I've begun with a "bag-of

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-27 Thread Paul Miller
Greg Snow <538...@gmail.com> > Subject: Re: [R] Selecting columns whose names contain "mutated" except when > they also contain "non" or "un" > To: "Paul Miller" > Cc: r-help@r-project.org > Received: Thursday, April 26, 2012, 1:55 PM > S

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-25 Thread Paul Miller
Hello Dr. Winsemius, There was a non-numeric column. Thanks for helping me to see the obvious. Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guid

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-24 Thread Paul Miller
Hi Greg, This is quite helpful. Not so good yet with regular expressions in general or Perl-like regular expressions. Found the help page though, and think I was able to determine how the code works as well as how I would select only instances where "muta" is preceeded by either "non" or "un".

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-23 Thread Paul Miller
se names contain "mutated" except when > they also contain "non" or "un" > To: "Paul Miller" > Cc: "David Winsemius" , r-help@r-project.org > Received: Monday, April 23, 2012, 12:15 PM > But maybe ... (see below) > -- Bert > &g

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-23 Thread Paul Miller
ing columns whose names contain "mutated" except when > they also contain "non" or "un" > To: "Paul Miller" > Cc: r-help@r-project.org > Received: Monday, April 23, 2012, 11:16 AM > > On Apr 23, 2012, at 12:10 PM, Paul Miller wrote: > &g

[R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-23 Thread Paul Miller
Hello All, Started out awhile ago trying to select columns in a dataframe whose names contain some variation of the word "mutant" using code like: names(KRASyn)[grep("muta", names(KRASyn))] The idea then would be to add together the various columns using code like: KRASyn$Mutant_comb <- rowSum

[R] Text mining: Narrowing a field of 27, 855 predictors using semi-partial correlations or some other means

2012-04-18 Thread Paul Miller
Hello Everyone, Trying to learn a little bit about data mining. I'm working on a text mining project that will attempt to predict whether cancer patients got a particular type of genetic testing. A subsequent stage then will be aimed at predicting what the results of that testing were.   I've

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-18 Thread Paul Miller
-help@r-project.org, "Paul Miller" > Received: Monday, April 16, 2012, 8:30 AM > On 04/14/2012 05:00 AM, r-help-requ...@r-project.org > wrote: > > Am replicating in R an analysis I did earlier using > SAS. See this as a test of whether I'm ready to start usin

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-14 Thread Paul Miller
Hello Drs. Colosimo and Harrell,   Thank you for your replies to my question. From Dr. Colosimo, I was able to determine that the SAS results can be replicated by adding the option conf.type="log-log" to my code as in :   survobj <- survfit(survfrm, conf.type="log-log", data=Survival)   Originall

Re: [R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-13 Thread Paul Miller
Hi Enrico, Not sure how SAS builds the CI but I can look into it. The SAS documentation does have a section on computational formulas at: http://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_lifetest_a000259.htm Although I can't provide my dataset, I can p

[R] Kaplan Meier analysis: 95% CI wider in R than in SAS

2012-04-13 Thread Paul Miller
Hello All,   Am replicating in R an analysis I did earlier using SAS. See this as a test of whether I'm ready to start using R in my day-to-day work.   Just finished replicating a Kaplan Meier analysis. Everything seems to work out fine except for one thing. The 95% CI around my estimate for the

Re: [R] Adding text for written comments to bottom of graphs

2012-04-06 Thread Paul Miller
Hi Baptiste, Thanks for your help with this. Sorry for being slow to express my appreciation. I had intended to put some more time into tweaking the graphs before responding. Recently have been reading Hadley Wickham's ggplot2 book and have also located some materials on the knitr package. Didn

Re: [R] Adding text for written comments to bottom of graphs

2012-03-31 Thread Paul Miller
Hello Baptiste, What you've done is very interesting. Went through and tried to understand all the steps. Reminded me of studying languages in years gone by. Always found it easier to read and understand a sentence than to construct a sentence of one's own. This is particularly true when you're

[R] Adding text for written comments to bottom of graphs

2012-03-30 Thread Paul Miller
Hello All, Recently developed the code below for graphing patterns of chemotherapy administration. As someone just starting to use R in their work, I managed to figure out some parts of the code but needed help with others. setwd("N:/Regimen Coding/0906/Plots Test") getwd() TestData <- struct

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-28 Thread Paul Miller
Hello All, Figured out how to get the gaps in the bars when a drug stops and the starts again (see below). Made the graph overlaid/superimposed/stacked and got the desired result. Not sure this is how an expert would do it. But it's simple and it works. Paul setwd("N:/Regimen Coding/0906/Pl

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-27 Thread Paul Miller
insemius > Subject: Re: [R] Plotting patient drug timelines using ggplot2 (or some other > means) -- Help!!! > To: "Paul Miller" > Cc: "R. Michael Weylandt" , "Petr PIKAL" > , "Bert Gunter" , > r-help@r-project.org > Received: Friday, March

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-23 Thread Paul Miller
s over the last day or so. Paul --- On Fri, 3/23/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Plotting patient drug timelines using ggplot2 (or some other > means) -- Help!!! > To: "Paul Miller" > Cc: "Petr PIKAL" , r-he

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-23 Thread Paul Miller
Petr suggested. I didn't think it would help but wanted to try just in case. No dice -- ggplot just doesn't seem to like lists. Thanks, Paul --- On Fri, 3/23/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Plotting patient drug timelines using

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-23 Thread Paul Miller
Hi Michael, Added a little more to my code (see below). It now automatically sets the name of the file. It also does a better job of spacing the text for pattern and patient x line at the top of the graph. I really like the way this looks now. I just need to figure out how to loop through the

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hi Michael, This may be an ugly way of doing things but the "title = unique(paste( ..." bit in the code below automates the code for pattern, patient, and line. So now all I'd need is the looping part. If good ways of automating the code for pattern, patient, and line or of doing the looping a

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
et up correctly. The graphs themselves might be called something like plot11, plot12, plot21, and plot22. Thanks, Paul --- On Thu, 3/22/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Plotting patient drug timelines using ggplot2 (or some oth

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
le_key = 2, line = 1)") + opts(axis.text.x = theme_blank() ) --- On Thu, 3/22/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Plotting patient drug timelines using ggplot2 (or some other > means) -- Help!!! > To: "Pau

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
anges? Or can anyone else show me how to make them? Thanks, Paul --- On Thu, 3/22/12, Bert Gunter wrote: > From: Bert Gunter > Subject: Re: [R] Plotting patient drug timelines using ggplot2 (or some other > means) -- Help!!! > To: "Paul Miller" > Cc: r-help@r-proje

[R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-22 Thread Paul Miller
Hello All, Want very much to learn how to plot patient drug timelines. Trouble is I need to figure out how to do this today. So not much time for me to struggle with it. Hoping someone can just help me out a bit. Below are some sample data and code that produces what I think is the beginning o

Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-21 Thread Paul Miller
Hello All, Tried some more Internet searches and came to the conclusion that one probably does need to create a "timevar" before reshaping from long to wide. Below is some code that creates the "timevar" and transposes the data. connection <- textConnection(" 005 1 Gemcitabine 005 2 Erlotinib

Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-20 Thread Paul Miller
Erlotinib, Paclitaxel" instead of "Gemcitabine, Paclitaxel, Erlotinib". That's what I mean when I say I want the columns in alphabetical order. Thanks, Paul --- On Tue, 3/20/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Reshaping data

[R] Reshaping data from long to wide without a "timevar"

2012-03-20 Thread Paul Miller
Hello All, I was wondering if it's possible to reshape data from long to wide in R without using a "timevar". I've pasted some sample data below along with some code. The data are sorted by Subject and Drug. I want to transpose the Drug variable into multiple columns in alphabetical order. My

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-20 Thread Paul Miller
Hi Brian, This works very well. Still trying to develop some skill with R. So can't say I understand your function completely as yet, but will work on it. I had thought that your function might only work for two columns (because of the "function(x,y)" part), but the example below suggests it wi

Re: [R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-17 Thread Paul Miller
Hi Michael, So the coalesce functions don't do what I thought they did. I'll just use ifelse() then unless anyone makes it clear I should do something different. Thanks, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/

[R] Coalesce function in BBmisc, emoa, and microbenchmark packages

2012-03-17 Thread Paul Miller
Hello All, Need to coalesce some columns using R. Looked online to see how this is done. One approach appears to be to use ifelse. Also uncovered a coalesce function in the BBmisc, emoa, and microbenchmark packages. Trouble is I can't seem to get it to work in any of these packages. Or perhaps

[R] Question about measurment invariance in a multigroup SEM

2012-02-09 Thread Paul Miller
Hello All, I have a question about measurement invariance in a multigroup SEM. I am of the impression that one cannot test the equality of structural paths across groups without demonstrating measurement invariance of latent factors first. At a minimum, this would involve demonstrating that cor

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-02-04 Thread Paul Miller
Hi David and Rui, Sorry to be so slow in replying. Thank you both for pointing out that the problem with my code was that I was using comparison operators on mixed data types. This is something I'll have to be more careful about in the future. In an earlier email, David talked about how R can s

Re: [R] Checking for invalid dates: Code works but needs improvement

2012-02-01 Thread Paul Miller
Hi Marc, That the code I wrote initially is over engineered is certainly possible. Of course, Rui's solution is a reworking of that code. If starting from scratch, Rui likely would have done something quite different. I focused on Rui's code because it was complete and was a clear improvement o

[R] Using 2SLS to mimic SEM with nested data

2012-01-31 Thread Paul Miller
Hello Everyone, I am familiar with the use of 2SLS to mimic SEM. I even used this approach once to estimate a model with a latent interaction term. Does anyone know how to extend this approach to nested data? I have cancer patients with measures of cancer symptoms, functional impairment, and p

[R] Checking for invalid dates: Code works but needs improvement

2012-01-30 Thread Paul Miller
Hi Rui, Marc, and Gabor, Thanks for your replies to my question. All were helpful and it was interesting to see how different people approach various aspects of the same problem. Spent some time this weekend looking at Rui's solution, which is certainly much clearer than my own. Managed to figu

[R] Checking for invalid dates: Code works but needs improvement

2012-01-26 Thread Paul Miller
rint' it allows for several arguments and (very) simple formating. { cat("Error: Invalid date values in", DateNames[[i]], "\n", TestDates[DateNames][[i]][TestDates$Invalid==1], "\n") } Rui Barradas Message: 53 Date: Tue, 24 Jan 2012 08:54:49 -

Re: [R] R-help Digest, Vol 107, Issue 25

2012-01-26 Thread Paul Miller
TestDates[DateNames][[i]][TestDates$Invalid==1], "\n") } Rui Barradas Message: 53 Date: Tue, 24 Jan 2012 08:54:49 -0800 (PST) From: Paul Miller To: r-help@r-project.org Subject: [R] Checking for invalid dates: Code works but needs improvement Message-ID: <1327424089.1149.y

[R] Checking for invalid dates: Code works but needs improvement

2012-01-24 Thread Paul Miller
Hello Everyone, Still new to R. Wrote some code that finds and prints invalid dates (see below). This code works but I suspect it's not very good. If someone could show me a better way, I'd greatly appreciate it. Here is some information about what I'm trying to accomplish. My sense is that th

[R] Checking dates for entry errors

2012-01-11 Thread Paul Miller
Hello Everyone,   I have a question about how best to check dates for entry errors. I recently discovered that R will read the incorrectly entered date "11/23/21931" without producing a warning or an error message at least under some circumstances.   > as.Date("11/23/21931", format = "%m/%d/%Y")

Re: [R] Problem working with dates

2011-11-07 Thread Paul Miller
Hi Michael and David, Thank you both for your reply to my question. Problem solved. I'm finding that my level of success with R is a little uneven thus far. I'm sometimes surprised by the things I can do, but then am even more surprised by the simple things I struggle with. Appreciate your hel

[R] Problem working with dates

2011-11-07 Thread Paul Miller
Hello All, I've been reading books about R for awhile now and am in the process of replicating the SAS analyses from an old report. I want to be sure that I can do all the things I need to in R before using it in my daily work. So far, I've managed to read in all my data and have done some data

[R] Sample Size Calculation using a Drop the Loser/Keep the Winner Design

2011-09-26 Thread Paul Miller
Hello Everyone,   I need to perform a sample size calculation using a drop the loser/keep the winner design. I've been searching for examples of how to do this using R but haven't found much.   The most promising possibility thus far is an R function called DrpLsrNRst. This appears in the book

Re: [R] What's your favourite R book that doesn't have R in the title?

2011-08-16 Thread Paul Miller
I can add one more title. The foundations of statistics: A simulation-based approach by Vasishth and Broe. Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/

[R] What's your favourite R book that doesn't have R in the title?

2011-08-16 Thread Paul Miller
Hello All,   Recently, I discovered that there are appear to be some good R related books that don't have R in the title. For example, I'm currently reading Gellman and Hill's book Data Analysis using Regression and Multilevel/Hierarchical Models. The book uses R (and BUGS) but doesn't appear to

Re: [R] Multiple endpoint (possibly group sequential) sample size calculation

2011-08-05 Thread Paul Miller
Thanks for your reply Marc. I'll look into the information you sent. It ocurred to me that I could have done a better job of describing what I'm trying to do. It can be difficult to do that sometimes when your unfamiliar with a topic and are still trying to figure it out yourself. In investigat

[R] Multiple endpoint (possibly group sequential) sample size calculation

2011-08-04 Thread Paul Miller
Hello everyone, I need to do a sample size calculation. The study two arms and two endpoints. The two arms are two different cancer drugs and the two endpoints reflect efficacy (based on progression free survival) and toxicity. Until now, I have been trying to understand this in terms of a on

[R] Setting up counting process data for survival analysis

2011-06-13 Thread Paul Miller
Hello Everyone, I'm learning to do survival analysis in R using a time-varying covariate. I've managed to set up my data correctly using SAS and then to get the correct result using R. What I'd like help with is getting the data set up correctly in R without having to resort to using SAS. Bel

[R] Test email #2: Please ignore

2011-04-20 Thread Paul Miller
Having trouble posting. This is a second test email to help determine if the problem has been resolved. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-g

[R] Test email: Please disregard

2011-04-20 Thread Paul Miller
Having trouble posting. Thought it might have something to do with the particular message I'm sending. Sending this message to test that possibility. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the po

Re: [R] Cox Proportional Hazards model with a time-varying covariate

2011-04-01 Thread Paul Miller
Hi Terry and Kevin,   Thanks for your replies to my post. And thanks particularly to Terry for pointing out my confusion about the "exact partial likelihood" vs. the "exact marginal likelihood." I'm learning and so am likely to be confused about such things from time to time.   I had thought

[R] Cox Proportional Hazards model with a time-varying covariate

2011-03-31 Thread Paul Miller
Hello Everyone,   I'm learning how to perform various statistical analyses in R. I'm checking my understanding by replicating examples from my SAS books. Below is an attempt to replicate a Cox Proportional Hazards model with a time-varying covariate. I think I'm doing this correctly but am not c

Re: [R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-03 Thread Paul Miller
Hi Josh,   Thanks for your reply. You're right about letting R's method dispatch system choose the method for summary and inserting more spaces in the code. I was just messing around with the code in the former case and forgot to change it back. As far as not having enough whitespace goes, I've

[R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-01 Thread Paul Miller
Hello Everyone,   Figured out one part of the code. Setting the reference level for a factor is accomplished using the relevel funtion (pg. 383 of MASS; pg. 70 of Data Manipulation with R):   gad$dosegrp <- relevel(gad$dosegrp,3)   This works very well. Much better than using a format in SAS proc

[R] Pairwise T-Tests and Dunnett's Test (possibly using multcomp)

2011-03-01 Thread Paul Miller
Hello Everyone,   I've been learning to use R in my spare time over the past several months. I've read about 7-8 books on the subject. Lately I've been testing what I've learned by trying to replicate the analyses from some of my SAS books. This helps me make sure I know how to use R properly an

  1   2   >