Re: [R] metaMDS NMDS: use of alternative distances?

2009-10-16 Thread Jari Oksanen
Kim Vanselow gmx.de> writes: > > Dear r-helpers! > How can I integrate other distances (in the form of a dist object) into function metaMDS? The problem: > metaMDS needs the original data.frame for the calculation and only the default distances of function > vegdist are allowed. > Any suggestion

[R] generalization of tabulate()

2009-10-16 Thread Robin Hankin
Hi I want a generalization of tabulate() which works on rows of a matrix. Suppose I have an integer matrix 'observation': > observation y1 y2 y3 1 4 0 1 4 0 2 0 3 4 1 0 0 5 0 0 1 4 2 0 3 Each row corresponds to a (multivariate) observation. Note that the first two rows are identical: this mea

[R] Converting dataframe to matrix

2009-10-16 Thread Noah Silverman
Hi, I'm experimenting with a few learners that require a matrix as their input. (Currently svmpath, vbmp, etc.) I currently have a dataframe with 50 columns and 20,000 rows. I tried using: x <- as.matrix(my_data.frame) If I then as, "is.matrix(x)", I get TRUE. However everywhere I've trie

Re: [R] Discriminant plot

2009-10-16 Thread Alain Guillet
Hello Alejo, Please, keep sending your post to the R-help mailing list in order other people can also answer. The type of lda_analysis is lda and that is normal and it also is perfectly normal to find a different type for predict(lda_analysis)$x. Moreover the example of the lda() function ab

Re: [R] reference on fisher.test()

2009-10-16 Thread Peter Dalgaard
Peng Yu wrote: On Thu, Oct 15, 2009 at 4:19 PM, RICHARD M. HEIBERGER wrote: On Thu, Oct 15, 2009 at 4:56 PM, Peng Yu wrote: Can somebody point me a book on Fisher's exact test? I looked a few webpages. But the descriptions on the webpages are not very complete. Is there a book on that covers

Re: [R] reference on fisher.test()

2009-10-16 Thread Robin Hankin
Hi fexact.c points you to the original ACM paper: /* ALGORITHM 643, COLLECTED ALGORITHMS FROM ACM. THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, VOL. 19, NO. 4, DECEMBER, 1993, PP. 484-488. - You may find the discussion

Re: [R] Converting dataframe to matrix

2009-10-16 Thread Philipp Pagel
On Fri, Oct 16, 2009 at 01:33:14AM -0700, Noah Silverman wrote: > Hi, > > I'm experimenting with a few learners that require a matrix as their > input. (Currently svmpath, vbmp, etc.) > > I currently have a dataframe with 50 columns and 20,000 rows. > > I tried using: > > x <- as.matrix(my_dat

Re: [R] Converting dataframe to matrix

2009-10-16 Thread Noah Silverman
I think you may be correct. I've manage to get the data into a format that the function accepts. The error appears to be because I have negative values in my data: Error in apply(safeNormCDF(s), 1, prod) : dim(X) must have a positive length On 10/16/09 1:51 AM, Philipp Pagel wrote: On F

[R] Beveridge-Nelson decomposition

2009-10-16 Thread sdlywjl666
Dear all, Is there some function in R to carry out Beveridge-Nelson decomposition? Is there some function in R to carry out seasonal adjustments of time series? Is there some function in R to carry out x11 or x12 seasonal adjustments ? Thanks! Best regards, wang [[alternative HTML versi

Re: [R] Converting dataframe to matrix

2009-10-16 Thread Philipp Pagel
On Fri, Oct 16, 2009 at 01:55:03AM -0700, Noah Silverman wrote: > I think you may be correct. > > I've manage to get the data into a format that the function accepts. > > The error appears to be because I have negative values in my data: > > Error in apply(safeNormCDF(s), 1, prod) : > dim(X)

[R] Help - Correlation between data.

2009-10-16 Thread Lucky Strike
hi everybody, I'm a student, and this is the first time I write on this forum! I'm looking for statistical help hoping somebody can answer me! This is my problem: I have 2 temporal series. The firstone is a series of mesured data (height of monitorated points), the second is a series of temperatu

[R] two graphs 1 x-axis

2009-10-16 Thread Duijvesteijn, Naomi
Dear R-people I have a question concerning plotting graphs. Here an example dataset a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) d<-as.data.frame(cbind(a,b,c)) plot.new() plot(d$a, d$b, col="red") par(new=TRUE) plot(d$a,d$c, col="red", pch="|") What I would want is to plot de second p

Re: [R] two graphs 1 x-axis

2009-10-16 Thread Jim Lemon
On 10/16/2009 09:22 PM, Duijvesteijn, Naomi wrote: Dear R-people I have a question concerning plotting graphs. Here an example dataset a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) d<-as.data.frame(cbind(a,b,c)) plot.new() plot(d$a, d$b, col="red") par(new=TRUE) plot(d$a,d$c, col="red"

Re: [R] two graphs 1 x-axis

2009-10-16 Thread Philipp Pagel
On Fri, Oct 16, 2009 at 12:22:06PM +0200, Duijvesteijn, Naomi wrote: > I have a question concerning plotting graphs. > Here an example dataset > > > a<-c(1,2,3,4,5,6) > b<-c(3,5,4,6,1,1) > c<-c(1,1,1,1,1,1) > d<-as.data.frame(cbind(a,b,c)) > plot.new() > plot(d$a, d$b, col="red") > par(new=TRUE)

Re: [R] generalization of tabulate()

2009-10-16 Thread Gabor Grothendieck
Using the generalized inner product defined in this post: https://www.stat.math.ethz.ch/pipermail/r-help/2006-July/109311.html try this: cbind(S, d = rowSums(inner(S, obs, identical))) On Fri, Oct 16, 2009 at 4:29 AM, Robin Hankin wrote: > Hi > > I want a generalization of tabulate() wh

Re: [R] reference on fisher.test()

2009-10-16 Thread Prof Brian Ripley
On Fri, 16 Oct 2009, Robin Hankin wrote: Hi fexact.c points you to the original ACM paper: Well, you'll get a better idea from the help page as to the real 'original' source reference: the reference below is to a revised version in a remark. And indeed Agresti's book (first edition on the

[R] Urgent help requested to modify a script

2009-10-16 Thread one2luv
I am hoping someone will tak up this chalenge (I am new to R) I have inheritied an R script but need to change it. The script currently includes hardcoded file locations on lines 12,166 and 167. I need to modify this script to allow the folder to be passed as a command line argument to Rscript.ex

Re: [R] Urgent help requested to modify a script

2009-10-16 Thread Romain Francois
On 10/16/2009 02:01 PM, one2luv wrote: I am hoping someone will tak up this chalenge (I am new to R) I have inheritied an R script but need to change it. The script currently includes hardcoded file locations on lines 12,166 and 167. I need to modify this script to allow the folder to be passed

Re: [R] currency conversion function?

2009-10-16 Thread Liviu Andronic
On 10/15/09, Henrique Dallazuanna wrote: > foo <- function(from, to, date){ >url <- > "http://www.oanda.com/convert/classic?script=..%2Fconvert%2Fclassic&language=en&value=1"; > params <- > > sprintf("%s&date=%s&exch=%s&exch2=&margin_fixed=0&expr=%s&expr2=&SUBMIT=Convert+Now&lang=

Re: [R] Estimation in a changepoint regression with R

2009-10-16 Thread Jay Emerson
Package bcp does Bayesian changepoint analysis, though not in the general regression framework.  The most recent reference is Bioinformatics 24(19) 2143-2148; doi:   10.1093/bioinformatics/btn404; slightly older is JSS 23(3). Both reference some alternatives you might want to consider (including s

Re: [R] reference on fisher.test()

2009-10-16 Thread Kjetil Halvorsen
For some alternative views (and references) for FET see: http://www.stat.columbia.edu/~cook/movabletype/archives/2009/10/what_is_the_bay.html#comments kjetil On Fri, Oct 16, 2009 at 8:38 AM, Prof Brian Ripley wrote: > On Fri, 16 Oct 2009, Robin Hankin wrote: > >> Hi >> >> fexact.c points you to

Re: [R] two graphs 1 x-axis

2009-10-16 Thread Paul Hiemstra
Hi Naomi, Take a look at the lattice package for plotting. An example using your data: library(lattice) library(reshape) a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) bla = data.frame(a,b,c) # melt is from reshape bla2 = melt(bla, id.vars = "a") xyplot(value~a | variable, bla2, layout

Re: [R] reference on fisher.test()

2009-10-16 Thread Tom Backer Johnsen
For me, the classical reference for FET is: @BOOK{Siegel56, title = {Nonparametric Statistics for the Behavioral Sciences}, publisher = {McGraw-Hill}, year = {1956}, author = {Siegel, Sidney}, address = {New York} } Tom Prof Brian Ripley wrote: On Fri, 16 Oct 2009, Robin Hankin wrote: H

Re: [R] currency conversion function?

2009-10-16 Thread Liviu Andronic
On 10/15/09, Jeff Ryan wrote: > > getFX("EUR/USD",from="2009-04-01") > Indeed, with the date correctly specified, the function no longer generates errors. There is one issue though (similar to the one in the code posted by Henrique): > getFX("EUR/PEN",from="2009-10-16") [1] "EURPEN" > EURPEN

Re: [R] how to install JGR manually?

2009-10-16 Thread Liviu Andronic
(cc'ing JGR specific list) Hello On 10/15/09, Carl Witthoft wrote: > Here's the problem: on Windows, the 'jgr.exe' tool starts up by checking > for a connecting to the 'net in order to grab the support packages. Well, > we have machines at work that are not and never will be connected to the > In

[R] : Question about correlation between data.

2009-10-16 Thread antoniogone...@libero.it
hi everybody, I'm a student, and I'm new using R! I'm looking for statistical help hoping somebody can answer me! This is my problem: I have 2 temporal series. The firstone is a series of mesured data (height of monitorated points), the second is a series of temperature (in Celsius degree).

[R] package installation from source

2009-10-16 Thread Petr PIKAL
Dear all I noticed from NEWS 2.11.0,dev SIGNIFICANT USER-VISIBLE CHANGES o Packages must have been installed under R 2.10.0 or later, as the current help system is the only one now supported. So I tried to follow instructions in manual, Duncan Murdoch presentation and help pages t

[R] Confidence intervals and p-values of ARMAX model

2009-10-16 Thread Alberto Monteiro
Is there any way to get confidence intervals and/or p-values in the ARMAX model? I tried the search using: ?ar ?arma ?arima But, AFAIK, "ar" and "arma" don't accept exogenous (independent) variables, and "arima(x, order, xreg)" does not return statistics on the xreg terms. BTW, just in case so

[R] Odp: : Question about correlation between data.

2009-10-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.10.2009 15:24:05: > hi everybody, I'm a student, and I'm new using R! > I'm looking for statistical > help hoping somebody can answer me! > > This is my problem: > I have 2 temporal > series. The firstone is a series of mesured data (height of m

Re: [R] reference on fisher.test()

2009-10-16 Thread Stefan Evert
And indeed Agresti's book (first edition on the help page, also has a 2002 second edition) is a good source for the 'minutiae'. I find the description in his 1992 survey article even better, especially with regard to the noncentral hypergeometric distribution: @article{Agresti:92,

Re: [R] currency conversion function?

2009-10-16 Thread Jeff Ryan
On Fri, Oct 16, 2009 at 8:04 AM, Liviu Andronic wrote: > On 10/15/09, Jeff Ryan wrote: >>  > getFX("EUR/USD",from="2009-04-01") >> > Indeed, with the date correctly specified, the function no longer > generates errors. There is one issue though (similar to the one in the > code posted by Henrique

Re: [R] two graphs 1 x-axis

2009-10-16 Thread Felipe Carrillo
You can use ggplot2. library(ggplot2) a<-c(1,2,3,4,5,6) b<-c(3,5,4,6,1,1) c<-c(1,1,1,1,1,1) dframe = data.frame(a,b,c);dframe melt.dframe <- melt(dframe, id= "a");melt.dframe qplot(a,value,data=melt.dframe) + facet_grid(variable~.,scales="free") Felipe D. Carrillo Supervisory Fishery Biologis

[R] using a custom color sequence for image()

2009-10-16 Thread Rajarshi Guha
Hi, I'd like to use a custom color sequence (black - low values, green - high values) in am image() plot. While I can specify colors (say a sequence of grays) to the col argument, the ordering is getting messed up. I have two questions: 1. How can I get a sequence of say 256 colors starting from

Re: [R] [stats-rosuda-devel] how to install JGR manually?

2009-10-16 Thread Simon Urbanek
On Oct 16, 2009, at 9:14 , Liviu Andronic wrote: (cc'ing JGR specific list) Yes, thanks, stats-rosuda-devel is where this post should go. Carl, On 10/15/09, Carl Witthoft wrote: Here's the problem: on Windows, the 'jgr.exe' tool starts up by checking for a connecting to the 'net in order

Re: [R] Generating a stochastic matrix with a specified second dominant eigenvalue

2009-10-16 Thread Ravi Varadhan
A valiant attempt, Albyn! Unfortunately, the matrix B is not guaranteed to be a stochastic matrix. In fact, it is not even guaranteed to be a real matrix. Your procedure can generate a B that contains negative elements or even complex elements. > M = matrix(runif(9),nrow=3) > M = M/apply(

[R] "negative length vectors are not allowed" in wilcox.exact() and perm.test()

2009-10-16 Thread David Croll
Dear R friends, I want to compare two datasets and I get the message Error in .Call("cpermdist2", ma = as.integer(m), mb = as.integer(col), : negative length vectors are not allowed after specifying the exact test. I'm using the exactRankTests package. Do you suggest me using the coin lib

Re: [R] using a custom color sequence for image()

2009-10-16 Thread Alberto Monteiro
Rajarshi Guha asked: > > Hi, I'd like to use a custom color sequence (black - low values, > green - high values) in am image() plot. While I can specify colors > (say a sequence of grays) to the col argument, the ordering is > getting messed up. I have two questions: > > 1. How can I get a seq

Re: [R] package installation from source

2009-10-16 Thread Duncan Murdoch
On 10/16/2009 9:31 AM, Petr PIKAL wrote: Dear all I noticed from NEWS 2.11.0,dev SIGNIFICANT USER-VISIBLE CHANGES o Packages must have been installed under R 2.10.0 or later, as the current help system is the only one now supported. So I tried to follow instructions in manual, Du

Re: [R] Generating a stochastic matrix with a specified second dominant eigenvalue

2009-10-16 Thread David Winsemius
On Oct 15, 2009, at 6:24 PM, Ravi Varadhan wrote: Hi, Given a positive integer N, and a real number \lambda such that 0 < \lambda < 1, I would like to generate an N by N stochastic matrix (a matrix with all the rows summing to 1), such that it has the second largest eigenvalue equal to

Re: [R] "negative length vectors are not allowed" in wilcox.exact() and perm.test()

2009-10-16 Thread Ben Bolker
David Croll wrote: > > I want to compare two datasets and I get the message > > Error in .Call("cpermdist2", ma = as.integer(m), mb = as.integer(col), : > negative length vectors are not allowed > > after specifying the exact test. I'm using the exactRankTests package. Do > you suggest me

Re: [R] "negative length vectors are not allowed" in wilcox.exact() and perm.test()

2009-10-16 Thread Dieter Menne
David Croll wrote: > > I want to compare two datasets and I get the message > > Error in .Call("cpermdist2", ma = as.integer(m), mb = as.integer(col), : > negative length vectors are not allowed > > after specifying the exact test. I'm using the exactRankTests package. Do > you suggest me

Re: [R] tapply() and using factor() on a factor

2009-10-16 Thread Alexander Peterhansl
Thank you Mohamed and Bill for your replies. (I did not send the data because it is unwieldy.) Yes Bill, the issue arises directly from what you had guessed. I was working with a subset of the data (which implicitly had factors for the complete data set). On this, what is the best way take a su

[R] Determining a linear model based on a factor

2009-10-16 Thread Jason Rupert
I guess I should disclose up front that am not a statistician by schooling, but I am intersted in getting the terminology correct so please correct it if I butcher it too badly. I have been able to very easily build a linear model showing the correlation between two variables, e.g. year built

[R] Matrixes as data

2009-10-16 Thread Kjetil Halvorsen
Hola! I am working on a problem where data points are (square) matrices. Is there a way to make a "vector" of matrices, such that it can be stored in a data.frame? Can that be done with S3? or do I have to learn S4 objects & methods? Kjetil __ R-help@r

Re: [R] Proper syntax for using varConstPower in nlme

2009-10-16 Thread Dieter Menne
Michael A. Gilchrist wrote: > > - >> nlme(Count ~ quad.PBMC.model(aL, aN, T0), > + data = tissueData, > + weights = varConstPower(form =~ Count), > + start = list( fixed = c(rep(1000, 8), -2, -2) ), > + fixed = list(T0 ~ TypeTissue-1, aL ~ 1,

Re: [R] Matrixes as data

2009-10-16 Thread Barry Rowlingson
On Fri, Oct 16, 2009 at 4:36 PM, Kjetil Halvorsen wrote: > Hola! > > I am working on a problem where data points are (square) matrices. Is > there a way to make a > "vector" of matrices, such that it can be stored in a data.frame? Can > that be done with S3? > or do I have to learn S4 objects & me

Re: [R] populating an array

2009-10-16 Thread Tony Plate
R doesn't access arrays like C, use [i,j] to access a 2-d array, e.g.: my_array <- array(0,dim=c(2,2)) for(i in seq(1,2,by=1)){ + for(j in seq(1,2,by=1)){ + my_array[i,j] = i+j + } + } my_array [,1] [,2] [1,]23 [2,]34 tdm wrote: Hi, Can someone please give m

Re: [R] Matrixes as data

2009-10-16 Thread Steve Lianoglou
Bonjour, On Oct 16, 2009, at 11:36 AM, Kjetil Halvorsen wrote: Hola! I am working on a problem where data points are (square) matrices. Is there a way to make a "vector" of matrices, such that it can be stored in a data.frame? Can that be done with S3? or do I have to learn S4 objects & method

[R] Test model for singular gradient matrix

2009-10-16 Thread dmhultst
Hello, I am working with a real-time hydrologic modeling system, and I am using R (R batch script on Linux) to create a non-linear relationship (exponential) between observed data. I want to extract the non-linear coefficients (“b” and “m”) if the relationship can be created, if the relationship

Re: [R] Removing Embedded Null characters from text/html

2009-10-16 Thread Duncan Temple Lang
[David contacted me directly, so I am sending my off-line reply to the list just for the record in case others encounter a simple problem.] Hi David. No problem contacting me at all. I saw your mail at one point on the mailing list, but didn't have a chance to respond. Indeed, it seems like th

Re: [R] tapply() and using factor() on a factor

2009-10-16 Thread David Winsemius
On Oct 16, 2009, at 11:33 AM, Alexander Peterhansl wrote: Thank you Mohamed and Bill for your replies. (I did not send the data because it is unwieldy.) Yes Bill, the issue arises directly from what you had guessed. I was working with a subset of the data (which implicitly had factors for

[R] Division of data frame and deletion of values from column

2009-10-16 Thread Joel Fürstenberg-Hägg
Hi all, I guess this might be an easy question, but I've searched multiple help pages without finding any answear... so now I put my trust in you! I have a data frame (36 variables and 556 observations). One column contains three factors, and I would like to divide the data frame into three n

Re: [R] Matrixes as data

2009-10-16 Thread Kjetil Halvorsen
Thanks. The points of having the column of matrices (all the same dimension) in a data.frame, is that there are also other data, each matrix is at a location, so there are geographical coordinates and possibly other measurements at the same location. Kjetil On Fri, Oct 16, 2009 at 12:46 PM, Barry

Re: [R] Division of data frame and deletion of values from column

2009-10-16 Thread David Winsemius
On Oct 16, 2009, at 12:16 PM, Joel Fürstenberg-Hägg wrote: Hi all, I guess this might be an easy question, but I've searched multiple help pages without finding any answear... so now I put my trust in you! I have a data frame (36 variables and 556 observations). One column contains t

Re: [R] generalization of tabulate()

2009-10-16 Thread Bert Gunter
If I have correctly understood what Robin wants, I don't think Gabor's elaborate solution is necessary (though I grant that it may be more general). It's also slow due to the "apply's". A more straightforward and faster approach is to convert the rows to individual character strings via paste() and

[R] Cannot calculate mean() for double vector

2009-10-16 Thread Reuben Bellika
I've been using R recently to analyze some data, but I'm having a problem using the mean() function. I imported the original data set as a vector of integers, x and then calculated a exponential moving average of the data, x_ema. This part worked fine. Then, I tried to find the mean squared error

Re: [R] Test model for singular gradient matrix

2009-10-16 Thread Ben Bolker
dmhultst wrote: > > > Hello, > > I am working with a real-time hydrologic modeling system, and I am using R > (R batch script on Linux) to create a non-linear relationship > (exponential) > between observed data. I want to extract the non-linear coefficients (“b” > and “m”) if the relationsh

Re: [R] Subset returning unexpected result

2009-10-16 Thread Peter Ehlers
Steve Murray wrote: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Bill=2C It seems to be 'character' - odd...! Not really very "odd". I'll wager that your data was originally recorded in Excel or equivalent and that the column

Re: [R] Generating a stochastic matrix with a specified second dominant eigenvalue

2009-10-16 Thread Albyn Jones
ooops! I tested it on a 3x3, and a 4x4, and it worked both times. Then I ran it once more and pasted it in without looking carefully... Here's another half-baked idea. Generate a random graph with given degree distribution, turn the incidence matrix into a stochastic matrix (ie the transition pr

Re: [R] Division of data frame and deletion of values from column

2009-10-16 Thread John Kane
?subset ?split --- On Fri, 10/16/09, Joel Fürstenberg-Hägg wrote: > From: Joel Fürstenberg-Hägg > Subject: [R] Division of data frame and deletion of values from column > To: r-help@r-project.org > Received: Friday, October 16, 2009, 12:16 PM > > Hi all, > > I guess this might be an easy que

[R] Problem with the stl function

2009-10-16 Thread Renan Xavier Cortes
Hi there, My name is Renan X. Cortes, student of Statistics, from south of Brazil, and I'd like to ask you a few questions about decomposition of time series. In R, when I fit the decomposition using the "stl" function, an object is returned when ask the summary of the fit, called STL.

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Jason Rupert
Have you tried: mean(x) mean(as.numeric(as.character(x))) mean(x_ema) mean(as.numeric(as.character(x_ema))) What is the result of the following: which(is.na(as.numeric(as.character(x_ema Abit hard since you don't provide the data, but there may be an NA or character value that is causing the

[R] DCC Garch model estimation

2009-10-16 Thread liwenkai1986
Hi all: I am a master student writing my master thesis about using the DCC garch model analysing the correlation between the insurance stock market and the local market. Right now I have a question about how to estimate the DCC garch, I know all the other meanings of the arguments in the

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Alberto Monteiro
Reuben Bellika wrote: > > I've been using R recently to analyze some data, but I'm having a > problem using the mean() function. > > I imported the original data set as a vector of integers, x and then > calculated a exponential moving average of the data, x_ema. This part > worked fine. > > The

[R] Different way of scaling data

2009-10-16 Thread Noah Silverman
Hi, I have a data.frame that I need to scale. I've been using the scale function and it works nicely. Some of the libraries I'm testing won't accept negative values for data, so I need to find a way to scale the data from 0 to 1 Any ideas? Thans! ___

Re: [R] "negative length vectors are not allowed" in wilcox.exact() and perm.test()

2009-10-16 Thread Patrick Burns
Ben Bolker wrote: David Croll wrote: I want to compare two datasets and I get the message Error in .Call("cpermdist2", ma = as.integer(m), mb = as.integer(col), : negative length vectors are not allowed after specifying the exact test. I'm using the exactRankTests package. Do you suggest

Re: [R] "negative length vectors are not allowed" in wilcox.exact() and perm.test()

2009-10-16 Thread John Kane
Number of politicians' promises kept? --- On Fri, 10/16/09, Patrick Burns wrote: > From: Patrick Burns > Subject: Re: [R] "negative length vectors are not allowed" in wilcox.exact() > and perm.test() > To: "Ben Bolker" > Cc: r-help@r-project.org > Received: Friday, October 16, 2009, 1:45 PM >

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Reuben Bellika
OK. It looks like I just have several NA values at the start of my array: > which (is.na(x_ema)) [1] 1 2 3 4 5 6 7 8 9 That make sense, because the moving average is not defined for those positions. I'll just have to set those values to zero: > x_ema = replace(x_ema, which(is.na(x_ema)), 0) > wh

Re: [R] Different way of scaling data

2009-10-16 Thread John Kane
library(reshape) ?rescaler I think something along the lines of rescaler(data.frame, type="range") should do what you want. --- On Fri, 10/16/09, Noah Silverman wrote: > From: Noah Silverman > Subject: [R] Different way of scaling data > To: "r help" > Received: Friday, October 16, 2009,

Re: [R] How to right-align labels in dotchart

2009-10-16 Thread John Kane
Oops replying to the wrong post but anyway does this do what you want? aa <- c(3,6,3,5,8) lbs <- c('cat','goat', 'elephant', 'horse', 'whale') dotchart(aa, pch=(16), col = 1:5, main="A Dotchart") axis(side = 2, seq_along(aa), lbs, las=1) --- On Thu, 10/15/09, Sean Carmody wrote: > From: Sean

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Ista Zahn
On Fri, Oct 16, 2009 at 2:01 PM, Reuben Bellika wrote: > OK. It looks like I just have several NA values at the start of my array: > >> which (is.na(x_ema)) > [1] 1 2 3 4 5 6 7 8 9 > > That make sense, because the moving average is not defined for those > positions. I'll just have to set those val

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Sarah Goslee
Are you sure that's the right solution? If you set them to 0, those values are averaged in with the others, and that could make a substantial difference. A much better approach: mean(x_ema, na.rm=TRUE) - see the help for mean for more information. Sarah On Fri, Oct 16, 2009 at 2:01 PM, Reuben

[R] How odds ratio is computed in fisher.test()?

2009-10-16 Thread Peng Yu
I'm wondering how odds ratio is computed. I thought that it is (n11/n12)/(n21/n22), but it is not what fisher.test() computes. Could somebody let me know? > n11=3 > n12=1 > n21=1 > n22=3 > > n1_=n11+n12 > n2_=n21+n22 > > n_1=n11+n21 > n_2=n12+n22 > > x=rbind(c(n11,n12),c(n21,n22)) > > threshold=dh

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Reuben Bellika > Sent: Friday, October 16, 2009 11:02 AM > To: r-help@r-project.org > Subject: Re: [R] Cannot calculate mean() for double vector > > OK. It looks like I just have

Re: [R] Matrixes as data

2009-10-16 Thread Magnus Torfason
> Hola! > > I am working on a problem where data points are (square) matrices. Is > there a way to make a "vector" of matrices, such that it can be stored > in a data.frame? I agree with previous posters that in most cases, you would want to store matrices in a list. However, if you already have

Re: [R] Cannot calculate mean() for double vector

2009-10-16 Thread Reuben Bellika
It looks like I should read the documentation a bit more carefully. Simply ignoring the NA values when calculating the mean *is* a much better solution. (Although having 10 values out of a vector of 4 or so set to zero is *not* going to bias the mean toward zero in any significant way.) Thanks

[R] How can I run a function to a piece of text?

2009-10-16 Thread Javier PB
Dear users, I got really stuck trying to apply a function to a piece of code that I created using different string functions. To make things really easy, this is a wee example: x<-c(1:10) script<-"x, trim = 0, na.rm = FALSE"##script created by a number of paste() and rep() steps mean(

Re: [R] How can I run a function to a piece of text?

2009-10-16 Thread Sundar Dorai-Raj
Based solely on what you told us, this can be done using eval(parse(text=...)) cmd <- sprintf("mean(%s)", script) eval(parse(text = cmd)) However, with more context, there may be a better solution. See, for example, install.packages("fortunes") library(fortunes) fortune("parse()") HTH, --sunda

Re: [R] How odds ratio is computed in fisher.test()?

2009-10-16 Thread Ben Bolker
From ?fisher.test: estimate: an estimate of the odds ratio. Note that the _conditional_ Maximum Likelihood Estimate (MLE) rather than the unconditional MLE (the sample odds ratio) is used. Only present in the 2 by 2 case. from fisher.test: mle <- function(

Re: [R] How can I run a function to a piece of text?

2009-10-16 Thread Alberto Monteiro
Javier PB wrote: > > I got really stuck trying to apply a function to a piece of code > that I created using different string functions. > > To make things really easy, this is a wee example: > > x<-c(1:10) > script<-"x, trim = 0, na.rm = FALSE"##script created by a > number of paste()

Re: [R] how to install JGR manually?

2009-10-16 Thread cgw
It doesn't get that far. I launch jgr.exe and it announces that it can't connect to the internet, and shuts itself down. I've installed every dependent package listed in the jgr documentation. Carl Oct 16, 2009 09:14:38 AM, landronim...@gmail.com wrote: ==

Re: [R] How can I run a function to a piece of text?

2009-10-16 Thread Henrique Dallazuanna
An alternative could be: do.call(mean, as.list(parse(text = unlist(strsplit(script, ", ") On Fri, Oct 16, 2009 at 3:39 PM, Javier PB wrote: > > Dear users, > > I got really stuck trying to apply a function to a piece of code that I > created using different string functions. > > To make thi

[R] Breusch-pagan and white test - check homoscedasticity

2009-10-16 Thread Gautier RENAULT
Hi r-programmers, I performe Breusch-Pagan tests (bptest in package lmtest) to check the homoscedasticity of the residuals from a linear model and I carry out carry out White's test via bptest (formula, ~ x * z + I(x^2) + I(z^2)) include all regressors and the squares/cross-products in the auxilia

Re: [R] How to right-align labels in dotchart

2009-10-16 Thread Sean Carmody
Thanks very much John, that works. I had tried using las=1 inside the dotchart function itself, but it seems to be one of those occasions where the par parameter is over-ridden by the main plotting function. You can see the results here: http://www.stubbornmule.net/2009/10/asylum-seekers/ Now if on

[R] what's the R code for wavelet decomposition (Haar transformation)?

2009-10-16 Thread Zhen Li
Dear all, Using R function "dwt", it seems that I cannot specify the wavelet transformation like Haar. What's the R code for wavelet decomposition which allows me to specify Haar wavelet transformation? Of course, if it can include "db2", that is even better. In general, I want an R function

Re: [R] how to install JGR manually?

2009-10-16 Thread Liviu Andronic
On 10/16/09, c...@witthoft.com wrote: > It doesn't get that far. I launch jgr.exe and it announces that it can't > connect to the internet, and shuts itself down. > In R, does the following work? require(JGR) JGR() Liviu __ R-help@r-project.org maili

[R] Frequencies, proportions & cumulative proportions

2009-10-16 Thread Muenchen, Robert A (Bob)
Dear R-Helpers, I've looked high and low for a function that provides frequencies, proportions and cumulative proportions side-by-side. Below is the table I need. Is there a function that already does it? Thanks, Bob > # Generate some test scores > myValues <- c(70:95) > Score <- ( sample( myVal

[R] Modify the plot from countCDFxt

2009-10-16 Thread Michelle DePrenger-Levin
Hello, I am running the plot from countCDFxt (popbio). I would like to report the y-axis as a percent instead of the log scale (e^01...). I can add an axis with axis(2, 0:1, line =2) but I'm having trouble understanding how to assign the tic marks (with 'at ='). I'd like to tell it to make tics wi

Re: [R] [stats-rosuda-devel] how to install JGR manually?

2009-10-16 Thread Simon Urbanek
On Oct 16, 2009, at 16:49 , Liviu Andronic wrote: On 10/16/09, c...@witthoft.com wrote: It doesn't get that far. I launch jgr.exe and it announces that it can't connect to the internet, and shuts itself down. In R, does the following work? require(JGR) JGR() No. JGR() creates a start

Re: [R] Matrixes as data

2009-10-16 Thread Ben Bolker
Magnus Torfason-2 wrote: > > > Hola! > > > > I am working on a problem where data points are (square) matrices. Is > > there a way to make a "vector" of matrices, such that it can be stored > > in a data.frame? > > I agree with previous posters that in most cases, you would want to > sto

Re: [R] Frequencies, proportions & cumulative proportions

2009-10-16 Thread Ted Harding
On 16-Oct-09 20:51:06, Muenchen, Robert A (Bob) wrote: > Dear R-Helpers, > > I've looked high and low for a function that provides frequencies, > proportions and cumulative proportions side-by-side. Below is the table > I need. Is there a function that already does it? > > Thanks, > Bob > >> # G

Re: [R] Proper syntax for using varConstPower in nlme

2009-10-16 Thread Michael A. Gilchrist
Hi Dieter, Thanks for the reply. I had played with the initial conditions, but apparently not enough. I finally found some that avoided the singularity issue. Many thanks. More generally, I went over the documentation yet again in P&B and I still find it a bit confusing. They talk about

Re: [R] Matrixes as data

2009-10-16 Thread Gabor Grothendieck
Create a matrix out of a list. In this example column 1 contains matrices, column 2 contains the number 1 and 2 and column 3 contains letters: > L <- matrix(list(m, m+10, 1, 2, "a", "b"), 2); L [,1] [,2] [,3] [1,] Integer,4 1"a" [2,] Numeric,4 2"b" > L[[2,1]] [,1] [,2] [1,]

Re: [R] Frequencies, proportions & cumulative proportions

2009-10-16 Thread Muenchen, Robert A (Bob)
Ted, I know how to do that. It's just such a standard display in SAS, SPSS and Stata that I figured someone had done it and I had just overlooked it. Thanks! Bob I don't think there is a ready-made one, but it is very little effort to make your own: mkMyTable <- function(X){ Table <- data.f

Re: [R] Breusch-pagan and white test - check homoscedasticity

2009-10-16 Thread Achim Zeileis
On Fri, 16 Oct 2009, Gautier RENAULT wrote: Hi r-programmers, I performe Breusch-Pagan tests (bptest in package lmtest) to check the homoscedasticity of the residuals from a linear model and I carry out carry out White's test via bptest (formula, ~ x * z + I(x^2) + I(z^2)) include all regressor

[R] RODBC sqlSave does not append the records to a DB2 table

2009-10-16 Thread Elaine Jones
I am running R version 2.9.2 on Windows XP OS with RODBC version Version: 1.3-0. Has anyone out there in the R user community successfully appended records to a DB2 table on a remote database using the sqlSave function in the RODBC package? (or by any other means from R?) I posed a similar que

[R] ozone data

2009-10-16 Thread Julius Tesoro
Hi just a quick inquiry Sorry if this is too trivial but I am just a beginner in R. I am looking at the plyr package and I am intrigued at how data(i.e. ozone, baseball) is loaded without having to type data(ozone). Are they automatically loaded when i call library(plyr)? I want to do the same

[R] custom selfStart model works with getInitial but not nls

2009-10-16 Thread Michael A. Gilchrist
Hello, I'm having problems creating and using a selfStart model with nlme. Briefly, I've defined the model, a selfStart object, and then combined them to make a selfStart.default model. If I apply getInitial to the selfStart model, I get results. However, if I try usint it with nls or nlsL

Re: [R] Frequencies, proportions & cumulative proportions

2009-10-16 Thread David Scott
Muenchen, Robert A (Bob) wrote: Ted, I know how to do that. It's just such a standard display in SAS, SPSS and Stata that I figured someone had done it and I had just overlooked it. Thanks! Bob I don't think there is a ready-made one, but it is very little effort to make your own: mkMyTable

Re: [R] Odp: : Question about correlation between data.

2009-10-16 Thread David Scott
Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 16.10.2009 15:24:05: hi everybody, I'm a student, and I'm new using R! I'm looking for statistical help hoping somebody can answer me! This is my problem: I have 2 temporal series. The firstone is a series of mesured data (heigh

  1   2   >