[R] Num to INT

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Apr 26 04:55:26 CEST 2016


Using Excel to prepare data can have many pitfalls that are Excel-specific and therefore off-topic here. 

Please provide a sample of your data (in CSV?) in the body of your next email along with the R code you used to import it,  and be sure to send in plain text format because HTML email frequently corrupts R code. 

Note that R data frame columns can be stored with distinct modes (e.g. numeric or integer) but the entire column MUST have the same mode. If you are still thinking like an Excel user this might take some getting used to.

You should also be aware that integers can be stored in floating point numbers just fine, though extremely large integers may not be representable in exact form either way. That is, your troubles may not actually be troubles at all, or there is a small chance that you may be asking the impossible.  That is why you have to show  us what you did and what you wanted to obtain to get effective help. 

The output of the sessionInfo function may also help clarify things here. Reading the Posting Guide mentioned below would probably also help you avoid other communication pitfalls. 
-- 
Sent from my phone. Please excuse my brevity.

On April 25, 2016 3:34:39 PM PDT, "André Luis Neves" <andrluis at ualberta.ca> wrote:
>Hi there:
>
>I transformed four columns of values in my dataset into an integer
>using
>excel, but when I imported the dataset into R, it is still reading one
>of
>the columns as NUM.
>Then, I used as.integer function to convert the remaining column into
>INT,
>but unfortunately, it is replacing the values by NAs.
>
>I was wondering if you could help me to solve this problem.
>
>Thanks,
>
>-- 
>Andre
>
>	[[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.

	[[alternative HTML version deleted]]



More information about the R-help mailing list