[R] How to stop as.integer removing dimenions

Gerrit Eichner Gerrit.Eichner at math.uni-giessen.de
Thu Feb 23 12:56:13 CET 2017


Hi, Thomas,

maybe

mode(net1) <- "integer"

does what you want?

  Hth  --  Gerrit

---------------------------------------------------------------------
Dr. Gerrit Eichner                   Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de   Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104          Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109            http://www.uni-giessen.de/eichner
---------------------------------------------------------------------

Am 23.02.2017 um 12:49 schrieb Thomas Chesney:
> I have:
>
> net1 <- array(0, dim=c(5,5))
>
> str(net1)
>  num [1:5, 1:5] 0 0 0 0 0 0 0 0 0 0 ...
>
> and what I want is:
>
> str(net1)
>  int [1:5, 1:5] 0 0 0 0 0 0 0 0 0 0 ...
>
> Neither of the following work:
>
> net1 <- as.integer(net1, drop=FALSE)
>
> net1 <- as.integer(net1, dim=c(5,5))
>
> Can someone please help?
>
> Thank you,
>
> Thomas
>
>
>
>
> This message and any attachment are intended solely for the addressee
> and may contain confidential information. If you have received this
> message in error, please send it back to me, and immediately delete it.
>
> Please do not use, copy or disclose the information contained in this
> message or in any attachment.  Any views or opinions expressed by the
> author of this email do not necessarily reflect the views of the
> University of Nottingham.
>
> This message has been checked for viruses but the contents of an
> attachment may still contain software viruses which could damage your
> computer system, you are advised to perform your own checks. Email
> communications with the University of Nottingham may be monitored as
> permitted by UK legislation.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list