Re: [R] Stripchart: way to get different colour for each group

2009-12-01 Thread johannes rara
I was probably too vague. I meant that the group variable descirbes the group (eg. different individuals) and val1 and val2 are just two variables measured from eg. individual. mydata val1 val2 group 1 1.1 4.2 0 2 3.2 5.3 1 3 4.1 3.4 0 4 2.5 2.6 1 5 6.2 5.3

[R] Odp: Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.12.2009 04:42:31: length(unique(c(1,2,2)))==length(c(1,2,2)) I use the above test to test if all the elements in a vector are unique. But I'm wondering if there is a convenient function to do so in R library. maybe any(duplicated(c(1,2,2)))

Re: [R] Stripchart: way to get different colour for each group

2009-12-01 Thread johannes rara
It seems that it is not possible to color points that way using stripchart. I found a workaround which solved the problem: stripchart(values ~ ind, data=mydata.stack, vertical=T, at=c(1.25, 1.75), pch=15, col=white) points(rep(1.25, nrow(mydata)),

[R] R script From PHP

2009-12-01 Thread Amrit Nandan
Hi, I have created a web interface to enable analysis for users without having much to worry about the stats in the backend. In this particular case I have reached a stage where I have finally created two arrays between which I want to do an independant samples T Test. I have the arrays ready in

[R] explanation for left-side behaviour

2009-12-01 Thread Antje
Hi there, I'm pretty sure that it's written down somewhere but I cannot find it so far. The little example shows different approaches to replace a substring. Only the last one works. I think it has something to do with the fact that substr is used on the left side. Can anybody refer to an

[R] R Script From PHP

2009-12-01 Thread Amrit
Hi, I have created a web interface to enable analysis for users without having much to worry about the stats in the backend. In this particular case I have reached a stage where I have finally created two arrays between which I want to do an independant samples T Test. I have the arrays ready in

[R] Dec. 1, 2009 tip of the day

2009-12-01 Thread John Christie
RE: Compression Hi R-Users, You can deal with pretty decent size data sets in R on a relatively new computer. I have one that I have been working with that is a nearly 100MB plain text file. With storage as inexpensive as it is these days that's not really all that much data and I could

Re: [R] JMP - R ?

2009-12-01 Thread Wai-Kuan Yip
Hi Stephen, Option 2 I am not sure, but option 3 cannot be used because R is not an OLE component (Microsoft-objects). You can call JMP and the functions from C#, VB, Excel, etc. (all the Microsoft related stuff) but can't call R. You just need to make sure that the common library JMP.TLB is

Re: [R] multiple column argument in formula (MASS:lda)

2009-12-01 Thread Wai-Kuan Yip
Hello Marcos, When you use paste(.), it will return a String, and the first argument of lda(.) does not read a string as formula. lda(Grupo~paste(names(cien[,3:80]),collapse=+),data=cien) Here's what I'd do: colIndex - c(1,2,4,5,...) #what ever index of your input data set that you want to

[R] areg (stata) equivalent in R?

2009-12-01 Thread John K. Williams
hi, i am looking to reproduce a study done in stata in R, where a regression was done while absorbing a categorical variable.  i am new to R, i've i installed the design package but haven't been able to find an applicable function. thanks for any help.

[R] Distance between sets of points in transformed environmental space

2009-12-01 Thread Corrado
Dear friends, I have several sets of points in a transformed environmental space. Each set of points can be represented as a cloud in the environmental space. This space is spanned by n coordinates, corresponding to the first n PCs of 36 PCs of some environmental variables (12 monthly minimum

Re: [R] Agreement among three or more observers

2009-12-01 Thread Jim Lemon
On 12/01/2009 03:49 PM, John Sorkin wrote: R 2.9 Windows XP Is there an R function that will compute a measure of agreement(e.g. Kappa) among three or more observers? Hi John, There are several in the irr package. Jim __ R-help@r-project.org

Re: [R] areg (stata) equivalent in R?

2009-12-01 Thread Bernardo Rangel Tura
On Mon, 2009-11-30 at 22:20 -0500, John K. Williams wrote: hi, i am looking to reproduce a study done in stata in R, where a regression was done while absorbing a categorical variable. i am new to R, i've i installed the design package but haven't been able to find an applicable function.

Re: [R] Distance between sets of points in transformed environmental space

2009-12-01 Thread Charlotte Maia
Well, here's another naive post from me (hopefully better than the last one). Firstly I'm not sure computing euclidean distance is that simple. I would assume temperatures and precipitation would need to be standardised in some way. I think the notion of how far away something is, and how

Re: [R] Distance between sets of points in transformed environmental space

2009-12-01 Thread Mario Valle
silhouette coefficients? It measure for each point how similar is to its cluster other points and how dissimilar from the points of other clusters. P.N. Tam, M. Steinbach, V. Kumar, Introduction to data mining, Addison-Wesley, 2006 page 541 Hope it helps. mario

Re: [R] R script From PHP

2009-12-01 Thread Marianne Promberger
Amrit Nandan amrit.nan...@gmail.com 01-Dec-09 08:27: I have created a web interface to enable analysis for users without having much to worry about the stats in the backend. In this particular case I have reached a stage where I have finally created two arrays between which I want to do an

Re: [R] Distance between sets of points in transformed environmental space

2009-12-01 Thread Corrado
Thanks Mario! (Oppure grazie Mario?) - Can those silhouette coefficients be used for distances between sets or only for distances point to set? - Where did you get the other post you attached? It did not come up when I searched the mailing list! Best, On Tuesday 01 December 2009 10:31:47

[R] R 2.10.1 Scheduled for December 14, 2009

2009-12-01 Thread Peter Dalgaard
This is to announce that we plan to release R version 2.10.1 on Monday, December 14, 2009. Release procedures start Friday, December 4. Those directly involved should review the generic schedule at http://developer.r-project.org/release-checklist.html The source tarballs will be made available

[R] Trouble with read.table(clipboard)

2009-12-01 Thread Diogo B. Provete
Hi every one, I'm having some problems with the function read.table(clipboard). I got a spread sheet in the Excel, and than I make a command+C in the Mac, but the R returns the message that there is no object in the clipboard. What could have happened? Thanks, Diogo [[alternative HTML

[R] R with atlas in ubuntu karmic 64

2009-12-01 Thread Jose Quesada
Hi, I'm trying to install R with atlas in ubuntu karmic 64. I do a lot of matrix operations so I need performance. Doing grep sse2 /proc/cpuinfo tells me tha my CPU supports SSE2. But I don't see libatlas3gf-sse2 in the package repositories. Also, there seem to be some gotchas on how to

[R] Odp: Trouble with read.table(clipboard)

2009-12-01 Thread Petr PIKAL
Hi did you put your spreadsheet to the clipboard? I am not sure if trick with Ctrl-C followed by read.delim(clipboard) functions in Mac so maybe you will need to try some more elaborated procedure which was suggested several times here and I believe is also mentioned in Data import/export

Re: [R] kernlab's ksvm method freeze

2009-12-01 Thread Heiko Strathmann
Sorry i forget to paste it. But it should be there in another mail. Also, the suggested trick fixes the problem in with the given workspace, but still fails in another one (where the kernel matrix IS positive definite) http://www-stud.uni-due.de/~sfhestra/freeze_on_pos_def_matrix.tar.gz This is

Re: [R] R script From PHP

2009-12-01 Thread Hrishi Mittal
Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache - http://biostat.mc.vanderbilt.edu/rapache/ Good luck with your

Re: [R] Modular inverses

2009-12-01 Thread Hans W Borchers
SJ Robson-Davis sr6827 at bristol.ac.uk writes: I want to find the inverse of an integer k mod p (prime.) Is there a function that can do this for me? I know i could simply write (k^(p-2)) %% p, but i need to do this for large primes (above 100) and this gives the warning message:

Re: [R] R script From PHP

2009-12-01 Thread Romain Francois
On 12/01/2009 12:48 PM, Hrishi Mittal wrote: Hi Amrit, I believe you can you use the PHP system command to call Rscript or R CMD. I don't know much PHP but this page might be useful - http://php.net/manual/en/function.system.php. You might also want to look at rapache -

Re: [R] Excel-Export

2009-12-01 Thread Erich Neuwirth
The rcom package allows you to access the Excel object model from within R. So you can do essentially you can either do manually or by VBA from within Excel also from R. Formatting cells should not be too hard. Hans-Peter Suter wrote: 2009/11/24 Kevin Wright kw.s...@gmail.com: If had done a

[R] assigning values to parameters, based on different names

2009-12-01 Thread Jannis
Dear R help community, I have tumbleled across some problem quite often and could not find a solution for it (or was not able to google the right terms). I am wondering whether there is a way to tell R to assign a value of parameter X to parameter B while the actual name of parameter X is

Re: [R] assigning values to parameters, based on different names

2009-12-01 Thread Karl Ove Hufthammer
On Tue, 01 Dec 2009 12:45:18 + Jannis bt_jan...@yahoo.de wrote: I am wondering whether there is a way to tell R to assign a value of parameter X to parameter B while the actual name of parameter X is given by parameter C. Like this: Yes. See ?get. -- Karl Ove Hufthammer

Re: [R] Odp: Trouble with read.table(clipboard)

2009-12-01 Thread David Winsemius
On the Mac, reading from the the clipboard is: pipe(pbpaste) ... and writing to the clipboard: pipe(pbcopy, w) ?pipe -- David On Dec 1, 2009, at 6:43 AM, Petr PIKAL wrote: Hi did you put your spreadsheet to the clipboard? I am not sure if trick with Ctrl-C followed by read.delim(clipboard)

[R] Using two (...) in a function

2009-12-01 Thread Márcio Resende
Hello R-Helpers, I am not sure if it is a very simple question but I would like to use two (...) in a function, for example, this is a script where I would like to input the variable names (in one of the (...)) and the variances associated to those variables which are not calculated in the

Re: [R] Using two (...) in a function

2009-12-01 Thread Benilton Carvalho
isn't it simpler just to pass two vectors, say v1 and v2, in which one contains the object names and the other has the associated variances? (btw, data isn't a good function name) myData - function(v1, v2){ Vec - matrix(v1) varF - v2 } I may have misunderstood your question, but IMHO all

[R] How to plot log-log figure using R?

2009-12-01 Thread Zhijiang Wang
-- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __

Re: [R] Using two (...) in a function

2009-12-01 Thread David Winsemius
Seems pretty doubtful that a construction like (..., ...) is going to be accepted by the R interpreter. However, if you construct your function to handle two objects of equal length, one for the variable names and the other for their variances, there should be no problem. If yu want to

Re: [R] How to plot log-log figure using R?

2009-12-01 Thread David Winsemius
?plot.default On Dec 1, 2009, at 8:39 AM, Zhijiang Wang wrote: snipped David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Loop doesn't work

2009-12-01 Thread Trafim
Hi everybody, I have the following problem, the following code seems to run only once for i and j and for k from one to M. Doesn't R for increase the argument by itself? for (i in 1:N){ for (j in 1:(Tk-1)){ if((XGrid[i] Xk[j+1])(Xk[j] = XGrid[i])){ for (k in 1:M){ if

Re: [R] Calculation of Central Moments

2009-12-01 Thread Ravi Varadhan
You should learn to use search facilities in R, for example: RSiteSearch(central moments) Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins

Re: [R] Calculation of Central Moments

2009-12-01 Thread Jorge Ivan Velez
Hi Maithili, Here is a suugestion: R install.packages('fBasics') R require(fBasics) R set.seed(123) R x - rnorm(100) R basicStats(x) HTH, Jorge On Tue, Dec 1, 2009 at 2:08 AM, Maithili Shiva wrote: Dear R helpers If for a given data, I need to calculate Mean, Standard Deviation, Mode,

Re: [R] Using two (...) in a function

2009-12-01 Thread Gabor Grothendieck
Just pass a named vector f - function(vars) { nms - names(vec); ... } f(c(DAP = var1, ALT = var2)) 2009/12/1 Márcio Resende mresende...@yahoo.com.br Hello R-Helpers, I am not sure if it is a very simple question but I would like to use two (...) in a function, for example, this is a

Re: [R] rpart: how to assign observations to nodes in regression trees

2009-12-01 Thread Terry Therneau
help('rpart.object') will give you information on the return value from rpart. I think you want the 'where' portion. For new data help('predict.rpart') gives the predicted results. Terry T -- Hi, I am building a regression tree (method=anova) by using

[R] Starting estimates for nls Exponential Fit

2009-12-01 Thread Anto
Hello everyone, I have come across a bit of an odd problem: I am currently analysing data PCR reaction data of which part is behaving exponential. I would like to fit the exponential part to the following: y0 + alpha * E^t In which Y0 is the groundphase, alpha a fluorescence factor, E the

[R] Adding and Multiplying two Unevaluated Expressions

2009-12-01 Thread Benjamin Müller
HI, As I'm trying to compute Taylor series, I'm having problems in adding and multiplying unevaluated expressions. I searched for a solution but found none. my Taylor function works fine for evaluating functions as you can see here: rTaylorVal=function(exp,x0,dx,n) { ls=list(x=x0)

Re: [R] Loop doesn't work

2009-12-01 Thread Barry Rowlingson
On Tue, Dec 1, 2009 at 2:01 PM, Trafim rdapam...@gmail.com wrote: Hi everybody, I have the following problem, the following code seems to run only once for i and j and for k from one to M. Doesn't R for increase the argument by itself? for (i in 1:N){  for (j in 1:(Tk-1)){  if((XGrid[i]

Re: [R] Loop doesn't work

2009-12-01 Thread Trafim
Thanks a lot! I was afraid smth is wrong with my R syntaxis. On Tue, Dec 1, 2009 at 3:58 PM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Tue, Dec 1, 2009 at 2:01 PM, Trafim rdapam...@gmail.com wrote: Hi everybody, I have the following problem, the following code seems to run

Re: [R] Calculation of Central Moments

2009-12-01 Thread William Revelle
At 9:09 AM -0500 12/1/09, Jorge Ivan Velez wrote: Hi Maithili, Here is a suugestion: R install.packages('fBasics') R require(fBasics) R set.seed(123) R x - rnorm(100) R basicStats(x) HTH, Jorge or, try the describe function in psych. However, neither fBasics nor describe will report the

Re: [R] subset or condition as argument to a function

2009-12-01 Thread Santosh
Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and detached, which I found cumbersome to use if using more than 1 dataframe (with different dimensions) with

[R] median for time data

2009-12-01 Thread uvilla
Hi everybody How do I do to calculate the median and average of a colum of time data like this: 8:50:10. I also need to plot the time difference between two colums Thanks a lot -- View this message in context: http://n4.nabble.com/median-for-time-data-tp932287p932287.html Sent from the R help

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and detached, which I found cumbersome to use if using

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a subset, the associated dataframe needs to be attached and

Re: [R] How to quit unwanted execution immediately?

2009-12-01 Thread Peng Yu
The delay that I observe is when I type ctrl+C after I str() a long list. Since str() comes from the core R installation, maybe it should be improved? R can or cannot response immediately depending on the underlying C sources. If the underlying source code is written carefully enough, there are

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 11:04 AM, David Winsemius wrote: On Dec 1, 2009, at 10:59 AM, David Winsemius wrote: On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and

Re: [R] subset or condition as argument to a function

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:59 AM, David Winsemius wrote: On Dec 1, 2009, at 10:55 AM, David Winsemius wrote: On Dec 1, 2009, at 10:38 AM, Santosh wrote: Dear R gurus.. I had tried out some suggestions sent to me privately..and unfortunately, they did not work.. To use a condiition in a

[R] Package is loaded but functions are not exported

2009-12-01 Thread Saptarshi Guha
Hello, I wrote a package, which in the NAMESPACE file exports functions like this: exportPattern(^\\rh) On R-2.8 (Linux, 64), upon loading the package I have the rh functions present. On R-2.10, Mac OS X, (32 bit), it builds, loads, but the functions are not loaded, i.e the only function is

Re: [R] Package is loaded but functions are not exported

2009-12-01 Thread Saptarshi Guha
As a followup, i can do things Package:::rh*, there just no exported. On Tue, Dec 1, 2009 at 11:18 AM, Saptarshi Guha saptarshi.g...@gmail.com wrote: Hello, I wrote a package, which in the NAMESPACE file exports functions like this: exportPattern(^\\rh) On R-2.8 (Linux, 64), upon loading

[R] LMER: How to specify Random Effects

2009-12-01 Thread Ubuntu Diego
I saw different specifications for Random Effects and I'm confused about the use of / and the use of (0+...|) . Let say we have a nested structure where some countries have some several plants in different states and we measure the reaction to a drug. The list of Countries = USA, France,

Re: [R] Package is loaded but functions are not exported

2009-12-01 Thread Duncan Murdoch
On 01/12/2009 11:18 AM, Saptarshi Guha wrote: Hello, I wrote a package, which in the NAMESPACE file exports functions like this: exportPattern(^\\rh) That's a very strange pattern to be using. Why do you want those backslashes there? If you just want to export items whose names start

Re: [R] Package is loaded but functions are not exported

2009-12-01 Thread Romain Francois
You probably just want : exportPattern(^rh) What did you expect the backslash to do ? On 12/01/2009 05:18 PM, Saptarshi Guha wrote: Hello, I wrote a package, which in the NAMESPACE file exports functions like this: exportPattern(^\\rh) On R-2.8 (Linux, 64), upon loading the package I have

[R] eigenvalues of complex matrices

2009-12-01 Thread David Scherrer
Dear all, I want to compute the eigenvalues of a complex matrix for some statistics. Comparing it to its matlab/octave sibling, I don't get the same eigenvalues in R computing it from the exact same matrix. In R, I used eigen() and arpack() that give different eigenvalues. In matlab/octave I

Re: [R] Package is loaded but functions are not exported

2009-12-01 Thread Saptarshi Guha
I have no idea why I used the \\, the perils of copy and pasting from some other package or source . So, heres the thing, did R regex interpreter change? How come my export stopped working? Thank you Regards Saptarshi On Tue, Dec 1, 2009 at 11:28 AM, Romain Francois romain.franc...@dbmail.com

[R] problem with RWeka Weka_control RandomForest

2009-12-01 Thread Itziar Frades Alzueta
Dear All, I am finding trouble trying to guild a Wrapper using random forest to evaluate the subsets: I do: nombi - make_Weka_filter(weka/filters/supervised/attribute/AttributeSelection) datbin- nombi(gene ~., data=X1X2X4X5W, control =Weka_control(

Re: [R] subset or condition as argument to a function

2009-12-01 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Santosh Sent: Tuesday, December 01, 2009 7:39 AM To: r-help@r-project.org Subject: Re: [R] subset or condition as argument to a function Dear R gurus.. I had tried out some

Re: [R] problem with RWeka Weka_control RandomForest

2009-12-01 Thread Achim Zeileis
On Tue, 1 Dec 2009, Itziar Frades Alzueta wrote: Dear All, I am finding trouble trying to guild a Wrapper using random forest to evaluate the subsets: I do: nombi - make_Weka_filter(weka/filters/supervised/attribute/AttributeSelection) datbin- nombi(gene ~., data=X1X2X4X5W, control

Re: [R] median for time data

2009-12-01 Thread Jannis
Hi, try to convert this to the R time format POSIXct or POSIXlt via strptime(). Then you can simply substract them. I am not sure whether a median can be calculated though (should be possible as POSIXct stores the value as seconds since 1970) Best Jannis uvilla schrieb: Hi everybody

[R] time series - month value

2009-12-01 Thread Alfredo Alessandrini
Hi, I've this time series: ts_evi Time Series: Start = c(2000, 4) End = c(2002, 7) Frequency = 23 [1] 0.1948306 0.1930461 0.1905792 0.1848909 0.1893624 0.1811400 0.1678140 [8] 0.1750714 0.3100132 0.3495946 0.4103353 0.4973740 0.4937490 0.4031435 [15] 0.3503787 0.2755022 0.2304617 0.2284854

[R] Error message when logical indexing vecor is all FALSE

2009-12-01 Thread Jannis
Dears, is there any way to switch off or work around the error message that pops up when I do something like: A-B['logical vector'] and when 'logical vector' only consists of FALSE values? My problem is that this message always kicks me out of my loops and always testing via an if clause

Re: [R] Error message when logical indexing vecor is all FALSE

2009-12-01 Thread jim holtman
?try On Tue, Dec 1, 2009 at 12:22 PM, Jannis bt_jan...@yahoo.de wrote: Dears, is there any way to switch off or work around the error message that pops up when I do something like: A-B['logical vector'] and when 'logical vector' only consists of FALSE values? My problem is that this

Re: [R] subset or condition as argument to a function

2009-12-01 Thread baptiste auguie
Hi, an alternative to parse() is to use quote and bquote, set.seed(123) d = data.frame(a=letters[1:5], b=1:10, c=sample(0:1, 10, repl=TRUE)) cond1 - quote(a==b) cond2 - quote(b 6) cond3 - bquote(.(cond1) .(cond2)) subset(d, eval(cond1)) subset(d, eval(cond2)) subset(d, eval(cond3)) HTH,

Re: [R] Starting estimates for nls Exponential Fit

2009-12-01 Thread Katharine Mullen
If you could reformulate your model as alpha * (y0 + E^t) then you could use nls with alg=plinear (alpha then would be eliminated from the nonlinear param and treated as conditionally linear) and this would help with convergence. Else you can try package DEoptim to get the starting values; the

Re: [R] eigenvalues of complex matrices

2009-12-01 Thread Ravi Varadhan
Hi, You haven't given us much information. You might actually have the same eigenvalues, but don't recognize that due to possibly different orderings. Complex numbers do not possess ordering. Therefore, there is no natural way to report complex eigenvalues. In R, the complex eigenvalues are

[R] Problem in reading data

2009-12-01 Thread Megh
In my Excel file, I have data in following format : Feb-07 38.49 Mar-07 39.95 Apr-07 37.47 May-07 35.77 Jun-07 32.96 Jul-07 33.27 I tried to copy this data as a time series using following code : library(zoo) dat - read.zoo(file=clipboard, format=%m-%y) However getting following error :

Re: [R] median for time data

2009-12-01 Thread uvilla
Thanks a lot for your answer Jannis. Actually, I should have specified what I`m trying to do. I have a datafame which 3 colums, one is the person ID, second is Anfag and third is Ende. The two time colums are in this way: 8:50:10, so I have to calculate the medan of the Anfag colum and to

Re: [R] median for time data

2009-12-01 Thread Gabor Grothendieck
# input library(chron) tt - times(c(8:50:10, 9:40:20, 10:55:45)) tt2 - times(c(01:00:00, 02:00:00, 03:00:00)) tt tt2 # calc median and differences (although it will give results as fractions of a day if there are negative results) median(tt) tt - tt2 tt2 - tt On Tue, Dec 1, 2009 at 10:46 AM,

[R] Testing the significance of gradients in trends

2009-12-01 Thread Steve Murray
Dear all, I want to determine if the slopes of the trends I have in my plot are significantly different from each other (I have 2 time-series trends). What statistical test is most suitable for this purpose and is it available in the R base package? Many thanks, Steve

Re: [R] Problem in reading data

2009-12-01 Thread Gabor Grothendieck
Specify that your input is of class yearmon (as opposed to Date class) and also correct the format specification as per the percent codes in ?strptime library(zoo) z - read.zoo(clipboard, FUN = as.yearmon, format = %b-%y) On Tue, Dec 1, 2009 at 12:55 PM, Megh megh700...@yahoo.com wrote: In

Re: [R] Learning R

2009-12-01 Thread Dr. Thomas W. MacFarland
Hi Julia: I am sure that you will find many useful resources as you attempt to learn R. If time permits, please look at the Tegrity-based video that I’ve prepared for my students: http://tegrity1.acast.nova.edu/tegrityUtils/GetCourseListing.aspx?Session_In

[R] write.csv fails with $ operator invalid for atomic

2009-12-01 Thread ggraves
I want to export a csv file so I can do other things with it. I issue this command to break down years as to whether it was windy or not: t-tapply(TURB,list(year,windy),mean,na.rm=T) which results in: t no yes 1990 21.516514 39.86400 1991 13.580435 28.87500 1992 12.171429

Re: [R] median for time data

2009-12-01 Thread Jannis v. Buttlar
uvilla schrieb: When I use strptime() I just get NA NA NA I`m new at using R, must finisth this work thoug I guess Im doing totally wrong, actually everytime i try to use POSIXct it doesn`t work If you have a look at help(strptime) you find that you have to specify the format in which you

[R] Multiple grouping on the X axis.

2009-12-01 Thread Munin
I am trying to plot data with multiple logical and physical groups using R. Below is a sample of the kind of data I am working with and the desired output. We have a jmp script that can do the same thing, but at ~$200 a year the licensing is counterproductive. Thanks for any help. Data

[R] ggplot legend for multiple time series

2009-12-01 Thread Changyou Sun
Hello All, I am trying to create a legend for a black-white graph. The package I use is ggplot2. It can add colors to the legend key but not line types. Can you please help? # example from Wickman (2009, ggplot2 - elegant graphics for data analysis, page 109) library(ggplot2) huron -

[R] ggplot legend for multiple time series

2009-12-01 Thread Edwin Sun
Hello All, I am trying to create a legend for a black-white graph. The package I use is ggplot2. It can add colors to the legend key but not line types. Can you please help? # example from Wickman (2009, ggplot2 – elegant graphics for data analysis, page 109) library(ggplot2) huron -

Re: [R] LMER: How to specify Random Effects

2009-12-01 Thread Ubuntu Diego
Thanks for your feedback. Actually Plant is nested since High and Low are qualitative relative values (High in Michigan is not the same as High in Sienna). S Ellison wrote: The Plant classification is not nested; it's an effect across all countires and states and probably a fixed effct

[R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread David Winsemius
Starting with the head of a 499 element matrix whose column names are now the labels trom a cut() operation, I needed to get to a vector of midpoints to serve as the basis for plotting a calibration curve ( exp(linear predictor) vs. : dput(head(dimnames(mtcal)[2][[1]])) # was starting

Re: [R] Remark on tapply().

2009-12-01 Thread Rolf Turner
On 1/12/2009, at 8:32 PM, Karl Ove Hufthammer wrote: SNIP Exercise to the reader: Note that sapply(split(x, ff, drop=TRUE), sum) gives you the values of (just) the non-empty levels. Now, why does sapply(split(x, ff), sum, drop=TRUE) give the wrong value (1) for these levels, while

[R] An R vs. SAS Discrepancy: How do I determine which is correct?

2009-12-01 Thread Kevin E. Thorpe
I was messing around with some data in R and SAS (the reason is unimportant) fitting a multiple linear regression and got a curious discrepancy. The data set is too big to post, but if someone wants it, I can send it. So, here are the (partial) results: From R: Coefficients:

Re: [R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread Gabor Grothendieck
You also might want to look at demo(gsubfn-cut) On Tue, Dec 1, 2009 at 2:41 PM, David Winsemius dwinsem...@comcast.netwrote: Starting with the head of a 499 element matrix whose column names are now the labels trom a cut() operation, I needed to get to a vector of midpoints to serve as the

Re: [R] ggplot legend for multiple time series

2009-12-01 Thread baptiste auguie
Hi, I don't understand why you used scale_manual_colour if you want only black lines. To have different line types in the legend you can map the linetype to the data, huron - data.frame(year=1875:1972, level=LakeHuron) ggplot(huron, aes(year)) + geom_line(aes(y=level+5, linetype=above)) +

Re: [R] An R vs. SAS Discrepancy: How do I determine which is correct?

2009-12-01 Thread Kevin E. Thorpe
Thanks to an insightful comment from Jeremy Miles, who politely pointed out my thick-headed moment, I know what happened. The sex variable was coded as 1/2 in the SAS data, but was a factor in the R data and so became a properly coded dummy variable. Sorry for the obvious question and answer.

Re: [R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread Henrique Dallazuanna
Perhaps this shoul work too: sapply(strsplit(gsub(^\\W|\\W$, , testvec), ,), function(x)sum(as.numeric(x))/2) On Tue, Dec 1, 2009 at 5:41 PM, David Winsemius dwinsem...@comcast.net wrote: Starting with the head of a 499 element matrix whose column names are now the labels trom a cut()

Re: [R] ggplot legend for multiple time series

2009-12-01 Thread Edwin Sun
Hello - Thank you so much for the help. It works perfectly. I guess that as many have pointed out, ggplot is a great package but there is a lack of documentation and examples. Edwin Sun baptiste auguie-5 wrote: Hi, I don't understand why you used scale_manual_colour if you want only

Re: [R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread David Winsemius
I'm sitting here chuckling. Your solution is just so pure. I would offer an enhancement. When I tested with my cuts that had - before the digits, you solution dropped them, so my suggestion for the pattern would be: [-[:digit:].]+ I will admit that I thought it might fail with positive

Re: [R] median for time data

2009-12-01 Thread uvilla
Thanks you both Jannis now it is working!!. I just have one mor request, please! How I'm suppose to make a boxplot with anfang, when working with times, it just have on the y axis some decimal number which make no sense. i need the time to appear in the y axis in order to see the median in the

Re: [R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread Gabor Grothendieck
Try this: library(gsubfn) strapply(testvec, [-+.0-9]+, as.numeric, simplify = ~ colMeans(cbind(...))) [1] -5.8500 -2.9800 -2.8160 -2.7120 -2.6325 -2.5680 On Tue, Dec 1, 2009 at 3:14 PM, David Winsemius dwinsem...@comcast.netwrote: I'm sitting here chuckling. Your solution is just so pure.

Re: [R] ggplot legend for multiple time series

2009-12-01 Thread hadley wickham
Because of the combinatorial nature of ggplot2, it is simply not possible to provide an example that illustrates every single combination of options. There are already over 600 example graphics in the package - if you can't find one that exactly meets your need, you need to buy the book and learn

Re: [R] Cut intervals (character) to numeric midpoint; regex problem

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 3:28 PM, Gabor Grothendieck wrote: Try this: library(gsubfn) strapply(testvec, [-+.0-9]+, as.numeric, simplify = ~ colMeans(cbind(...))) [1] -5.8500 -2.9800 -2.8160 -2.7120 -2.6325 -2.5680 Very, nice. Also tried on some other valid (200,2) and invalid )2..2)

[R] How to compute contrast where there are interaction terms in the linear model?

2009-12-01 Thread Peng Yu
Could somebody recommend some textbook how to compute contrast when there are interactions terms? Applied Linear Regression Models (book) mentioned contrast, but I cannot extend it to the case where there are interaction terms. __ R-help@r-project.org

[R] Canberra distance

2009-12-01 Thread Hongbo Zhu
Hi, I am using R 2.9.0. It seems the documentation for the calculation of Canberra distance using stats::dist is ambiguous. Does anyone have the original definition given in the Lance Williams paper from Aust. Comput. J. 1, 15-20, 1967? When there are zeros at certain position in both vectors,

Re: [R] How to compute contrast where there are interaction terms in the linear model?

2009-12-01 Thread Charles C. Berry
On Tue, 1 Dec 2009, Peng Yu wrote: Could somebody recommend some textbook how to compute contrast when there are interactions terms? Applied Linear Regression Models (book) mentioned contrast, but I cannot extend it to the case where there are interaction terms. Textbook? Schmextbook! You

Re: [R] write.csv fails with $ operator invalid for atomic

2009-12-01 Thread John Kane
Where does the table come from? write.csv(t, file = t.csv) looks like it would work --- On Tue, 12/1/09, ggraves ggwra...@sfwmd.gov wrote: From: ggraves ggra...@sfwmd.gov Subject: [R] write.csv fails with $ operator invalid for atomic To: r-help@r-project.org Received: Tuesday, December

Re: [R] write.csv fails with $ operator invalid for atomic

2009-12-01 Thread ggraves
It was in some documentation along with using data.frame and other entries that didn't work. Can't explain why I didn't try it as is. Gregory A. Graves Lead Scientist REstoration COoordination and VERification (RECOVER) Restoration Sciences Department South Florida Water Management District

[R] coding negative effects in categorical dummy variables

2009-12-01 Thread andre74
Hello, I have a problem with categorical variables and dummy encoding. I've a factor and for each pair (i,j) with i != j, I'd like to fit res ~ a*x[i] - b*x[j]. A brief example with 3 variables: a - b = 2 b - c = -1 c - a = 0 Thus I fitted the following model: fit - lm(result ~ X + Y)

[R] Normal tests disagree?

2009-12-01 Thread rkevinburton
If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you.

  1   2   >