[R] Add text/numbers to x axis?
Is there any simple way to add text to the x axis in R? I have tried to add simple characters in R without any greater sucess. As an example of what I want to do is the added C in the following "dumb" plot (produced with MacAnova using the option "dumb:T"): ++--+---+--+---+--+---+--+---++ 1+ : *+ | : * * | | : * * | | : * .| 0.8+ : * .+ | : .| | :*.| | : * .| 0.6+ : .+ | : * .| | * .| | : .| | * : .| 0.4+ : .+ |* : .| | *: .| | : .| 0.2+ * : .+ | * : .| | * * : .| |* * * : .| 0++--+---+--+---+--+---+--.---+---++ -2-1.5 -1-0.5 0 0.5 1 C 1.5 2 My attempts to use locator() and text() in R's plot() has not been working as good as expected. Never really knows where the added symbols end up... BTW, anyone who knows how such "dumb" plots could be achieved in R? This option is avaliable in S, so a port to R shouldn't be impossible, should it? Don't know how to do it myself however... Robert __ 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
[R] Time rather than dates?
Using strptime() and other functions for dates has been very helpful with the kind of data I often work with. However, I haven't found out how time as such should be specified. All my attempts result in time *and* date: >treatment_time<-c("01:02:03","02:03:04") # hours:minutes:seconds >time.2<-strptime(treatment_time,format="%H:%M:%S") >time.2 [1] "1900-01-01 01:02:03" "1900-01-01 02:03:04" Why the 1900-...? I had hoped for some easy conversion from time to numeric data and possibly back. Assistance would be appreciated. Robert __ 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
[R] Automate concatenation?
I have this typical problem of joining a number of vectors with similar names - a1, a2,..., a10 - which should be concatenated into one. Using c(a1,a2,a3,a4,a5,a6,a,a8,a9,a10) naturally works, but I would like to do it with less manual input. My attempts to use paste() gives a vector of the vector names, see below. The question is how to do the the concatenation? Any suggestions? paste("a",1:10,sep="") Robert __ 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
[R] Comparing two time series?
I have got pairs of time series, where one usually is shorter (n typically about 5400) than the other (n typically about 52000). I would like to calculate the ccf for these series, but I haven't found a smart way to let the shorter "slide" along the longer one in steps. Manually splitting the longer series into shorter ones of the same length as the shorter is possible, but tedious. Any suggestions, either for doing it (i e the ccf calculations for series of different lengths) in one round or for doing a split of a long series into shorter pieces? (I know I have seen a description of the later in the documentation, but now I can't find where it was...) Robert __ 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
[R] How does ccf() really work?
I can't understand the results from cross-correlation function ccf() even though it should be simple. Here's my short example: * a<-rnorm(5);b<-rnorm(5) a;b [1] 1.4429135 0.8470067 1.2263730 -1.8159190 -0.6997260 [1] -0.4227674 0.8602645 -0.6810602 -1.4858726 -0.7008563 cc<-ccf(a,b,lag.max=4,type="correlation") cc Autocorrelations of series 'X', by lag -4 -3 -2 -1 0 1 2 3 4 -0.056 -0.289 -0.232 0.199 0.618 0.568 -0.517 -0.280 -0.012 ** With lag 4 and vectors of length 5 there should as far as I can see only be 2 pairs of observations. The correlation would then be 1. Guess I am missing something really simple here. Anyone who could explain what is happening? Robert __ 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
[R] info() function?
I would like to have some function for getting an overview of the variables in a worksheet. Class, dimesions, length, number of missing values,... Guess it wouldn't be that hard to set up such a function, but I guess there are others who have made it already. Or is it already a standard feature in the base package? Any suggestions? Robert __ 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
[R] Handling outliers?
I am sitting with this fairly big material (20 variables, max length of vectors about 3200 observations and a substantial amount of missing values). In some cases there are also outliers. Some are obvious, others are not that clear. So far, I have replaced some of the outliers with NA's. However, I would like to have a good working procedure where outliers where not excluded permanently but rather temporarily. Some way of "marking" observations and still keep them seems both preferable and possible. Any suggestions for a good working practice for cases like this? How do *you* work? Is there any "standard" package to use? Robert __ 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
[R] Skip last NA's?
I wonder if anyone could help me find an expression for skipping the last missing values in a vector? The kind of material I have is something like x<-c(23,12,NA,23,24,21,NA,NA,NA) I would like to skip the last NA's, but not the ones in between other vallues. Any hints? (Why not do this by simply take x[1:6]? I have several vectors a couple of thousand observations long with varying numbers of NA's in the end. I'd prefer not to search through all of these one at a time.) Robert __ 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
[R] Add function to histogram?
Is there any neat way to add a curve (frequency function or the like) to a histogram or other plots? I haven't found one yet... Robert __ 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