-3

In R I have the following problem.

x="2017-10-03"

I want to trasform it to

x="20171003"

Is it possible?

Skills
  • 97
  • 3

1 Answers1

1

It seems like you are wanting a function similar to a replace() for strings found in many languages like Python and Java, I would use the gsub() function within R.

Here is an old answer I found that explains it nicely

I would imagine your example would look like

gsub("-","",x)