Tom,

If your text file, 'sp.txt' contains the headers used on that web page,
then your read.table() function call is incorrect.

Your call below presently has 'header = 0'. Use TRUE/FALSE for easier
reading of code. The tutorial seems to be inconsistent with that.

If your text file contains the 'Date' and 'SP500' column headers, then
your SP500 data column is going to be read in as a character variable,
as R will see the first entry of 'SP500' as a character value, not as a
column header. 

This column in turn, will be coerced to a factor, resulting in the
errors you are seeing, as plot.factor() will be used.

You should be using:

d <- read.table("c:/test/sp.txt", header = TRUE)

Use:

  str(d)

to review the current structure of your data frame. That should give you
some hints.

HTH,

Marc Schwartz


On Mon, 2006-10-16 at 10:54 -0500, tom soyer wrote:
> Hi David and Duncan,
> 
> Thanks for the reply. I am using R-2.4.0 for windows. All I am trying to do
> is follow an online tutorial (
> http://www.onlamp.com/pub/a/onlamp/2005/11/17/r_for_statistics.html) step by
> step. spval is just an array of numbers. I also tried using type="1" instead
> of "l", but got same warning message and the same bar graph. Are there any
> packages that I should have installed? I haven't installed any contributed
> package, only the base distribution.
> 
> Thanks,
> 
> Tom
> 
> 
> On 10/16/06, David Barron <[EMAIL PROTECTED]> wrote:
> >
> > It's possible the problem is with your data; could you provide some
> > sample data with which we can reproduce the error?
> >
> > On 16/10/06, tom soyer <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I am new to R and I have been trying it out. I ran into a problem with
> > the
> > > plot() function. Below is my code:
> > >
> > >  > d <- read.table("c:/test/sp.txt",header=0)
> > > > spval <- d[,2]
> > > > plot(spval,type="l")
> > > Warning messages:
> > > 1: graphical parameter "type" is obsolete in: plot.window(xlim, ylim,
> > log,
> > > asp, ...)
> > > 2: graphical parameter "type" is obsolete in: axis(side, at, labels,
> > tick,
> > > line, pos, outer, font, lty, lwd,
> > > 3: graphical parameter "type" is obsolete in: title(main, sub, xlab,
> > ylab,
> > > line, outer, ...)
> > > 4: graphical parameter "type" is obsolete in: axis(side, at, labels,
> > tick,
> > > line, pos, outer, font, lty, lwd,
> > >
> > > I tried to plot a line graph from a text file with two columns. Some how
> > R
> > > won't plot the data as lines, and it kept giving me the same warning:
> > "type"
> > > is obsolete. What does this mean? Am I doing something wrong, or is the
> > > parameter really obsolete, or do I need install some package?
> > >
> > > Thanks,
> > >
> > > Tom
> > >

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to