[R] Print date on y axis with month, day, and year

2024-05-09 Thread Sorkin, John
I am trying to use ggplot to plot the data, and R code, below. The dates (jdate) are printing as Mar 01, Mar 15, etc. I want to have the date printed as MMM DD (or any other way that will show month, date, and year, e.g. mm/dd/yy). How can I accomplish this? yyy <- structure(list(

Re: [R] Question regarding reservoir volume and water level

2024-04-07 Thread Sorkin, John
Aside from the fact that the original question might well be a class exercise (or homework), the question is unanswerable given the data given by the original poster. One needs to know the dimensions of the reservoir, above and below the current waterline. Are the sides, above and below the

Re: [R] Rtools and things dependent on it

2024-02-23 Thread Sorkin, John
From: David Winsemius Sent: Friday, February 23, 2024 8:14 PM To: Sorkin, John Cc: avi.e.gr...@gmail.com; r-help@r-project.org Subject: Re: [R] Rtools and things dependent on it On 2/23/24 16:28, Sorkin, John wrote: David, My apologies regarding the format of my

Re: [R] Rtools and things dependent on it

2024-02-23 Thread Sorkin, John
Avi , Your question is not dumb. Let me ask a more fundamental question. What is R tools, what does it do, and how is it used. From time to time, I receive a message when I down load a package saying I need R tools. When I receive the message, I don’t know what I should do, other than down load

[R] Amelia. Imputation of time-series data

2024-01-05 Thread Sorkin, John
Colleagues, I have started working with Amelia, with the aim of imputing missing data for time-series data. Although I have succeeded in getting Amelia to perform the imputation, I have not found any documentation describing how Amelia imputes time-series data. I have read the basic Amelia

[R] Obtaining a value of pie in a zero inflated model (fm-zinb2)

2024-01-04 Thread Sorkin, John
I am running a zero inflated regression using the zeroinfl function similar to the model below: fm_zinb2 <- zeroinfl(art ~ . | ., data = bioChemists, dist = "poisson") summary(fm_zinb2) I have three questions: 1) How can I obtain a value for the parameter pie, which is the fraction of the

Re: [R] Advice on starting to analyze smokestack emissions?

2023-12-17 Thread Sorkin, John
Kevin, I would like to be in touch with you. I am pursuing a research project similar to yours. Perhaps we can help each other. John jsor...@som.umaryland.edu John David Sorkin M.D., Ph.D. Professor of Medicine, University of Maryland School of Medicine; Associate Director for Biostatistics and

[R] Convert two-dimensional array into a three-dimensional array.

2023-12-08 Thread Sorkin, John
Colleagues I want to convert a 10x2 array: # create a 10x2 matrix. datavals <- matrix(nrow=10,ncol=2) datavals[,] <- rep(c(1,2),10)+c(rnorm(10),rnorm(10)) datavals into a 10x3 array, ThreeDArray, dim(10,2,10). The values storede in ThreeDArray's first dimensions will be the data stored in

[R] Convert character date time to R date-time variable.

2023-12-07 Thread Sorkin, John
Colleagues, I have a matrix of character data that represents date and time. The format of each element of the matrix is "2020-09-17_00:00:00" How can I convert the elements into a valid R date-time constant? Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine, University of

[R] Error running gee function. I neither understand the error message, nor know what needs to be done the get the gee to run

2023-10-25 Thread Sorkin, John
Colleagues, I am receiving several error messages from the gee function. I don't understand the ides the error messages are trying to impart, and I don't know how to debug or correct the error. The error messages follow: > fitgee <- gee(HipFlex ~ >

[R] by function does not separate output from function with mulliple parts

2023-10-24 Thread Sorkin, John
Colleagues, I have written an R function (see fully annotated code below), with which I want to process a dataframe within levels of the variable StepType. My program works, it processes the data within levels of StepType, but the usual headers that separate the output by levels of StepType

[R] Theta from negative binomial regression and power_NegativeBinomiial from PASSED

2023-09-14 Thread Sorkin, John
Colleagues, I want to use the power_NetativeBinomial function from the PASSED library. The function requires a value for a parameter theta. The meaning of theta is not given in the documentation (at least I can�t find it) of the function. Further the descriptions of the negative binomial

Re: [R] Determining Starting Values for Model Parameters in Nonlinear Regression

2023-08-19 Thread Sorkin, John
Colleagues, At the risk of starting a forest fire, or perhaps a brush fire, while it is good to see that nlxb can find a solution from arbitrary starting values, I think Paul’s question has merit despite Professor Nash’s excellent and helpful observation. Although non-linear algorithms can

[R] ggplot: Can plot graphs with points, can't plot graph with points and line

2023-07-12 Thread Sorkin, John
I am trying to plot four points, and join the points with lines. I can plot the points, but I can't plot the points and the line. I hope someone can help my with my ggplot code. # load ggplot2 if(!require(ggplot2)){install.packages("ggplot2")} library(ggplot2) # Create data Time <-

Re: [R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Sorkin, John
My life is complete. I have inspired a fortune! John From: Rolf Turner Sent: Monday, July 3, 2023 6:34 PM To: Bert Gunter Cc: Sorkin, John; r-help@r-project.org (r-help@r-project.org); Achim Zeileis Subject: Re: [R] Create a variable lenght string

[R] Create a variable lenght string that can be used in a dimnames statement

2023-07-03 Thread Sorkin, John
Colleagues, I am sending this email again with a better description of my problem and the area where I need help. I need help creating a string of variables that will be accepted by the dimnames function. The string needs to start with the dimnames j and k followed by a series of dimnames

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
j, k, xxx1, xxx2 to the matrix # create column names, j, k, xxx1, xxx2. dimnames(myvalues)<-list(NULL,c(zzz)) colnames(myvalues)<-zzz ____ From: Jeff Newmiller Sent: Monday, July 3, 2023 2:45 PM To: Sorkin, John Cc: r-help@r-project.org Subject: Re: [

Re: [R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
On July 3, 2023 11:00:32 AM PDT, "Sorkin, John" wrote: I am trying to create an array, myvalues, having 2 rows and 4 columns, where the column names are j,k,xxx1,xxx2. The code below fails, with the following error, "Error in dimnames(myvalues) <- list(NULL, zzz) : lengt

[R] Create matrix with column names wiht the same prefix xxxx and that end in 1, 2

2023-07-03 Thread Sorkin, John
I am trying to create an array, myvalues, having 2 rows and 4 columns, where the column names are j,k,xxx1,xxx2. The code below fails, with the following error, "Error in dimnames(myvalues) <- list(NULL, zzz) : length of 'dimnames' [2] not equal to array extent" Please help me get the code

Re: [R] R does not run under latest RStudio

2023-04-06 Thread Sorkin, John
I have also had difficulty running R in RStudio. Has anyone else had problems? It will be a shame if we need to abandon R Studio. It is a very good IDE. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine

[R] Error: 'format_glimpse' is not an exported object from 'namespace:pillar'

2023-03-21 Thread Sorkin, John
I am receiving the following error message. I don't understand what it means, and I don't know how to fix it. I am running my code in R studio. I do not know if the error comes from R or RStudio. Please see session data below, Thank you, John version data: platform x86_64-w64-mingw32

Re: [R] Trying to learn how to write an "advanced" function

2023-03-16 Thread Sorkin, John
ite an "advanced" function On 2023-03-16 12:11 +, Sorkin, John wrote: > (1) can someone point me to an > explanation of match.call or match > that can be understood by the > uninitiated? Dear John, the man page ?match tells us that match matches the first vector again

[R] Trying to learn how to write an "advanced" function

2023-03-16 Thread Sorkin, John
I am trying to understand how to write an "advanced" function. To do so, I am examining the lm fucnction, a portion of which is pasted below. I am unable to understand what match.call or match does, and several other parts of lm, even when I read the help page for match.call or match. (1)

[R] Trying to learn how to write a function

2023-03-16 Thread Sorkin, John
I am trying to understand how to write an "advanced" function. To do this, I am examining the code of lm, a small part of the lm code is below. N > lm function (formula, data, subset, weights, na.action, method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE,

Re: [R] Bug in R-Help Archives?

2023-01-27 Thread Sorkin, John
My apologies, I did not mean to be part of the discussion. If there is such a thing as a pocket email (similar to a pocket dial) the email would be classified as a pocket email. John From: R-help on behalf of Rui Barradas Sent: Friday, January 27,

Re: [R] return value of {....}

2023-01-15 Thread Sorkin, John
remains BECAUSE that is how it was done and whether you like it or not, may not change much any time soon. That is why so many people like packages such as in the tidyverse because they manage to make some changes, for better and often for verse. -Original Message- From: R-help On Behalf

Re: [R] return value of {....}

2023-01-15 Thread Sorkin, John
at is known to the function, but not passed as a parameter to the function: y <- 2 myNGfunction <- function(a){ cat("a=",a,"b=",b,"\n") y <- a y2 <- y+b cat("y=",y,"y2=",y2,"\n") } # b is a global variable and will be

Re: [R] return value of {....}

2023-01-15 Thread Sorkin, John
Richard, A slight addition to your code shows an important aspect of R, local vs. global variables: x <- 137 f <- function () { a <- x x <- 42 b <- x list(a=a, b=b) } f() print(x) From: R-help on behalf of Richard O'Keefe

Re: [R] Removing variables from data frame with a wile card

2023-01-15 Thread Sorkin, John
I am new to this thread. At the risk of presenting something that has been shown before, below I demonstrate how a column in a data frame can be dropped using a wild card, i.e. a column whose name starts with "th" using nothing more than base r functions and base R syntax. While additions to R

Re: [R] Pipe operator

2023-01-03 Thread Sorkin, John
Jeff, Thank you for contributing important information to this thread. From: Jeff Newmiller Sent: Tuesday, January 3, 2023 2:07 PM To: r-help@r-project.org; Sorkin, John; Ebert,Timothy Aaron; 'R-help Mailing List' Subject: Re: [R] Pipe operator

Re: [R] Pipe operator

2023-01-03 Thread Sorkin, John
variables speed up processing or result in less memory usage? Thank you, John From: Ebert,Timothy Aaron Sent: Tuesday, January 3, 2023 12:07 PM To: Sorkin, John; 'R-help Mailing List' Subject: RE: Pipe operator The pipe shortens code and results in fewer

[R] Pipe operator

2023-01-03 Thread Sorkin, John
I am trying to understand the reason for existence of the pipe operator, %>%, and when one should use it. It is my understanding that the operator sends the file to the left of the operator to the function immediately to the right of the operator: c(1:10) %>% mean results in a value of 5.5

[R] Plot a line using ggplot2

2022-12-08 Thread Sorkin, John
Colleagues, I am trying to plot a simple line using ggplot2. I get the axes, but I don't get the line. Please let me know what my error I am making. Thank you, John # Define x and y values PointEstx <- Estx+1.96*SE PointEsty <- 1 row2 <- cbind(PointEstx,PointEsty) linedata<-

Re: [R] Restoration of "rite" package of R as R-script editor or the like

2022-05-24 Thread Sorkin, John
An interesting thread that perhaps, at this time, needs to be put to bed. j From: R-help on behalf of Avi Gross via R-help Sent: Tuesday, May 24, 2022 10:25 PM Cc: r-help@r-project.org Subject: Re: [R] Restoration of "rite" package of R as R-script

Re: [R] [External] result of mean(v1, v2, v3) of three real number not the same as sum(v1, v2, v3)/3

2022-05-12 Thread Sorkin, John
From: Richard M. Heiberger Sent: Thursday, May 12, 2022 3:52 PM To: Sorkin, John; r-help@r-project.org Subject: Re: [External] [R] result of mean(v1, v2, v3) of three real number not the same as sum(v1, v2, v3)/3 you wrote mean(mlagFZ1,mlagFZ2,mlagFZ3) you intended to write

[R] superscript of plot 2 x-mean(x) vs. (x-xmean)^2 has part of the superscript 2 cutoff.

2022-04-10 Thread Sorkin, John
I am trying to produce two plots, one of x vs x^2 and the other x-mean(x) vs. (x-mean(x))^2 using base R functions. All works well EXCEPT for the superscript of the y axis of the second plot. Half of the superscript 2 in (x-mean(x))^2 is cut off. My code follows. Any suggestions for

Re: [R] [External] Re: Save a graph file use jpeg(file=file)

2022-01-05 Thread Sorkin, John
I'll try that. Get Outlook for iOS<https://aka.ms/o0ukef> From: Richard M. Heiberger Sent: Wednesday, January 5, 2022 8:31:15 PM To: Sorkin, John ; Duncan Murdoch ; r-help@r-project.org (r-help@r-project.org) Subject: Re: [External] Re: [R] Save a grap

Re: [R] Save a graph file use jpeg(file=file)

2022-01-05 Thread Sorkin, John
, at least 300 DPI. Do you have any suggestions? Thanks as always. John From: Duncan Murdoch Sent: Wednesday, January 5, 2022 2:58 PM To: Sorkin, John; r-help@r-project.org (r-help@r-project.org) Subject: Re: [R] Save a graph file use jpeg(file=file) On 05/01

Re: [R] Save a graph file use jpeg(file=file)

2022-01-05 Thread Sorkin, John
-Original Message- From: R-help On Behalf Of Sorkin, John Sent: Wednesday, January 5, 2022 2:46 PM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Save a graph file use jpeg(file=file) [External Email] I am trying to create a 3-D graph (using scatter3d) and save the graph

[R] Save a graph file use jpeg(file=file)

2022-01-05 Thread Sorkin, John
I am trying to create a 3-D graph (using scatter3d) and save the graph to a file so I can insert the graph into a manuscript. I am able to create the graph. When I run the code below an RGL window opens that has the graph. The file is saved to disk after dev.odd() runs. Unfortunately, when I

Re: [R] checkpointing

2021-12-17 Thread Sorkin, John
Colleagues, I am late to this thread. (It brings me back to my days running checkpoint restart on an IBM 370, which very useful for very, very long jobs). A search for "linux checkpoint restore" retrieved information about CIRU (Checkpoint/Restore in user space) which sounds a lot like the

Re: [R] R vs Numpy

2021-10-28 Thread Sorkin, John
Catherine, R is a program that is designed for the statistical analysis and visual display of data. Advantages and disadvantages depend on what you want to do with the language. John From: R-help on behalf of Catherine Walt Sent: Thursday, October

Re: [R] Sin curve question

2021-07-24 Thread Sorkin, John
Try something like the following copdat$degrees <- c(1:180) John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene Street GRECC

Re: [R] zero weights in weighted.mean

2021-07-14 Thread Sorkin, John
Gentlemen, At the risk of beating a dead horse, but in he spirit of learning more about R, aren't the two expressions functionally the same? One drops values where weight is zero. The other (in the case where we and infinity * 0, something one would not expect to see in data) also drops data

Re: [R] Help for Use of R software

2021-06-06 Thread Sorkin, John
Simon, I suggest you look at the web page https://cran.r-project.org/web/packages/SampleSize4ClinicalTrials/SampleSize4ClinicalTrials.pdf The package SampleSize4Clinical Trials appears to be exactly what you want. I believe it can produce a sample size estimate comparing two proportions for

[R] Plotting Coxph model with an interaction.

2021-05-20 Thread Sorkin, John
Colleagues, I hope someone can tell me how to plot a cox model that contains an interaction term. I know that plot(survfit(. . . . )) can be used to plot a Cox model, i.e.. coxfit <- coxph(Surv(futime, fustat) ~ age+rx, data = ovarian) plot(survfit(fit, newdata=data.frame(age=60,rx=2))) but

[R] COXPH: How should weights be entered in coxph, as the log of the weight or as the weight on its original scale?

2021-05-19 Thread Sorkin, John
When running a propensity score weighted analysis using coxph(), are the weights entered as the log of the weights, or as the weights on the original scale, i.e. coxph(Surv(time,status)~group,weights=weights ,data=mydata) or

[R] Contrasts in coxph

2021-04-05 Thread Sorkin, John
I would like to define contrasts on the output of a coxph function. It appears that the contrast function from the contrast library does not have a method defined that will allow computation of contrasts on a coxph object. How does one define and evaluate contrasts for a cox model? Thank you,

[R] Plotting adjusted KM curve

2021-04-04 Thread Sorkin, John
Colleagues, I am using the coxph to model survival time. How do I plot an adjusted Kaplan Meir plot resulting from coxph? The code I would like to run would start with: # run cox model fit1Cox <- coxph(surv_object ~age+sex,data=mydata) I have no idea what would follow. I would like to plot

[R] cox.zph

2021-03-31 Thread Sorkin, John
Colleagues, I would like to make certain that my understanding of the tabular output produced by cox.zph is correct. Am I correct that the NULL hypothesis being tested is that the hazard is proportional in time? Therefor a non-significant result indicates that we don't have evidence that the

Re: [R] Image processing in R for BMI calculation

2021-03-01 Thread Sorkin, John
phone number above prior to faxing) From: Heinz Tuechler Sent: Monday, March 1, 2021 6:26 PM To: Sorkin, John; Jim Lemon; Richard O'Keefe; T. A. Milne via R-help; Abby Spurdle Subject: Re: [R] Image processing in R for BMI calculation Dear All, since

Re: [R] Image processing in R for BMI calculation

2021-03-01 Thread Sorkin, John
Colleagues, BMI has is failures, but it has demonstrated utility. BMI predicts multiple outcome measures including cardiovascular disease and mortality. Don't through out a useful metric because it is not the perfect metric. As to why BMI is computed as weight/height^2, it can be shown that

[R] Adding a superscript 6 to a number

2020-12-29 Thread Sorkin, John
Colleagues, I would like to create a number (stored in the variable x) to the number with the exponent of, i.e. the number to the sixth power. The code I have tried, pasted below does not work. # create plot plot(x=0.2,y=0.2,xlim=c(0,1),ylim=c(0,1)) PNotSusp=0.69 # Create a string containing

[R] eps parameer in equiv.test

2020-10-09 Thread Sorkin, John
I am trying to understand the meaning of the eps parameter of the equiv.test parameter of the equiv.test function (package equivUMP) The help file for equiv.test states that the parameter eps is "a single strictly positive number giving the equivalence limits" What is the scale of measurement

[R] Solving a simple linear equation using uniroot give error object 'x' not found

2020-10-06 Thread Sorkin, John
Colleagues, I am trying to learn to use uniroot to solve a simple linear equation. I define the function, prove the function and a call to the function works. When I try to use uniroot to solve the equation I get an error message, Error in yfu n(x,10,20) : object 'x' not found. I hope someone

[R] Solving derivates, getting the minimum of a function, and helpful documentation of the deriv function

2020-08-29 Thread Sorkin, John
I am trying to find the minimum of a linear function: y <- (-0.0263*b) + (0.0010*B^2) I am having GREAT difficulty with the documentation of the deriv function. I have (after playing for two-hours) been able to get the following to work: zoop <-

[R] by function with sum does not give what is expected from by function with print

2020-07-23 Thread Sorkin, John
Colleagues,   The by function in the R program below is not giving me the sums I expect to see, viz., 382+170=552 4730+170=4900 5+6=11 199+25=224 ### #full R program: mydata <- data.frame(covid=c(0,0,0,0,1,1,1,1), sex=(rep(c(1,1,0,0),2)),

Re: [R] how to calculate odd ratios with R?

2020-07-06 Thread Sorkin, John
Luigi, Odds ratios can be produced using a logistic regression, which can be performed using the glm function. The following has a detailed description of how logistic regression can be performed using R: https://stats.idre.ucla.edu/r/dae/logit-regression/ John John David Sorkin M.D., Ph.D.

[R] Obtaining p values from t-test run with a by function

2020-06-12 Thread Sorkin, John
Colleagues, I am trying to retrieve the p values produced by a Student's t-test run using a by function, but can not do so. I can easily get the p value when I run s Student's t-test without a by function. What is the secret to obtaining results returned from a function run within a by

Re: [R] a question of etiquette

2020-06-01 Thread Sorkin, John
Regardless of whether the people who wrote the Matlab code you used as a reference, or who wrote the paper that published the idea that you included in your package are cited as co-authors of your package, the coders and authors should be identified as the people from whom you borrowed the idea

[R] R package for discrete-time competing-risk anlayses..

2020-05-11 Thread Sorkin, John
Can someone direct me to an R package that can run discrete-time competing risk analyses? Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine

[R] Correct way to cite R and RStudio in a manuscipt

2020-04-15 Thread Sorkin, John
What is the proper way to cite R and Rstudio is a manuscript? John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center 10 North Greene

Re: [R] Difference in offset values in R and STATA

2020-04-14 Thread Sorkin, John
Your question is unlikely to be answered unless you post code demonstrating the problem J John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine Baltimore VA Medical Center

[R] Problems using predict with GEE

2020-03-31 Thread Sorkin, John
I am running gee with a an offset followed by predict to get predicted values. The GEE analysis runs without error. When I run the predict function, I get the following error message: Error in seq_len(p) : argument must be coercible to non-negative integer In addition: Warning messages: 1: In

Re: [R] find multiple mode

2020-03-15 Thread Sorkin, John
Ding, Perhaps I am missing something. First, if you know the modes, why do you need to look for them? Second, I don�t believe the modes are as you stated, 10, 8, and 149. John Sent from Mail for Windows 10 From: Yuan Chun

[R] output of bounds function (ldbounds package)

2020-03-13 Thread Sorkin, John
I am trying to get information about the output produced by the bounds function. Code that runs the package along with sample output is below. Questions (1) Do the values given under boundaries, lower and upper (Boundaries: TimeLower UpperExit pr. Diff. pr. 1 0.10 -6.9913

Re: [R] I am struggling with contrasts

2020-03-10 Thread Sorkin, John
A Turlach Cc: Sorkin, John ; r-help@r-project.org (r-help@r-project.org) Subject: Re: [R] I am struggling with contrasts Yes. Contrasts, by definition, represents between-group differences, so cannot yield individual group levels. The closest you get is that the _intercept_ is the level of t

[R] I am struggling with contrasts

2020-03-09 Thread Sorkin, John
I am running a Poisson regression with a single outcome variable, HGE, and a single independent variable, a factor, Group which can be one of two values, Group1, or Group2. I am trying to define contrasts that will give me the values of my outcome variable (HGE) when group=Group1 and when

Re: [R] Executing an R script and show the plots.

2020-01-26 Thread Sorkin, John
Felix, I suggest you consider using an IDE such as RStudio as you develop and run R code. An integrated development environment will allow you to concentrate on learning R rather on the mechanics of running R in a non-standard environment. John John David Sorkin M.D., Ph.D. Professor of

[R] How does one pass arguments to a function, such as coxph, that itself is inside a function?

2019-12-16 Thread Sorkin, John
Question summary: How does one pass arguments to a function, such as coxph, that itself is inside a function. I am trying to write a function that will allow me to call coxph using different outcome and time variables. The coxph works when the coxph is NOT contained in a larger function (which

[R] Code that works when run as straight code, but that fails when run as a function

2019-08-23 Thread Sorkin, John
I have code that works perfectly when run as in-line code, but that fails when the code is put into a function with the following message: Error in contest1D.lmerModLmerTest(model, ll, rhs = rhs, ddf = ddf, confint = confint, : length(L) == length(model@beta) is not TRUE Why does moving the

Re: [R] Trying to understand how to sort a DF on two columns

2019-08-12 Thread Sorkin, John
with does. I have read about the with function, but I must be missing something. Thank you, John From: Bert Gunter Sent: Monday, August 12, 2019 10:36 PM To: Sorkin, John Cc: r-help@r-project.org (r-help@r-project.org) Subject: Re: [R] Trying to understand how to sort a DF on two columns https

[R] Trying to understand how to sort a DF on two columns

2019-08-12 Thread Sorkin, John
I want to sort a DF, temp, on two columns, patid and time. I have searched the internet and found code that I was able to modify to get my data sorted. Unfortunately I don't understand how the code works. I would appreciate it if someone could explain to me how the code works. Among other

Re: [R] Tying to underdressed the magic of lm redux

2019-06-01 Thread Sorkin, John
cal Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) From: Bert Gunter Sent: Wednesday, May 29, 2019 11:27 PM To: Sorkin, John Cc: r-help@r-project.org

Re: [R] Tying to underdressed the magic of lm redux

2019-05-29 Thread Sorkin, John
quot;a","b")) a b 1 1 a 2 2 b 3 3 c Am I missing something? (Apologies, if so). Bert Gunter On Wed, May 29, 2019 at 6:40 PM Sorkin, John mailto:jsor...@som.umaryland.edu>> wrote: Thanks to several kind people, I understand how to use deparse(substitute(paramter)) to ge

[R] Tying to underdressed the magic of lm redux

2019-05-29 Thread Sorkin, John
Thanks to several kind people, I understand how to use deparse(substitute(paramter)) to get as text strings the arguments passed to an R function. What I still can't do is put the text strings recovered by deparse(substitute(parameter)) back together to get the columns of a dataframe passed to

Re: [R] Trying to understand the magic of lm (Still trying)

2019-05-13 Thread Sorkin, John
-project.org; Sorkin, John Subject: Re: [R] Trying to understand the magic of lm (Still trying) John, The text below is cut out of a "how to write a package" course I gave at the R conference in Vanderbilt. I need to find a home for the course notes, because it had a lot of tidbits that ar

[R] Trying to understand the magic of lm (Still trying)

2019-05-10 Thread Sorkin, John
A number of people have helped me in my mission to understand how lm (and other fucntions) are able to pass a dataframe and then refer to a specific column in the dataframe. I thank everyone who has responded. I now know a bit about deparse(substitute(xx)), but I still don't fully understand

[R] Trying to understand the magic of lm

2019-05-08 Thread Sorkin, John
Can someone send me something I can read about passing parameters so I can understand how lm manages to have a dataframe passed to it, and use columns from the dataframe to set up a regression. I have looked at the code for lm and don't understand what I am reading. What I want to do is

Re: [R] Obtaining values of estimates from a regression; How do I get values from a list?

2019-02-22 Thread Sorkin, John
/Ivan_Calandra On February 22, 2019 at 8:50 AM Eric Berger wrote: > You have some choices > > fitchange$coefficients[2] > > zz$coefficients[2,1] > > Note that class(zz$coefficients) shows that it is a matrix. > > HTH, > Eric > > > On Fri, Feb 22, 2019 at 9:45 AM S

[R] Obtaining values of estimates from a regression; How do I get values from a list?

2019-02-21 Thread Sorkin, John
I am trying to obtain the coefficients from a regression (performed using lm). I would like to get the value for the slope (i.e. estimate) for pre from the following regression: fitchange <- lm(post-pre~pre,data=mydata2) I have tried the following without any success: zz <-

Re: [R] Printing a list of simultaneous equations

2019-01-18 Thread Sorkin, John
(Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) From: S Ellison Sent: Friday, January 18, 2019 9:52 AM To: Sorkin, John; r-help@r-project.org Subject: RE: Printing a list of simultaneous equations You can drop the quote

[R] Printing a list of simultaneous equations

2019-01-18 Thread Sorkin, John
I am trying to print a list of equations in an easily readable form. At this time all I can get is a series of characters enclosed in quotation marks rather than equations with numbers and equal signs. What I get is y equalsigns x z eq1 "0.5" "=""1" "2" eq2 "4" "="

Re: [R] For Loop

2018-09-23 Thread Sorkin, John
At the risk of asking something fundamental . . . . does log(c1[-1]/c1[-len] do the following (1) use all elements of c and perform the calculation (2) delete the first element of c and perform the calculation, (2) delete the first two elements of c and perform the calculation, . . . (n)

Re: [R] sink() output to another directory

2018-09-14 Thread Sorkin, John
As has been pointed out, the correct way to direct printing to a given location is using sink( . . . put path here . . . ) then print() and then sink() without any argument to turn off print direction. A helpful addition to this strategy is to use the file.path function to define a variable

[R] Poisson regression with GEE using stepwise selection of independent variables.

2018-05-22 Thread Sorkin, John
Is there any way to perform stepwise Poisson regression with GEE in R? (I know, and agree that stepwise procedures are not best statistical practice. I have developed a model with 10 independent variables, my client want me to include 50 other independent variables. I, of course, don't what to

Re: [R] How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

2018-03-22 Thread Sorkin, John
(Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) From: Michael Dewey <li...@dewey.myzen.co.uk> Sent: Thursday, March 22, 2018 10:30 AM To: Sorkin, John; RHELP <r-h...@stat.math.ethz.ch> Subject: Re: [R] How

[R] How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

2018-03-22 Thread Sorkin, John
Windows 10 64-bit, R-Studio, R version 3.4.3 Several questions relating to groupedData: (1) I am trying to create a groupedData object that can be used to run an analysis that I have been able to urn using lmer. When I include the interaction terms in the groupedData opbject I get an error

[R] Mean of a row of a data frame

2018-03-20 Thread Sorkin, John
I am trying to get the mean of a row of a data frame. My code follows: roop <- data.frame(x=c(1,2,3),y=c(4,5,2),z=c(0,9,4)) roop mean(roop[1,]) mean(roop[1,c("x","y","z")]) I get the following output: > roop x y z 1 1 4 0 2 2 5 9 3 3 2 4 > mean(roop[1,]) [1] NA Warning message: In

[R] problem with rJAVA

2018-03-20 Thread Sorkin, John
I have installed rJava into my Windows 10 (64-bit) R instillation using the Tools > Install Packages command of my RStudion IDE. When I issued the R command in my R code library(rJava) I received the following error: library(rJava) Error: package or namespace load failed for �rJava� in

Re: [R] Changeing logarithms

2017-11-19 Thread Sorkin, John
I am not certain what question you are asking. Perhaps the following will help: log(x) give the natural logarithm of x log10(x) gives the common (base 10) logarithm of x. John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland

Re: [R] Syntax for fit.contrast (from package gmodels)

2017-10-22 Thread Sorkin, John
10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call phone number above prior to faxing) From: David Winsemius <dwinsem...@comcast.net> Sent: Sunday, October 22, 2017 8:15 PM To: Sorkin, John

Re: [R] Syntax for fit.contrast (from package gmodels)

2017-10-22 Thread Sorkin, John
, October 22, 2017 7:56 PM To: Sorkin, John Cc: r-help@r-project.org Subject: Re: [R] Syntax for fit.contrast (from package gmodels) > On Oct 22, 2017, at 3:56 PM, Sorkin, John <jsor...@som.umaryland.edu> wrote: > > David, > Thank you for responding to my post. > > Please consi

Re: [R] Syntax for fit.contrast (from package gmodels)

2017-10-22 Thread Sorkin, John
ing) ____ From: David Winsemius <dwinsem...@comcast.net> Sent: Sunday, October 22, 2017 1:20 PM To: Sorkin, John Cc: r-help@r-project.org Subject: Re: [R] Syntax for fit.contrast > On Oct 22, 2017, at 6:04 AM, Sorkin, John <jsor...@som.umaryland.edu> wrote:

[R] Syntax for fit.contrast

2017-10-22 Thread Sorkin, John
I have a model (run with glm) that has a factor, type. Type has two levels, "general" and "regional". I am trying to get estimates (and SEs) for the model with type="general" and type ="regional" using fit.contrast but I can't get the syntax of the coefficients to use in fit.contrast correct. I

[R] Piecewise continuous logistic regression with one knot

2017-06-23 Thread Sorkin, John
How can I fit a piecewise continuous logistic regression with a single free knot (i.e. the knot is not specified; the model produce an estimate of the value of the knot). Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of

[R] by can not find transpose function

2017-06-20 Thread Sorkin, John
I am trying to transpose a dataframe by its first column using the by statement using the t function. When I use the by function, I get a message, Error in FUN(X[[i]], ...) : could not find function "FUN" I don't think I have a syntax error in my by statement because the by statment works

[R] Piecewise continuous Poisson regression

2017-04-07 Thread Sorkin, John
Is there an R package that will perform a piecewise continuous Poisson regression? I want to model two linear segments that intersect at a common knot. Thank you, John John David Sorkin M.D., Ph.D. Professor of Medicine Chief, Biostatistics and Informatics University of Maryland School of