Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread William Dunlap via R-help
dump("yourObject", file=stdout()) is, IMO, a bit nicer than plain
dput(yourObject).  It makes copying and pasting even easier by putting
"yourObject <-" in front of dput()'s output so readers don't have to type
that themselves.

E.g.,
> myData <- data.frame(X=1:2, Y=c(exp(1), pi))
> dump("myData", file=stdout())
myData <-
structure(list(X = 1:2, Y = c(2.71828182845905, 3.14159265358979
)), .Names = c("X", "Y"), row.names = c(NA, -2L), class = "data.frame")
> dput(myData)
structure(list(X = 1:2, Y = c(2.71828182845905, 3.14159265358979
)), .Names = c("X", "Y"), row.names = c(NA, -2L), class = "data.frame")




Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Wed, Aug 24, 2016 at 3:12 PM, John Sorkin 
wrote:

> Jim,
> Yes, you are correct!
> Give yourself a pat on the back and a gold start
> 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
> Baltimore VA Medical 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)
> >>> Jim Lemon  08/24/16 6:05 PM >>>
> Hi John,
> I think it is "dput".
>
> Jim
>
>
> On Thu, Aug 25, 2016 at 8:00 AM, John Sorkin
>  wrote:
> >
> > There is a function that can be used to convert data structures such as
> a data frame into a different format that allows the data to be sent to the
> mailing list. The structure that is created can be used to easily
> reconstruct the data structure. Unfortunately, I don't remember the
> function that is called on the data structure. Can someone remind me?
> > 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
> > Baltimore VA Medical 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)
> >
> > Confidentiality Statement:
> > This email message, including any attachments, is for the sole use of
> the intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized use, disclosure or distribution is
> prohibited. If you are not the intended recipient, please contact the
> sender by reply email and destroy all copies of the original message.
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:16}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread John Sorkin
I am trying to run a repeated measures analysis of data in which each subject 
(identified by SS) has 3 observations at three different times (0, 3, and 6). 
There are two groups of subjects (identified by group). I want to know if the 
response differs in the two groups. I have tried to used lme. Lme tell me if 
there is a time effect, but does not tell me if there is a group effect. Once I 
get this to work I will want to know if there is a significant group*time 
effect. Can someone tell me how to get an estimate for group. Once I get that, 
I believe getting an estimate for group*time should be straight forward. The 
code I have tired to use follows.
Thank you,
John
 
> data1
   SS group time value  baseline
1   1  Cont0  6.00  6.00
2   2  Cont0  3.00  3.00
3   3  Cont0  5.00  5.00
4   4  Inte0 14.132312 14.132312
5   5  Inte0  8.868808  8.868808
6   6  Inte0 14.602672 14.602672
7   1  Cont3 10.706805  6.00
8   2  Cont3  8.469477  3.00
9   3  Cont3  9.337411  5.00
10  4  Inte3 16.941940 14.132312
11  5  Inte3 13.872662  8.868808
12  6  Inte3 20.465614 14.602672
13  1  Cont6 16.687028  6.00
14  2  Cont6 13.177752  3.00
15  3  Cont6 14.276398  5.00
16  4  Inte6 23.453808 14.132312
17  5  Inte6 18.229053  8.868808
18  6  Inte6 25.334664 14.602672
> # Create a grouped data object. SS identifies each subject
> # group indentifies group, intervention or control.
> GD<- groupedData(value~time|SS/group,data=data1,FUN=mean)
> # Fit the model.
> fit1 <- lme(GD)
> cat("The results give information about time, but does not say if the gruops 
> are different\n")
The results give information about time, but does not say if the gruops are 
different
> summary(fit1)
Linear mixed-effects model fit by REML
 Data: GD 
   AIC  BIClogLik
  81.38094 88.33424 -31.69047

Random effects:
 Formula: ~time | SS
 Structure: General positive-definite
StdDev  Corr  
(Intercept) 3.371776404 (Intr)
time0.009246535 1 

 Formula: ~time | group %in% SS
 Structure: General positive-definite
StdDev Corr  
(Intercept) 3.34070367 (Intr)
time0.00915754 1 
Residual0.61279061   

Fixed effects: value ~ time 
   Value Std.Error DF   t-value p-value
(Intercept) 8.512446 1.9511580 11  4.362766  0.0011
time1.654303 0.0592047 11 27.942107  0.
 Correlation: 
 (Intr)
time -0.001

Standardized Within-Group Residuals:
   Min Q1Med Q3Max 
-1.9691671 -0.4876710  0.1559464  0.4637269  1.6069444 

Number of Observations: 18
Number of Groups: 
   SS group %in% SS 
6 6 

 
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 (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 

Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized use, disclosure or distribution is prohibited. If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread Jim Lemon
Hi John,
I think it is "dput".

Jim


On Thu, Aug 25, 2016 at 8:00 AM, John Sorkin
 wrote:
>
> There is a function that can be used to convert data structures such as a 
> data frame into a different format that allows the data to be sent to the 
> mailing list. The structure that is created can be used to easily reconstruct 
> the data structure. Unfortunately, I don't remember the function that is 
> called on the data structure. Can someone remind me?
> 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
> Baltimore VA Medical 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)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:12}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread David Winsemius

> On Aug 24, 2016, at 3:00 PM, John Sorkin  wrote:
> 
> 
> There is a function that can be used to convert data structures such as a 
> data frame into a different format that allows the data to be sent to the 
> mailing list. The structure that is created can be used to easily reconstruct 
> the data structure. Unfortunately, I don't remember the function that is 
> called on the data structure. Can someone remind me?

ITYM dput()

-- 
David

> Thank you
> John
> John David Sorkin M.D., Ph.D.
> 


David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread Bert Gunter
?dput


Cheers,
Bert
Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Aug 24, 2016 at 3:00 PM, John Sorkin
 wrote:
>
> There is a function that can be used to convert data structures such as a 
> data frame into a different format that allows the data to be sent to the 
> mailing list. The structure that is created can be used to easily reconstruct 
> the data structure. Unfortunately, I don't remember the function that is 
> called on the data structure. Can someone remind me?
> 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
> Baltimore VA Medical 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)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:12}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] function that converts data into a form that can be included in a question to mailing list

2016-08-24 Thread John Sorkin
Jim,
Yes, you are correct!
Give yourself a pat on the back and a gold start
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
Baltimore VA Medical 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) 
>>> Jim Lemon  08/24/16 6:05 PM >>>
Hi John,
I think it is "dput".

Jim


On Thu, Aug 25, 2016 at 8:00 AM, John Sorkin
 wrote:
>
> There is a function that can be used to convert data structures such as a 
> data frame into a different format that allows the data to be sent to the 
> mailing list. The structure that is created can be used to easily reconstruct 
> the data structure. Unfortunately, I don't remember the function that is 
> called on the data structure. Can someone remind me?
> 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
> Baltimore VA Medical 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)
>
> Confidentiality Statement:
> This email message, including any attachments, is for the sole use of the 
> intended recipient(s) and may contain confidential and privileged 
> information. Any unauthorized use, disclosure or distribution is prohibited. 
> If you are not the intended recipient, please contact the sender by reply 
> email and destroy all copies of the original message.
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized use, disclosure or distribution is prohibited. If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.