Toros91
Toros91

Reputation: 303

Remove the leading brackets when used print in r

I' want to print the Sys.time() in r with no leading brackets.

For Example:

print(sprintf("Triggered at: %s", Sys.time()),quote = FALSE)

Output:

[1] Triggered at: 2018-04-30 10:51:12

But I want the outcome as

Triggered at: 2018-04-30 10:51:12

I've tried using cat for this but it was no use,

cat(Sys.time())

Output

1525058622

Upvotes: 4

Views: 521

Answers (1)

Maurits Evers
Maurits Evers

Reputation: 50678

You were almost there. Try

cat(sprintf("Triggered at: %s\n", Sys.time()))
#Triggered at: 2018-04-30 13:27:50

Upvotes: 5

Related Questions