[R] dput(treat)

roslinazairimah zakaria roslinaump at gmail.com
Thu Oct 12 06:26:37 CEST 2017


Hi,

If you have a data, run dput(data), then in the console you will see the
output.  Copy the output and place it in your email.

HTH.

On Wed, Oct 11, 2017 at 6:59 PM, Ted Beginner (RStudio) via R-help <
r-help at r-project.org> 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
> 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 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"
> ))
>
>         [[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.




-- 
*Roslinazairimah Zakaria*
*Tel: +609-5492370; Fax. No.+609-5492766*

*Email: roslinazairimah at ump.edu.my <roslinazairimah at ump.edu.my>;
roslinaump at gmail.com <roslinaump at gmail.com>*
Faculty of Industrial Sciences & Technology
University Malaysia Pahang
Lebuhraya Tun Razak, 26300 Gambang, Pahang, Malaysia

	[[alternative HTML version deleted]]



More information about the R-help mailing list