3

I have saved a vector in a .txt file so that I could plot it (something like c(0.55,....)).

I am trying to import it directly into a variable, but somehow I can't.

I played a bit with the scan() function with no success thinking that the raw() argument was the answer.

I have tried this solution Import text file as single character string

but this doesn't solve my problem.

Hope someone can help

Community
  • 1
  • 1
user1627466
  • 411
  • 5
  • 14

1 Answers1

3

if your text file has R syntax in it (c(...)) then

x <- source("myfile.txt")[["value"]] 

should work.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453