Hi @o.b.o,
Try this workflow to see if it fixes your problem. I assume you are using RStudio under Windows?
Open a new, empty script (code) file (via the RStudio menu or using the keyboard shortcut CTRL-SHIFT-N).
Type (or paste) some simple R commands.
Click "Save" (CTRL-s), and in the dialogue box type a suitable filename e.g. my_test_script.R
(note the use of the .R file extension (can also be .r) -- this makes sure that Windows knows to open this file with RStudio.
Close your script file.
Try re-opening it from the RStudio file menu.
Saving a script (code) file is different from saving the output from a plot(), which does have the option to save as .pdf
HTH