pedro
pedro

Reputation: 463

How to remove an 'underscore' sign from a filename?

I have :

paste("~/coefficient_rho",Sys.Date(), sep="_","/correlation.RData")

which gives

[1] "~/coefficient_rho_2019-04-30_/correlation.RData" 

What I want to get is

[1] "~/coefficient_rho_2019-04-30/correlation.RData"

Any suggestion?

Upvotes: 1

Views: 213

Answers (2)

Haezer
Haezer

Reputation: 476

You could juste write the first tabulation in the string "~/coefficient_rho_" and use paste0 to paste the rest of you path without separator.

paste0("~/coefficient_rho_", Sys.Date(), "/correlation.RData")

Upvotes: 3

symbolrush
symbolrush

Reputation: 7467

You can use a combination of paste / paste0 to get what you want:

paste0(paste("~/coefficient_rho",Sys.Date(), sep="_"),"/correlation.RData")
[1] "~/coefficient_rho_2019-04-30/correlation.RData"

Upvotes: 2

Related Questions