[R] frequency of labels in a barplot

2008-08-10 Thread R_Learner
I'm trying to control the number of labels in the x-axis of my plot. My code is the following: graph1<-barplot(total_skew) axis(1,at = graph1,labels=raw_date[1:length(total_skew)], las=2) however, the length of my "total_skew" parameter is a few thousand elements, and all the labels on the x-ax

[R] Variable name in a String

2008-07-30 Thread R_Learner
Hi all, I have this string "year" and integer 2008 (both are inputs from the user), and I would like to make a variable called "year2008" that will store a vector of numbers. Does anyone know how to do this? Also, if the user later input "year" and "2008", how do I treat this as a variable;

[R] Plotting Multiple lines on one plot

2008-07-22 Thread R_Learner
Hi, I'm trying to plot multiple lines on one plot. I have a data frame raw, and i want to plot raw$date on the x-axis and raw$theta, raw$vega, raw$delta, and a few others on the y-axis, with a legend. However, I'm not sure what the scale of those data sets are, and I don't know which one will ha

Re: [R] Thanks!

2008-07-09 Thread R_Learner
Thanks! I'll use the which.min function. I've been learning R from the pdfs on the CRAN website, but I find the texts to be generally introductory, not comprehensive, and focused on one niche purpose. Can anyone suggest a good self-teach guide? Thanks again! R_Learner wrote: > &g

[R] Find the closest value in a list or matrix

2008-07-09 Thread R_Learner
I have a long list of numbers [3.4,5.4,3.67,], and I basically want to find the index of the number closest to this number that I have, let's say 5.43. How would I do this without writing a for loop (I have to do this many times for several lists)? Is there a "lookup" function in R? Thanks!

Re: [R] Exporting a Graph that has lines()

2008-07-03 Thread R_Learner
You guys are completely right...my lines were off the graph. I was also using points() in addition to lines, so it seems like it needs a pre-specified range unlike plot(). Thanks! Peter Dalgaard wrote: > > R_Learner wrote: >> I'm trying to export a graph (any form is goo

[R] Exporting a Graph that has lines()

2008-07-03 Thread R_Learner
I'm trying to export a graph (any form is good). I'm trying to export one that uses plot() then lines(). however, it seems that the jpeg format and the pdf format only takes the first line plot, and doesn't even consider the additional plots. My code is the following: output_file<-paste(f

Re: [R] Thanks!

2008-07-03 Thread R_Learner
Haha I'll definitely keep that in mind...parse does complicated things. Marc Schwartz wrote: > > on 07/03/2008 10:35 AM R_Learner wrote: >> Thanks guys! >> I think [[ seems to be the easier way, but I also spent an hour (while my >> post was pending approval) to

[R] Thanks!

2008-07-03 Thread R_Learner
Thanks guys! I think [[ seems to be the easier way, but I also spent an hour (while my post was pending approval) to find that the following also works: temp<- eval(parse(text=paste("data$column_title""))) Marc Schwartz wrote: > > on 07/02/2008 02:10 PM R_Learner w

[R] Accessing a field in a data fram

2008-07-02 Thread R_Learner
raw <- read.csv(file=filename, head=TRUE,sep=",") I've read in a csv file, and I'm looking to access a column whose name is held in a string. For example, I want to access raw$one or raw$two, but this will depending on the string. Let's say that the string is decision<-"one". How would I access