[R] dput(treat)

Michael Dewey lists at dewey.myzen.co.uk
Wed Oct 11 13:10:21 CEST 2017


Dear Ted

Comments in line

On 11/10/2017 11:59, Ted Beginner (RStudio) via R-help wrote:
> 
> I got advice here that I didn't understand! Can I ask to explain me the meaning of this procedure: first get the structure, and then assign it back. For what? Thanks!  (Great thanks to Moderator/Admin!)
> 
> You should learn to post in plain text and use dput to present your data structures. At your console do this

So this is what you do to display your data-frame in a plain text way.

> dput(treat)
> # and this will appear. Copy it to your plain-text message:
> structure(list(ID = 1:5, start = c(0L, 0L, 0L, 0L, 0L), stop = c(66L,
> 18L, 43L, 47L, 26L), censor = c(0L, 0L, 1L, 1L, 0L), sex = c(2L,
> 1L, 2L, 2L, 1L), age = c(1L, 2L, 3L, 3L, 4L), stage = c(3L, 4L,
> 3L, NA, 3L), treatment = c(1L, 2L, 1L, 2L, NA)), .Names = c("ID",
> "start", "stop", "censor", "sex", "age", "stage", "treatment"
> ), class = "data.frame", row.names = c("1", "2", "3", "4", "5"
> )):

Then this is what we, the readers, do to read in your data-frame so we 
are sure we have exactly the same as you had.

> Then we can just do this:
>   treat <- structure(list(ID = 1:5, start = c(0L, 0L, 0L, 0L, 0L), stop = c(66L,
> 18L, 43L, 47L, 26L), censor = c(0L, 0L, 1L, 1L, 0L), sex = c(2L,
> 1L, 2L, 2L, 1L), age = c(1L, 2L, 3L, 3L, 4L), stage = c(3L, 4L,
> 3L, NA, 3L), treatment = c(1L, 2L, 1L, 2L, NA)), .Names = c("ID",
> "start", "stop", "censor", "sex", "age", "stage", "treatment"
> ), class = "data.frame", row.names = c("1", "2", "3", "4", "5"
> ))
>

If you carry on posting in HTML it is possible that your e-mails will 
get scrambled so it would be best to post in plain text. It does not 
seem to have had a bad effect this time.

> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.
> 
> ---
> This email has been checked for viruses by AVG.
> http://www.avg.com
> 

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list