Problem in executing R-script
R is a functional language so, by default, assignments (and other
things) within function scope doesn't have global effects. This is
generally considered a _very good thing_ in language design. You'd
perhaps prefer something like:
readData <- function() {
read.csv("medialData.csv")
}
med <- readData()
which will have the desired outcome.
On Mon, May 7, 2012 at 1:41 PM, Suhaila Haji Mohd Hussin
<bell_beauty12 at hotmail.com> 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.
Cheers,Suhaila
? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.