Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I tried sprintf and paste, which solves one of my problem i.e. replacing the variable name by its value. However, >= is not renderend correctly as the inequality symbol. On Tue, Mar 24, 2009 at 12:24 PM, Gabor Grothendieck wrote: > For the legend argument try this: > > leg = as.expression(c(sprin

Re: [R] newton method

2009-03-23 Thread Yihui Xie
I'm not sure what you meant by "a topic on newton's method" (algorithm? demo?), but the demonstration in the package 'animation' might help: install.packages('animation') par(pch = 20) ani.options(nmax = 50) newton.method(function(x) 5 * x^3 - 7 * x^2 - 40 * x + 100, 7.15, c(-6.2, 7.1)) Regar

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread Gabor Grothendieck
For the legend argument try this: leg = as.expression(c(sprintf("Up (>= %d)", threshold), "Normal", "Down", "NA")) or use paste in place of sprintf. On Mon, Mar 23, 2009 at 11:53 PM, Daren Tan wrote: > I need to have the maths symbol for >= in the legend, and to > substitute threshold v

Re: [R] Legend containing maths symbol and values of variables

2009-03-23 Thread andrew
the plotmath help page should give the answer http://www.stat.ucl.ac.be/ISdidactique/Rhelp/library/base/html/plotmath.html On Mar 24, 2:53 pm, Daren Tan wrote: > I need to have the maths symbol for >= in the legend, and to > substitute threshold variable with its value. Somehow, various > attemp

Re: [R] help: what are the basis functions in {mgcv}: gam?

2009-03-23 Thread Andrew Robinson
Try Wood S.N. (2006) Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC Press. listed in the references in the help file of the function. It's a great read. Andrew On Mon, Mar 23, 2009 at 07:36:44PM -0700, oliviax wrote: > > I am writing my thesis with the fun

[R] Legend containing maths symbol and values of variables

2009-03-23 Thread Daren Tan
I need to have the maths symbol for >= in the legend, and to substitute threshold variable with its value. Somehow, various attempts weren't successful. Please help. threshold <- 0.5 plot(NA, xlab="", ylab="", main="", axes=F, xlim=c(0,1), ylim=c(0,1), xaxs="i", yaxs="i") legend(x=0, y=1, fill=c(

[R] help: what are the basis functions in {mgcv}: gam?

2009-03-23 Thread oliviax
I am writing my thesis with the function gam(), with the package {mgcv}. My command is: gam(y~s(x1,bs="cr")+s(x2, bs="cr")). I need help to know what are the default basis funcitons for gam. I have not found any detailed reference for this. Can anyone help me with this?? -- View this messa

Re: [R] Properly labeling abline with text?

2009-03-23 Thread Gabor Grothendieck
Try this: library(plotrix) plot(x_vals, y_vals) abline(h=min(y_vals), col="darkred") boxed.labels(max(x_vals) - strwidth(bottom_label)/2, min(y_vals) + strheight(bottom_label), bottom_label) See ?boxed.labels for more. On Mon, Mar 23, 2009 at 11:01 PM, Jason Rupert wrote: > > The result of the

[R] confidence interval or error of x intercept of a linear regression

2009-03-23 Thread Kevin J Emerson
Hello all, This is something that I am sure has a really suave solution in R, but I can't quite figure out the best (or even a basic) way to do it. I have a simple linear regression that is fit with lm for which I would like to estimate the x intercept with some measure of error around it (conf

Re: [R] Properly labeling abline with text?

2009-03-23 Thread David Winsemius
?rect -- David Winsemius On Mar 23, 2009, at 11:01 PM, Jason Rupert wrote: The result of the code shown below is posted at the following URL: http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html I would like to figure out a better way to label the horizontal abline. I t

[R] Properly labeling abline with text?

2009-03-23 Thread Jason Rupert
The result of the code shown below is posted at the following URL: http://n2.nabble.com/Trying-to-properly-label-abline-td2524629.html I would like to figure out a better way to label the horizontal abline. I tried multiplying the text y position by a scale, but this didn't always put the text

Re: [R] .Internal

2009-03-23 Thread Berwin A Turlach
G'day Kevin, On Mon, 23 Mar 2009 18:48:16 -0400 wrote: > Sorry to be so dense but the article that you suggest does not give > any information on how the arguments are packed up. I look at the > call: > > val <- .Internal(fmin(function(arg) -f(arg, ...), lower, upper, tol)) > > and then with t

Re: [R] two different date formats in the same variable

2009-03-23 Thread Gabor Grothendieck
Try this: > library(chron) > x <- c("06/25/04", "06/25/2004", "03/03/59", "03/03/1959") > chron(x) [1] 06/25/04 06/25/04 03/03/59 03/03/59 On Mon, Mar 23, 2009 at 8:06 PM, Farrel Buchinsky wrote: > How does one convert to a date format when survey respondents have > used two different date form

Re: [R] Summarizing each row into a frequency table

2009-03-23 Thread Gabor Grothendieck
Try this (haven't checked the speed): f <- function(x) table(factor(x, c(-1, 0, 1))) 100 * prop.table(t(apply(m, 1, f)), 1) On Mon, Mar 23, 2009 at 8:46 PM, Daren Tan wrote: > I have a matrix containing -1, 0, 1, however certain rows will not > have all 3 numbers. I have written some codes to c

Re: [R] If statement generates two outputs

2009-03-23 Thread Berwin A Turlach
G'day Carl, On Mon, 23 Mar 2009 20:11:19 -0400 Carl Witthoft wrote: > >From: Wacek Kusnierczyk > >Date: Sun, 22 Mar 2009 22:58:49 +0100 > > > >just for fun, you could do this with multiassignment, e.g., using > >the (highly experimental and premature!) rvalues: > > >source('http://m

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread G. Jay Kerns
Dear Ivan, On 3/23/09, pfc_ivan wrote: > > Hello guys, I am stuck here: > > How do I make 1000 samples of n = 10 observations from an Exponential > distribution and then compute the mean for all those 1000 samples? > The R Commander will do this. See the menus Distributions -> Continuous -> Exp

[R] A question about rJava and the classpath

2009-03-23 Thread Saptarshi Guha
Hello, Since this an R package, I'm sending the email. I'm loading all the jar files as: library(rJava) hadoop <- Sys.getenv("HADOOP") allfiles <- c(list.files(hadoop,pattern="jar$",full.names=T),list.files(paste(hadoop,"lib",sep=.Platform$file.sep,collapse=""),pattern="jar$",full.names=T)) allfi

Re: [R] Summarizing each row into a frequency table

2009-03-23 Thread Peter Alspach
Tena koe Daren One alternative: apply(m, 1, function(x) 100*summary(factor(x, levels=-1:1))/length(x[!is.na(x)])) Doubtless there are others. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Daren T

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread j verzani
Greg Snow imail.org> writes: > > There is also the clt.examp function in the TeachingDemos package. > An interactive demo can also be found at http://www.math.csi.cuny.edu/gWidgetsWWW/ex-clt.html>http://www.math.csi.cuny.edu/gWidgetsWWW/ex-clt.html. __

[R] Summarizing each row into a frequency table

2009-03-23 Thread Daren Tan
I have a matrix containing -1, 0, 1, however certain rows will not have all 3 numbers. I have written some codes to compute the frequency table of how many -1s, 0s, 1s per row, but it is very ugly and not efficient if there are more than 3 numbers. Please suggest. m <- rbind(sample(0:1, replace=T,

Re: [R] error statement: missing value where TRUE/FALSE needed

2009-03-23 Thread jim holtman
I would assume the expression in the 'if' is giving an NA as a result: > if (NA) 1 else 2 Error in if (NA) 1 else 2 : missing value where TRUE/FALSE needed > On Mon, Mar 23, 2009 at 10:38 AM, Michael Curran wrote: > Hi list, > > I want to try Gibbs sampling as a method of estimating a markov-sw

Re: [R] two different date formats in the same variable

2009-03-23 Thread jim holtman
Try using 'strsplit' to split your string on the '/' and then create a series of 'if's to determine how you want to output the new string. You will probably need this approach since you may have to check the validity and ranges of the numbers. On Mon, Mar 23, 2009 at 8:06 PM, Farrel Buchinsky wro

Re: [R] If statement generates two outputs

2009-03-23 Thread Carl Witthoft
>From: Wacek Kusnierczyk >Date: Sun, 22 Mar 2009 22:58:49 +0100 >just for fun, you could do this with multiassignment, e.g., using the >(highly experimental and premature!) rvalues: >source('http://miscell.googlecode.com/svn/rvalues/rvalues.r') >if (TRUE) > c(df1, df2) := list(4

[R] two different date formats in the same variable

2009-03-23 Thread Farrel Buchinsky
How does one convert to a date format when survey respondents have used two different date formats whilst entering their data. There were clearly told to use mm/dd/ but humans being humans some entered mm/dd/yy. There was even validity checks on the forms but I allowed them to be overridden sin

Re: [R] variance/mean

2009-03-23 Thread Wacek Kusnierczyk
(this post suggests a patch to the sources, so i allow myself to divert it to r-devel) Bert Gunter wrote: > x a numeric vector, matrix or data frame. > y NULL (default) or a vector, matrix or data frame with compatible > dimensions to x. The default is equivalent to y = x (but more efficient).

Re: [R] Plotting with plot()

2009-03-23 Thread Peter Dalgaard
Satindra Chakravorty wrote: I am trying to use the plot() function in R but can't seem to generate any plots. I am running R version 2.7.1 on a server machine to which I am remotely connected on a Linux platform. I typed plot(trees$volume) as a test and got back the ">" prompt with no plot in

Re: [R] Plot Means Line with Standard Deviation as "Whiskers"

2009-03-23 Thread Peter Alspach
Tena koe Rodrigo You could always make up some data and then show us what you have tried to do. I would guess you need to check out: plot # to do the basic plot lines # to add lines to the plot points # to add points to the plot arrows # can be used to give the whiskers apply # to get the means

[R] Plotting with plot()

2009-03-23 Thread Satindra Chakravorty
I am trying to use the plot() function in R but can't seem to generate any plots. I am running R version 2.7.1 on a server machine to which I am remotely connected on a Linux platform. I typed > plot(trees$volume) as a test and got back the ">" prompt with no plot in my current window or in any o

Re: [R] Merging rows in dataframes

2009-03-23 Thread Gabor Grothendieck
Using sqldf you only need two statements, infile <- file(...) and DF <- sqldf("select min(a), max(b), mean(c), ... from infile group by id"). The file statement identifies the filename and the second reads it into sqlite (without going through R), summarizes it and then reads the summarized version

Re: [R] .Internal

2009-03-23 Thread rkevinburton
Sorry to be so dense but the article that you suggest does not give any information on how the arguments are packed up. I look at the call: val <- .Internal(fmin(function(arg) -f(arg, ...), lower, upper, tol)) and then with the help of this article I find do_fmin in optimize.c: SEXP attribute_h

[R] Plot Means Line with Standard Deviation as "Whiskers"

2009-03-23 Thread Rodrigo Aluizio
Hi list members. I’ll try to plot the abundance means of nine transects as lines, with five points on each transect (A to I). I will also need to plot for each point, it’s standard deviation (once each point will have tree replicates) as whiskers. Another problem will be that all the points should

Re: [R] Confusion regarding environments invoked by "source" command

2009-03-23 Thread Duncan Murdoch
On 23/03/2009 6:06 PM, Dennis Fisher wrote: Colleagues, R version 2.8.1 in OS X Within a function (which is already within a function), I am sourcing a file. The syntax of the command is something like (this is just an example; the actual code is much more complicated): This code works j

Re: [R] Accuracy of R and other platforms

2009-03-23 Thread John Maindonald
These comparisons are very simplistic. In most contexts, it would make much better sense to measure "accuracy" in standard error units, rather than in number of digits. There doubtless are specialist applications where the 15th digit (or even the 10th!) are important. But the check of acc

Re: [R] Graphic with several curves

2009-03-23 Thread Jorge Ivan Velez
Dear CE.KA, If 'x' is your data, you could do something like the following: matplot(as.factor(c('1990','1992')),t(x[,-2]),type='l', xaxt='n',xlab='Year',ylab="Some label here",lty=1) axis(1,c(1990,"","","",1992),c(1990,"","","",1992)) legend('topleft',paste('Observation',1:5),col=1:5,lt

Re: [R] read in large data file (tsv) with inline filter?

2009-03-23 Thread Dylan Beaudette
On Monday 23 March 2009, David Reiss wrote: > I have a very large tab-delimited file, too big to store in memory via > readLines() or read.delim(). Turns out I only need a few hundred of those > lines to be read in. If it were not so large, I could read the entire file > in and "grep" the lines I n

[R] Confusion regarding environments invoked by "source" command

2009-03-23 Thread Dennis Fisher
Colleagues, R version 2.8.1 in OS X Within a function (which is already within a function), I am sourcing a file. The syntax of the command is something like (this is just an example; the actual code is much more complicated): BIGFUNCTION <- function() { DATAFRAME

[R] [Fwd: Re: Graphic with several curves]

2009-03-23 Thread Kenneth Roy Cabrera Torres
- Mensaje reenviado > De: Kenneth Roy Cabrera Torres > Para: CE.KA > Asunto: Re: [R] Graphic with several curves > Fecha: Mon, 23 Mar 2009 17:02:48 -0500 > > try matplot(), > > but you have to transpose the matrix > > with option type="l". > > Example: > > data1<-data.frame(

[R] Merging rows in dataframes

2009-03-23 Thread Schraga Schwartz
Hello, I have a dataframe with 40 columns and around 450,000 rows. The first column in each row is a factor id and the remaining are numeric. Some rows have the same ids. What I want to do is to merge each set of rows sharing the same ids (id set) into one single row (summarizing row) wit

[R] read in large data file (tsv) with inline filter?

2009-03-23 Thread David Reiss
I have a very large tab-delimited file, too big to store in memory via readLines() or read.delim(). Turns out I only need a few hundred of those lines to be read in. If it were not so large, I could read the entire file in and "grep" the lines I need. For such a large file; many calls to read.delim

[R] Graphic with several curves

2009-03-23 Thread CE.KA
Hi R users, Imagine the folowing data frame 19901991 1992 1 5 20 6 2 15 1 11 3 3 14 22 4 20 8 55 5 10 3 14 Is there a way to build a graphic in which: - 1 c

[R] aggregate() problem on last patched version

2009-03-23 Thread Kenneth Roy Cabrera Torres
Hi R users and developers: Several hours ago I post a problem with the aggregate() function using the last patch version of R. (R version 2.8.1 Patched (2009-03-18 r48193)) I do compile again the 2.8.1 plain version (not patched) and now it works again, both the examples and my old scripts that

Re: [R] Difference between gam() and loess().

2009-03-23 Thread Rolf Turner
On 21/03/2009, at 3:19 AM, Ravi Varadhan wrote: I also tried a number of other things including changing the "family", and parameters in "loess.control", but to no avail. I looked at the Fortran codes from both loess and gam. They are daunting, to say the least. They are dense, a

Re: [R] specifying repeated measures model in lmer

2009-03-23 Thread Douglas Bates
On Mon, Mar 23, 2009 at 2:35 PM, Lawrence Hanser wrote: > Dear Colleagues, > I have what Roger Kirk (Experimental Design: Procedures for the Behavioral > Sciences, 1968) refers to as a randomized block factorial design.  The anova > table would look like this: > >                      df > A      

Re: [R] Extracting SD of random effects from lme object

2009-03-23 Thread Douglas Bates
On Mon, Mar 23, 2009 at 2:18 PM, Kingsford Jones wrote: > On Mon, Mar 23, 2009 at 11:26 AM, Ben Domingue wrote: >> Hello, >> How do I get the standard deviations for the random effects out of the >> lme object?  I feel like there's probably a simple way of doing this, >> but I can't see it.  Usin

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread Greg Snow
There is also the clt.examp function in the TeachingDemos package. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Beha

[R] specifying repeated measures model in lmer

2009-03-23 Thread Lawrence Hanser
Dear Colleagues, I have what Roger Kirk (Experimental Design: Procedures for the Behavioral Sciences, 1968) refers to as a randomized block factorial design. The anova table would look like this: df A 3 Subj/A 103 (error term for A) B

Re: [R] Extracting SD of random effects from lme object

2009-03-23 Thread Ben Domingue
On Mon, Mar 23, 2009 at 1:18 PM, Kingsford Jones wrote: > On Mon, Mar 23, 2009 at 11:26 AM, Ben Domingue wrote: >> Hello, >> How do I get the standard deviations for the random effects out of the >> lme object?  I feel like there's probably a simple way of doing this, >> but I can't see it.  Usin

Re: [R] Extracting SD of random effects from lme object

2009-03-23 Thread Kingsford Jones
On Mon, Mar 23, 2009 at 11:26 AM, Ben Domingue wrote: > Hello, > How do I get the standard deviations for the random effects out of the > lme object?  I feel like there's probably a simple way of doing this, > but I can't see it.  Using the first example from the documentation: > >> fm1 <- lme(dis

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread Charles Annis, P.E.
Ivan: While you're figuring out how to execute the CLT in R you may find my automated examples informative. http://StatisticalEngineering.com/central_limit_theorem.htm Charles Annis, P.E. charles.an...@statisticalengineering.com phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngi

Re: [R] Basic regression output question

2009-03-23 Thread Kingsford Jones
On Mon, Mar 23, 2009 at 11:04 AM, GRANT Lewis wrote: [snip] > factors<-matrix(runif(400),nrow=40) > returns1<-matrix(runif(40),nrow=1) > returns2<-matrix(runif(2000),nrow=50) > coef(summary(lm(t(returns1)~factors)))[1,4] [snip] > (coef(summary(lm(t(returns2)~factors)))[50])[1,4] > > Error in `

Re: [R] Copying a subset of a matrix

2009-03-23 Thread akintayo holder
Thanks. That worked. On Mon, Mar 23, 2009 at 2:17 PM, Phil Spector wrote: > Suppose your matrix is called "x". Then > >x[,seq(1,ncol(x),n)] > > will give you what you want. > > - Phil Spector > Statistical Computin

Re: [R] Problems with combining plots

2009-03-23 Thread johnhj
Hii baptiste, I tried you example, but I get still one plot and not as you said two plots ... I use R for Windows, could this have something to do with this problem ? baptiste auguie-2 wrote: > > > On 23 Mar 2009, at 11:52, johnhj wrote: > >> >> I have still the same problem... As you said

Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jason Rupert
Phil and all, Thank you for the responses. That method worked great! However, I did try to replace the a few of the "Variables" using the same method and received an error... test_data2_df[test_data2_df$Location == 'HSV','Variables'] = "YardSize" Is there something special I need to do in

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread Peter Dalgaard
pfc_ivan wrote: I tried using the for (i..) to make 1000 differents sets of numbers, but then I dont know how to get the mean value of all of them... because I dont even think 1000 different sets of numbers were made, because when i print it it always shows me the same values, basically I dont kn

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread baptiste auguie
(a <- replicate(5,rnorm(10))) colMeans(a) should get you started. HTH, baptiste On 23 Mar 2009, at 18:29, pfc_ivan wrote: I tried using the for (i..) to make 1000 differents sets of numbers, but then I dont know how to get the mean value of all of them... because I dont even think 1000

[R] repeated measures specification in lmer

2009-03-23 Thread Lawrence Hanser
Dear Colleagues, I have what Roger Kirk (Experimental Design: Procedures for the Behavioral Sciences, 1968) refers to as a randomized block factorial design. The anova table would look like this: df A 3 Subj/A 103 (error term for A) B

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread pfc_ivan
I tried using the for (i..) to make 1000 differents sets of numbers, but then I dont know how to get the mean value of all of them... because I dont even think 1000 different sets of numbers were made, because when i print it it always shows me the same values, basically I dont know how to replica

Re: [R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread stephen sefick
homework? On Mon, Mar 23, 2009 at 1:30 PM, pfc_ivan wrote: > > Hello guys, I am stuck here: > > How do I make 1000 samples of n = 10 observations from an Exponential > distribution and then compute the mean for all those 1000 samples? > > Basically I need to prove the Central Limit theorem, which

[R] Copying a subset of a matrix

2009-03-23 Thread akintayo holder
Hi, I have a matrix and I want to create a matrix that includes every nth column of the original matrix. Does anyone know how I can go about doing that ? Or if you have an idea how I can do the same thing with a data frame ? If you can just point me towards the appropriate function I would apprecia

Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread baptiste auguie
On 23 Mar 2009, at 17:39, Jason Rupert wrote: I would like to replace a few varaibles within a data frame. For example, in the dataframe below (contrived) I would like to replace the current housesize value only if the Location is HSV. However, I would like to leave the other values int

Re: [R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jorge Ivan Velez
Dear Jason, Try this: index<- with(test_data2_df,Location %in% "HSV") test_data2_df$HouseSize<-ifelse(index,1000,test_data2_df$HouseSize) # I used 1000 as reference test_data2_df HTH, Jorge On Mon, Mar 23, 2009 at 1:39 PM, Jason Rupert wrote: > > I would like to replace a few varaibles withi

[R] Replacing a few variable values within a DataFrame...

2009-03-23 Thread Jason Rupert
I would like to replace a few varaibles within a data frame. For example, in the dataframe below (contrived) I would like to replace the current housesize value only if the Location is HSV. However, I would like to leave the other values intact. I tried "ifelse", but I don't really need

[R] How to set up a function for "Central Limit Theorem"

2009-03-23 Thread pfc_ivan
Hello guys, I am stuck here: How do I make 1000 samples of n = 10 observations from an Exponential distribution and then compute the mean for all those 1000 samples? Basically I need to prove the Central Limit theorem, which states: http://www.nabble.com/file/p22664113/d175f06cbf200bd52a2c27a2

[R] Extracting SD of random effects from lme object

2009-03-23 Thread Ben Domingue
Hello, How do I get the standard deviations for the random effects out of the lme object? I feel like there's probably a simple way of doing this, but I can't see it. Using the first example from the documentation: > fm1 <- lme(distance ~ age, data = Orthodont) # random is ~ age > fm1 Linear mix

[R] Fitting multiple Gaussians to data

2009-03-23 Thread Blake Sweeney
Hello, I am trying to fit several Gaussian distributions to a data set. I need to know the mean, standard deviation and maximum of each Gaussian. My data set is simply a list of signal strengths and no other information. I do not know the number of Guassians to fit. I've looked at some packages li

Re: [R] Looping of read.table and assignment

2009-03-23 Thread baptiste auguie
You need only one loop, year <- 1951:2000 filelist <- paste("C:\\Documents and Settings\\Data\ \table_",year,".txt", sep="") filelist for (ii in seq_along(year)) { assign(paste("table_", year[ii], sep=""), read.table(file=ifile[ii], header=TRUE, sep

[R] Basic regression output question

2009-03-23 Thread GRANT Lewis
Hi Probably a very basic question: I am regressing a matrix of 50 response variables against a matrix of 10 factors using the lm function. This gives me an object with the output for 50 regressions, as required. How do I now "use" the data? For example, below is some code that generates sample

Re: [R] Looping of read.table and assignment

2009-03-23 Thread Gabor Grothendieck
See: https://stat.ethz.ch/pipermail/r-help/2009-March/192422.html On Mon, Mar 23, 2009 at 12:52 PM, Steve Murray wrote: > > Dear all, > > I am trying to read in and assign data from 50 tables in an automated > fashion. I have the following code, which I created with the help of > textbooks and

Re: [R] Plot and Boxplot in the same graph

2009-03-23 Thread Greg Snow
Look at the symbols function or the subplot function in the TeachingDemos package (or my.symbols in TeachingDemos). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-bou

[R] Looping of read.table and assignment

2009-03-23 Thread Steve Murray
Dear all, I am trying to read in and assign data from 50 tables in an automated fashion. I have the following code, which I created with the help of textbooks and the internet, but it only seems to read in the final data file over and over again. For example, when I type:> table_1951 I get th

Re: [R] variance/mean

2009-03-23 Thread Bert Gunter
Inline Below. -- Bert Bert Gunter Genentech Nonclinical Biostatistics 650-467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Wacek Kusnierczyk Sent: Sunday, March 22, 2009 2:16 AM To: rkevinbur...@charter.net Cc: r-help@r-p

Re: [R] how to save a plot in a given size in inches or centimeters

2009-03-23 Thread David M Smith
On Mon, Mar 23, 2009 at 7:38 AM, Lo_Lo wrote: > I'm ploting graphics and I'd like to save them as a .jpeg file for example, > but with a given size (in inches or cm). > > I tryed the function windows() but I think it just changes the size of the > window and not the size of the graph that you're s

Re: [R] R: Multi-line texts in plots

2009-03-23 Thread Greg Snow
Look at the textplot function in the gplots package and the addtable2plot function in the plotrix package. Either of those make it easy to 'plot' a matrix. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > --

[R] aggregate() example fails

2009-03-23 Thread Kenneth Roy Cabrera Torres
Hi R users and developers. I compile the R version 2.8.1 Patched (2009-03-18 r48193) On my UBUNTU linux distribution. But hen I ask for the aggregate example it fails. What am I missing? example(aggregate) aggrgt> ## Compute the averages for the variables in 'state.x77', grouped aggrgt> ## ac

[R] R: how to estimate multidimensional spectral measure of coherence

2009-03-23 Thread mauede
Does it work on a sliding window ? Does it estimate the cospectrum (the real part) and the quadrature spectrum (complex), the coherence squared, and the phase difference between two vector time series ? SOme time ago I started to read its author's thesis. It seemed to me strictly tailored on the

[R] Scaled MPSE as a test for regressors?

2009-03-23 Thread Zhou Fang
Hi, This is really more a stats question than a R one, but Does anyone have any familiarity with using the mean prediction squared error scaled by the variance of the response, as a 'scale free' criterion for evaluating different regression algorithms. E.g. Generate X_train, Y_train, X_test

Re: [R] 'require' equivalent for local functions

2009-03-23 Thread JiHO
Thanks very much to everyone. I think I will use a combination of both techniques. On 2009-March-22 , at 20:08 , Duncan Murdoch wrote: That's pretty hard to make bulletproof. Why not just put those functions in a package, and use that package? I know it will be impossible to make bullet

Re: [R] how to estimate multidimensional spectral measure of coherence

2009-03-23 Thread stephen sefick
have you tried sowas? I know you had talked about it, but it may do what you want. I have used it for the wavelet cross spectrum. On Mon, Mar 23, 2009 at 9:47 AM, wrote: > Please, does anyone know of an R packge to estimate multidimensional spectral > measure of coherence within a moving time

[R] Problems with adapt

2009-03-23 Thread Cristian Angelo Guevara
Hi: I'm trying to estimate a model which involves the estimation of double integrals, so I'm using adapt procedure. I need to calculate the integrals trough my 2000 size database, so I do it using a loop. My code correctly estimates the integral for the first row, but for the second R crashes. I t

Re: [R] how to save a plot in a given size in inches or centimeters

2009-03-23 Thread stephen sefick
isn't there a width height argument in the jpeg function? ?jpeg I am probably wrong, Stephen Sefick On Mon, Mar 23, 2009 at 10:38 AM, Lo_Lo wrote: > > Hi there ! > > I'm ploting graphics and I'd like to save them as a .jpeg file for example, > but with a given size (in inches or cm). > > I tryed

Re: [R] using wavelet transform to calculate mean frequency of a signal

2009-03-23 Thread stephen sefick
global wavelet spectrum? There is something somewhere - I just can't remember where off the top of my head. Stephen Sefick On Sun, Mar 22, 2009 at 2:21 PM, stvienna wiener wrote: > Dear list, > > in short: I would like to calculate the mean frequency > of a signal (e.g. time series) using the w

[R] how to save a plot in a given size in inches or centimeters

2009-03-23 Thread Lo_Lo
Hi there ! I'm ploting graphics and I'd like to save them as a .jpeg file for example, but with a given size (in inches or cm). I tryed the function windows() but I think it just changes the size of the window and not the size of the graph that you're saving. Then I tryed with the function par

Re: [R] Iterative Proportional Fitting, use

2009-03-23 Thread Ravi Varadhan
Hi, Is this what you want? # mat <- matrix(c(65,4,22,24,6,81,5,8,0,11,85,19,4,7,3,90),4,4) rowmarg <- rep(100, nrow(mat)) # the row margin totals that you want colmarg <- c(90, 120, 80, 110) # the column margin totals that you want newmat <- loglin( outer(rowmarg, colmarg) / sum(rowmarg), ma

Re: [R] Problems with combining plots

2009-03-23 Thread baptiste auguie
On 23 Mar 2009, at 11:52, johnhj wrote: I have still the same problem... As you said I tried with par(mfrow=c(2,1)) and par(mfrow=c(1,2)) but without success. Could R compiler be the problem ? Why not? But may I suggest you try first the following example I sent you yesterday, pn

[R] how to estimate multidimensional spectral measure of coherence

2009-03-23 Thread mauede
Please, does anyone know of an R packge to estimate multidimensional spectral measure of coherence within a moving time window ? Some time ago I expeimented with a similar package that performs Cross Spectrum Analysis on the whole signal though. Unluckily I deal with non-stationary signals whose

Re: [R] Iterative Proportional Fitting, use

2009-03-23 Thread Koen Hufkens
The data I used was just an example to work upon. My real dataset is a confusion matrix of 24x24 (and 17x17), so coding it into a model with all different kinds of combinations seems tedious. That's why I hoped to use the ipf() function as it accepts a matrix as input. Thanks for the suggestion b

Re: [R] Iterative Proportional Fitting, use

2009-03-23 Thread Gerard M. Keogh
Keon, why not fit a loglinear independence model which as far as I know is the same. Gerard Here's an example from Agresti - Intro to Cat Data analysis Example: Alcohol, cigarette, marijuana use |--+--+| | Alcohol |

Re: [R] Problems with combining plots

2009-03-23 Thread johnhj
I have still the same problem... As you said I tried with par(mfrow=c(2,1)) and par(mfrow=c(1,2)) but without success. Could R compiler be the problem ? Wills, Kellie wrote: > > par(mfrow=c(1,1)) will give you just one panel. Try par(mfrow=c(2,1)) or > par(mfrow=c(1,2)). > > > -Original

[R] help

2009-03-23 Thread Dominique Katshunga
Dear R-users, Can someone help understand why in the following example R would return a negative value for the last parameter when I have constrained it to be positive and greater than or equal to 0.01? > nlminb(start=initial value,objective=some function, > lower=c(-Inf,-Inf,-Inf,0.01),upper=

Re: [R] fisher.test - FEXACT error 7

2009-03-23 Thread Frank E Harrell Jr
Bernardo Rangel Tura wrote: On Fri, 2009-03-20 at 18:29 +, Helena Mouriño wrote: Dear all, Im having an awkward problem in R. When I write the command Fisher.test(school.data,workspace=2e+07), where school.data is the matrix corresponding to the data set, I get the error message: FEXAC

[R] Iterative Proportional Fitting, use

2009-03-23 Thread Koen Hufkens
Hi list, I would like to normalize a matrix (two actually for comparison) using iterative proportional fitting. Using ipf() would be the easiest way to do this, however I can't get my head around the use of the function. More specifically, the margins settings... for a matrix: mat <- matrix(c(6

Re: [R] Capitalizing first letter of word or phrase

2009-03-23 Thread Gabor Grothendieck
See examples on ?toupper page. On Mon, Mar 23, 2009 at 8:03 AM, Daren Tan wrote: > I managed to find toupper() which translates all letters to uppercase. > Is there a function to capitalize only the first letter of word or > phrase ? > > Thanks > > __ >

[R] Capitalizing first letter of word or phrase

2009-03-23 Thread Daren Tan
I managed to find toupper() which translates all letters to uppercase. Is there a function to capitalize only the first letter of word or phrase ? Thanks __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] subset and "or" operator

2009-03-23 Thread Erich Neuwirth
subset(table, year %in% c(1995,1998,2000))-->table2 > Hello, > I'm trying to subset a dataframe where I have many observation taken in > different years. > I would like to subset the dataframe (in this example called "table") to get > a new dataframe containing only the > observation of year 19

Re: [R] newton method

2009-03-23 Thread Rau, Roland
Hi, you might be also interested in a general overview as given here: http://cran.r-project.org/web/views/Optimization.html Hope this helps, Roland > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Kubovy > Sent: Mond

Re: [R] any package for connecting berkeley db in R?

2009-03-23 Thread Bernardo Rangel Tura
On Fri, 2009-03-20 at 17:23 -0400, Zheng, Xin (NIH) [C] wrote: > Hi there, > > Is there any such package? I searched but found none. Thanks in advance. > > Xin Zheng > Hi Xin Do you try package DBI? -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __

[R] subset and "or" operator

2009-03-23 Thread lauramorg...@bluewin.ch
Hello, I'm trying to subset a dataframe where I have many observation taken in different years. I would like to subset the dataframe (in this example called "table") to get a new dataframe containing only the observation of year 1995, 1998 and 2000. I've tried to use subset and the or operator "

Re: [R] fisher.test - FEXACT error 7

2009-03-23 Thread Bernardo Rangel Tura
On Fri, 2009-03-20 at 18:29 +, Helena Mouriño wrote: > Dear all, > > Im having an awkward problem in R. When I write the command > Fisher.test(school.data,workspace=2e+07), where school.data is the matrix > corresponding to the data set, > I get the error message: > FEXACT error 7. > LDSTP

Re: [R] How to get commands history as a character vector instead of displaying them?

2009-03-23 Thread Wacek Kusnierczyk
Romain Francois wrote: > Yihui Xie wrote: >> Hi Everyone, >> >> I want to get the commands history as a character vector instead of >> just displaying them, but the function history() just returns NULL. I >> checked the source code of 'history' and could not find a solution. >> Anybody has an idea?

Re: [R] Efficiently create dummy

2009-03-23 Thread Chuck Cleland
On 3/23/2009 5:44 AM, Rob Denniker wrote: > What's the neat way to create a dummy from a list? > The code below is not replicable, but hopefully self-explanatory... > > d$treatment<-rep(1,length(d)) > > notreat<-c("AR", "DE", "MS", "NY", "TN", "AK", "LA", "MD", "NC", "OK", "UT", > "VA") > > #i

  1   2   >