0

I am trying to input a dataset into R using read_delim. I want to input 2 columns as character strings, and i've defined col_type to be character but the resulting data frame still has the values in scientific notation even though the data type says its character. I used cols() to be able to specify the format of the date. Is there any way to ensure that the numbers for SampleID and SamplePointID doesn't change to scientific notation?

read_delim call

col_types defined, SampleID and SamplePointID defined as col_character()

Resulting data frame filtered for values showing up in scientific notation

  • Welcome to SO! In general it is best to not post pictures of code as it is hard for others to reproduce. [Here](https://stackoverflow.com/a/5963610/12400385) are some tips on how to ask a question in a reproducible way. – nniloc Jul 22 '20 at 17:22

1 Answers1

0

You can use str(haa) to examine the column types of your data after you have read it in.

It is possible there is no issue other than how it is being displayed. If you want to turn off the display of scientific notation, run

options(scipen=999)
nniloc
  • 4,128
  • 2
  • 11
  • 22
  • The type is in fact character but it is still putting the values in scientific notation before making it a chracter string. I tried using col_integer which retains all the rows of the dataset but gets rid of any alphabet characters in the other ids. – Sabah P Jul 22 '20 at 20:27
  • Did you try running `options(scipen=999)` first? It would be helpful if you posted a couple examples of the raw `SampleID` which are being read in incorrectly. – nniloc Jul 22 '20 at 22:23