[R] Problem in executing R-script

Berend Hasselman bhh at xs4all.nl
Mon May 7 20:17:28 CEST 2012


On 07-05-2012, at 19:41, Suhaila Haji Mohd Hussin wrote:

> 
> Hello. I'm a newbie here.
> In my script (I name it readData.R), I wrote the followings:
> readData <-function(){	med = read.csv("medicalData.csv");}
> Then I tested the script by 'Source R Code' then on the command I typed 'readData()' then I typed 'med' to check if the variable contains the medical data but it returned 'Object med is not found'. What did I do wrong? Please help.

Have a look at section 10.5 "Assignment within functions" of the "An Introduction to R " manual.

Berend



More information about the R-help mailing list