We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,878 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

R

Hi,
I'm pretty new 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

2
Contributors
1
Reply
5 Days
Discussion Span
1 Year Ago
Last Updated
2
Views
sofia85
Junior Poster in Training
52 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Maybe you should use interactive prompt to get feed back of your syntax. Even you had two different ways in your arrays, both the prompt did not accept.

This seemed to work:

> 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)
>
pyTony
pyMod
Moderator
6,301 posts since Apr 2010
Reputation Points: 879
Solved Threads: 986
Skill Endorsements: 26

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0591 seconds using 2.51MB