Zoo or TS
What is NYT? Is it a dataframe? Is "Title" a column? What exactly are you wanting to plot? Is it just the values in column "B" where "Title" is equal to "A"? The posting guide does suggest that you provide a reproducible set of code/data. You can probably do what you want if you can explain what you are after. You are getting the error because the 'if' function expects a single TRUE/FALSE value and your use of '==' if probably returning multiple values, but since we don't know what NYT is, it is hard to say. If you are going to include some data, please use 'dput' to create an expression that makes it easy to read in.
On Sun, Feb 22, 2009 at 1:12 PM, miya <ontiveros_paloma at yahoo.com> wrote:
Sorry, forgot to attach the error it is giving me.
if(NYT["Title"]=="A")
+ plot(NYT["B"],ylim=c(0,50),xlim=c(0,50),ylab="B",xlab="A") Warning message: In if (NYT["Title"] == "A") plot(NYT["B"], : the condition has length > 1 and only the first element will be used Thank you Tony Breyal wrote:
I think you need to put quotes around the column header name, something like: NYT["Title"] example:
my.df <- data.frame(header1=1:3, header2=1:3) my.df[header2]
Error in `[.data.frame`(my.df, header2) : object "header2" not found
my.df["header2"]
header2 1 1 2 2 3 3 Hope that helps a little, Tony Breyal On 22 Feb, 04:41, miya <ontiveros_pal... at yahoo.com> wrote:
Hi everyone, I'm trying to plot some data across time. I have a list of articles, ranks, date/times, authors, etc. Someone suggested using zoo and someone suggested using ts. I'm pretty new at this and have been trying a simple if() plot() statement, but it doesn't seem to work. I keep getting an error that Title does not exist. Basically its saying that the headers do not exist as objects. Can anyone please help. Below is what I've been trying to do and a sample of the data I am working with. Thanks in advance. Time Date Rank Topic Title Author 0 xxxx 1 A J By PAUL 0 xxxx 2 B K By PERRI 0 xxxx 3 C L By WILL 0 xxxx 4 D M By ANA 1 xxxx 1 A J By PAUL 1 xxxx 2 B L By WILL 1 xxxx 3 C M By ANA 1 xxxx 4 D K By PERRI if(NYT[Title]=="For Catholics, a Door to Absolution Is Reopened") plot(NYT[Rank]) Error in `[.data.frame`(NYT, Title) : object "Title" not found -- View this message in context:http://www.nabble.com/Zoo-or-TS-tp22143632p22143632.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
______________________________________________ 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.
-- View this message in context: http://www.nabble.com/Zoo-or-TS-tp22143632p22149702.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ 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.
Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?