0

I want to output today's date without quotes and without line numbers. How do I get rid of the line number? [1] looks like row 1 of a matrix

R code:
noquote(as.character(Sys.Date()))
[1] 2019-11-21

Sys.Date() Makes the problem a little different than usual. Unless code is exactly as I am giving in the solution Sys.Date will be output with a "". I tried using a semicolon at the end of the line to prevent that from happening but was not successful.

My cursor is messed up when I use the following suggested command.

Output:
> cat(as.character(Sys.Date()))
2019-11-21> 

Thanks. MM

Mary A. Marion
  • 780
  • 1
  • 8
  • 27
  • 1
    `cat(as.character(Sys.Date()))` – d.b Nov 21 '19 at 18:28
  • 1
    That's just how R prints information into the console. It isn't attached to the data or anything, it's just a way of making the output more readable – camille Nov 21 '19 at 18:30
  • 1
    Does this answer your question? [Output in R, Avoid Writing "\[1\]"](https://stackoverflow.com/questions/9137798/output-in-r-avoid-writing-1) – camille Nov 21 '19 at 18:32
  • Sys.Date is very particular about being printed out. Thank you for your reply. MM – Mary A. Marion Nov 21 '19 at 19:29
  • cat approach messed up R > (the data input character). That is why I don't use it. >cat(as.character(Sys.Date())) 2019-11-21> cat(as.character(Sys.Date())) – Mary A. Marion Nov 21 '19 at 19:32

1 Answers1

1

I thought I had tried them all but I hadn't. I like my work to have identifying information such as name, date, etc.

writeLines function is the answer.
writeLines(noquote(as.character(Sys.Date())))

MM

Mary A. Marion
  • 780
  • 1
  • 8
  • 27