Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R seems to ignore the last line of .Rprofile?

Tags:

r

It is very strange that R appears to ignore the last line of my .Rprofile.

For example, in .Rprofile

 ...
 test<-function()1 # without line ending

And thus test is never loaded although the rest is loaded successfully. If I load it manually, source(".Rprofile"), test loads fine.

Is it the desired behaviour?

Under R studio with R 3.0 + in Linux

Can any one reproduce this?

like image 408
colinfang Avatar asked Aug 27 '13 15:08

colinfang


People also ask

How do you make text go to next line in R?

The most commonly used are "\t" for TAB, "\n" for new-line, and "\\" for a (single) backslash character.

Where is my. Rprofile?

Rprofile file is found in C:\Program Files\R\R-3.4. 1\etc and can be edited by loading it into Notepad++.


1 Answers

This is a super annoying "feature" - the last line is silently ignored if it does not have a trailing newline.

like image 124
hadley Avatar answered Nov 05 '22 06:11

hadley