[R] help

Peter Alspach Peter.Alspach at plantandfood.co.nz
Tue Jan 10 23:21:45 CET 2012


Tena koe Anna

[ is for subsetting, you need c():

x <- c(10.4, 5.6, 3.1, 6.4, 21.7)
y <- c(12, 5.6, 7.2, 1.0, 9.3)
plot(x, y)

HTH ....

Peter Alspach

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Anna Olofsson
Sent: Wednesday, 11 January 2012 11:02 a.m.
To: r-help at r-project.org
Subject: [R] help

Hi,
I'm pretty new at programming and with the R language. I'm just trying to
get familiar with R and wrote a script in gedit (should I use emacs
instead?),

x <- [10.4  5.6  3.1  6.4 21.7]
y <- [12,5.6, 7.2, 1.0, 9.3]
plot(x,y)

then I went to the command window in the terminal (I'm using unix) to run
this with source("name_of_file"), but it doesn't work. Shouldn't a plot
come up automatically when I run it? What am I doing wrong? It knows what x
and y is, but I don't get an error of what might be wrong.

> source("name_of_file")
> x
[1] 10.4  5.6  3.1  6.4 21.7


Best,
Anna

______________________________________________
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.

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.



More information about the R-help mailing list