Re: [R] Simulation

2009-05-13 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: [...] >>> Yes, you can probably vectorize this with lapply or something, but I >>> prefer clarity over concision when dealing with beginners... >>> >> but where's the preferred clarity in the for loop solution? >> > > Seriously? You think: > > lapply(1:n, rno

Re: [R] Finding root using Newton's method

2009-05-13 Thread Daniel Malter
Homework? - see your instructor! Otherwise, provide minimal self-contained code and show us where you are stuck. - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]

Re: [R] Simulation

2009-05-13 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: > On Wed, May 13, 2009 at 9:56 PM, Wacek Kusnierczyk > wrote: > >> Barry Rowlingson wrote: >> > > >>n = 1000 >>benchmark(columns=c('test', 'elapsed'), order=NULL, >> 'for'={ l = list(); for (i in 1:n) l[[i]] = rnorm(i, 0, 1) }, >> lapply=lappl

Re: [R] Duplicates and duplicated

2009-05-13 Thread Linlin Yan
On Thu, May 14, 2009 at 2:16 PM, christiaan pauw wrote: > Hi everybody. > I want to identify not only duplicate number but also the original number > that has been duplicated. > Example: > x=c(1,2,3,4,4,5,6,7,8,9) > y=duplicated(x) > rbind(x,y) > > gives: >    [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,

Re: [R] R Tools To Evaluate Confidence Interval

2009-05-13 Thread J Dougherty
On Wednesday 13 May 2009 10:54:01 pm Peverall Dubois wrote: > Hi, > > Suppose I have a calculation that contain an estimation > of certain value and its confidence interval > (this is computed via Chi Square approximation). > > Is there any approach in R in which we can > evaluate the confidence in

[R] Duplicates and duplicated

2009-05-13 Thread christiaan pauw
Hi everybody. I want to identify not only duplicate number but also the original number that has been duplicated. Example: x=c(1,2,3,4,4,5,6,7,8,9) y=duplicated(x) rbind(x,y) gives: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] x123445678 9 y0

[R] Finding root using Newton's method

2009-05-13 Thread Harry P
I want generate R code to determine the real root of the polynomial x^3-2*x^2+3*x-5. Using an initial guess of 1 with Newton's method. Help please... -- View this message in context: http://www.nabble.com/Finding-root-using-Newton%27s-method-tp23534519p23534519.html Sent from the R help mailing

Re: [R] Graphical output format

2009-05-13 Thread Daniel Malter
Hi, postscript should do, "*.eps" specifically. x=rnorm(100,0,1) e=rnorm(100,0,1) y=x+e postscript("myeps.eps") plot(y~x) dev.off() Cheers, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.or

Re: [R] Simulation

2009-05-13 Thread Dimitris Rizopoulos
Wacek Kusnierczyk wrote: Barry Rowlingson wrote: On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk wrote: Barry Rowlingson wrote: Soln - "for" loop: > z=list() > for(i in 1:1000){z[[i]]=rnorm(100,0,1)} now inspect the individual bits: > hist(z[[1]]) > hist(z[[545]]) If that's the pr

Re: [R] creating a postscript file with two xyplots

2009-05-13 Thread Duncan Mackay
Hi What you need to do is to specify where your plots are going on the page. This can depend on the graphics package used To start you going if you are using the base graphics:- plot etc see ?layout For lattice see ?viewports for a start. HTH Duncan Mackay Department of Agronomy and Soil Scie

[R] R Tools To Evaluate Confidence Interval

2009-05-13 Thread Peverall Dubois
Hi, Suppose I have a calculation that contain an estimation of certain value and its confidence interval (this is computed via Chi Square approximation). Is there any approach in R in which we can evaluate the confidence interval? - GV __ R-help@r-pro

[R] Graphical output format

2009-05-13 Thread Stats Wolf
Dear colleagues, Saving a plot with pdf gives a very nice result: pdf("myplot.pdf") par(font=1,family='serif') plot(pressure) dev.off() Doing the very same with other formats (png, jpeg, tiff) gives far worse results. Is there anything to do to make a plot in some other format than pdf look like

Re: [R] creating a postscript file with two xyplots

2009-05-13 Thread Liati
Hi, Thank you for your reply. This is exactly what I have done. However, I would like to get the two plots next to each other (to use as one figure). At the moment the two plots are on two different pages. my ps is set as: postscript(file = "myRplot.ps",bg="transparent",pointsize=1.0,

Re: [R] Plot bivariate joint pdf

2009-05-13 Thread beetle2
Hi All, Thankyou for your sugestions, I Look through some other posts and learnt about the persp() function. So I ended up using; x <- seq(0, 1, len = 20) y <- seq(0, 1, len = 20) model = function (x, y){ x+y} z=outer(x, y ,model); persp(x,y,z,theta=30,phi=30,ticktype="detailed") Worked a rea

Re: [R] Specifying data type when creating a dataframe using RODBC

2009-05-13 Thread J Dougherty
On Tuesday 12 May 2009 02:59:30 pm Mark Na wrote: > H R-helpers, > ... > > One column (several, actually) in the spreadsheet contains integers in > its first few rows but later values in these columns contain a mixture > of numbers, letters and symbols (it's an ID variable, containing e.g., > 12, 1

Re: [R] SQL Queries from Multiple Servers

2009-05-13 Thread Jeff Newmiller
Tom Schenk Jr wrote: I use RODBC as my conduit from R to SQL. It works well when the tables are stored on one channel, e.g., channel <- odbcConnect("data_base_01", uid="", dsn="") However, I often need to match tables across multiple databases, e.g., "data_base_01" and "data_base_02". H

Re: [R] Block factor as random or fixed effect?

2009-05-13 Thread Ben Bolker
Robert A LaBudde wrote: > > At 05:49 PM 5/13/2009, Rob Knell wrote: >>People >> >>I apologise for asking a general stats question, but I'm at a bit of a >>loss as to what to do following some hostile referees' comments. If I >>have a fully randomised blocked design, with only three blocks, shou

Re: [R] Can anyone suggest some r packages for Experimental Designs, specifically for choice and conjoint??? (or is intersted in helping me make 1)

2009-05-13 Thread Michael Kubovy
There are quite a few others. See: http://cran.r-project.org/web/views/ExperimentalDesign.html On May 12, 2009, at 7:44 PM, Chris Howden wrote: > I've spent the last week or so looking at all the experimental design > packages I can find in R. AlgDesign, design.conf and BHH2 being the > best o

Re: [R] scatterplot3d

2009-05-13 Thread Nair, Murlidharan T
Does anyone have any suggestion on this? I tried par(new="T") It does not seem to work with scatterplot3d. Any suggestion is appreciated. Cheers../Murli -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nair, Murlidharan T Sent: Wed

Re: [R] matching period with perl regular expression

2009-05-13 Thread Bill.Venables
You have the arguments out of line and you need two backslashes: > x <- "wa.w" > gsub("\\..*", "", x) [1] "wa" > Bill Venables http://www.cmis.csiro.au/bill.venables/ -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Stephen J.

[R] plotting multiple data sources

2009-05-13 Thread myshare
hi, Excuse me asking three questions in a row for a day, but I had collected those questions as I'm still experimenting with R. This one is how do you compose plots with alot of data in one graph. First what I currently do is after i generated all the data I need to plot.. let say 5-6 arrays I do

Re: [R] matching period with perl regular expression

2009-05-13 Thread Ted Harding
On 13-May-09 23:47:41, Henrique Dallazuanna wrote: > Try this: > > gsub("^(\\w*).*$", "\\1", x) Even simpler: x # [1] "wa.w" gsub("\\..*","",x,perl=TRUE) # [1] "wa" x<-"abcde.fghij.klmno" gsub("\\..*","",x,perl=TRUE) # [1] "abcde" (and it doesn't matter whether 'perl' is TRUE or FALSE)

Re: [R] matching period with perl regular expression

2009-05-13 Thread Gabor Grothendieck
R interprets backslash to give special meaning to the next character, i.e. it strips off the backslash and send the following character to gsub possibly reinterpreting it specially (for example \n is newline). Thus a backslash will never get to gsub unless you use a double backslash. Thus we can u

Re: [R] matching period with perl regular expression

2009-05-13 Thread Henrique Dallazuanna
Try this: gsub("^(\\w*).*$", "\\1", x) On Wed, May 13, 2009 at 8:41 PM, Stephen J. Barr wrote: > Hello, > > I have several strings where I am trying to eliminate the period and > everything after the period, using a regular expression. However, I am > having trouble getting this to work. > > > x

[R] matching period with perl regular expression

2009-05-13 Thread Stephen J. Barr
Hello, I have several strings where I am trying to eliminate the period and everything after the period, using a regular expression. However, I am having trouble getting this to work. > x = "wa.w" > gsub(x, "\..*", "", perl=TRUE) [1] "" Warning messages: 1: '\.' is an unrecognized escape in a cha

Re: [R] Object and Classes ?

2009-05-13 Thread Gabor Grothendieck
In S3 you pass the object as the first argument of the method (rather than prefixing the method with the object as is common in other languages). When you call a method you write method(obj, ...whatever...) # correct and it automatically inspect the class of obj and if its class is Blah then it d

[R] Object and Classes ?

2009-05-13 Thread myshare
I found a tutorial for creating classes using generic functions ? S3 way ! It was short description so I couldn't grok in full its usage ... So far so good, what i currently do is something like this : Blah <- function(data,...) UseMethod('Blah') Blah.default <- function( .. ) { self = ..

Re: [R] Dates and arrays

2009-05-13 Thread Gabor Grothendieck
There is a one line nextfri function defined in the zoo-quickref vignette and replacing 5 with 1 in its definition will give you next Monday. The prior Monday is 7 days before that so take the closest of the two. See R News 4/1 for more about dates. On Wed, May 13, 2009 at 4:23 PM, myshare wro

Re: [R] Dates and arrays

2009-05-13 Thread jim holtman
On Wed, May 13, 2009 at 4:23 PM, myshare wrote: > hi, > > I have a and data frame with date-column and some other columns. > My first question is what is the fastest way to get the index of an > array if I know the value f.e > > > x = c(4,5,6,7,8) > > so i know the value is 6.. i.e. the index is

Re: [R] Simulation

2009-05-13 Thread Rolf Turner
On 14/05/2009, at 10:04 AM, Carl Witthoft wrote: So far nobody seems to have warned the OP about seeding. Presumably Debbie wants 1000 different sets of samples, but as we all know there are ways to get the same sequence (initial seed) every time. If there's a starting seed for one of the

[R] Optimization algorithm to be applied to S4 classes - specifically sparse matrices

2009-05-13 Thread Avraham . Adler
Hello. I am trying to optimize a set of parameters using /optim/ in which the actual function to be minimized contains matrix multiplication and is of the form: SUM ((A%*%X - B)^2) where A is a matrix and X and B are vectors, with X as parameter vector. This has worked well so far. Recently, I

Re: [R] Block factor as random or fixed effect?

2009-05-13 Thread Robert A LaBudde
At 05:49 PM 5/13/2009, Rob Knell wrote: People I apologise for asking a general stats question, but I'm at a bit of a loss as to what to do following some hostile referees' comments. If I have a fully randomised blocked design, with only three blocks, should I treat block as a random or fixed ef

Re: [R] Simulation

2009-05-13 Thread Barry Rowlingson
On Wed, May 13, 2009 at 9:56 PM, Wacek Kusnierczyk wrote: > Barry Rowlingson wrote: >    n = 1000 >    benchmark(columns=c('test', 'elapsed'), order=NULL, >       'for'={ l = list(); for (i in 1:n) l[[i]] = rnorm(i, 0, 1) }, >       lapply=lapply(1:n, rnorm, 0, 1) ) >    #     test elapsed >    #

Re: [R] Simulation

2009-05-13 Thread Carl Witthoft
So far nobody seems to have warned the OP about seeding. Presumably Debbie wants 1000 different sets of samples, but as we all know there are ways to get the same sequence (initial seed) every time. If there's a starting seed for one of the "generate a single giant matrix" methods proposed, t

[R] SQL Queries from Multiple Servers

2009-05-13 Thread Tom Schenk Jr
I use RODBC as my conduit from R to SQL. It works well when the tables are stored on one channel, e.g., channel <- odbcConnect("data_base_01", uid="", dsn="") However, I often need to match tables across multiple databases, e.g., "data_base_01" and "data_base_02". However, odbcConnect() a

[R] Block factor as random or fixed effect?

2009-05-13 Thread Rob Knell
People I apologise for asking a general stats question, but I'm at a bit of a loss as to what to do following some hostile referees' comments. If I have a fully randomised blocked design, with only three blocks, should I treat block as a random or fixed effect? I have read comments about

[R] question about setClass

2009-05-13 Thread Erin Hodgess
Hi R People: I have a question about setClass please. I'm working thru "R Programming for Bioinformatics". Actually, I was wondering if there is such a thing as an updateClass, in order to change a "contains" option, please? that is, if I had setClass("dog", representation(name="character",paw

Re: [R] Overlaying two plots

2009-05-13 Thread Greg Snow
Try using the subplot function from the TeachingDemos package. 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-boun...@r-project.org [mailto:r-help-boun...@r- > projec

Re: [R] [OT?]R Reference Manual review/recommend

2009-05-13 Thread Luc Villandre
AG wrote: Hello all I am looking to learn R and was thumbing through volume 1 of "R reference manual - Base Package". I'm sorry if this is ludicrously silly to ask, but is this book worth the investment as a good way to learn how to use R? AG _

Re: [R] Simulation

2009-05-13 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: > On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk > wrote: >> Barry Rowlingson wrote: > >>> Soln - "for" loop: >>> >>> > z=list() >>> > for(i in 1:1000){z[[i]]=rnorm(100,0,1)} >>> >>> now inspect the individual bits: >>> >>> > hist(z[[1]]) >>> > hist(z[[545]]) >>> >

[R] [OT?]R Reference Manual review/recommend

2009-05-13 Thread AG
Hello all I am looking to learn R and was thumbing through volume 1 of "R reference manual - Base Package". I'm sorry if this is ludicrously silly to ask, but is this book worth the investment as a good way to learn how to use R? AG __ R-help@r-

[R] June R/Splus Courses: Nationwide Back2back (1) R/S+ Fundamentals and (2) R/S-Plus Advanced Programming. in San Francisco, New York City, Boston, Washington DC, Seattle and Salt Lake City

2009-05-13 Thread Sue Turner
By popular demand, XLSolutions has scheduled second back2back courses in New York City, San Francisco, Boston, Washington DC, Seattle and Salt Lake City. Taught by top R/S+ gurus! This is a second in our 9 years of teaching R/Splus Courses. West Coast<---back2back---> East Coast (1) R/S-

Re: [R] silhouette: clustering labels have to be consecutive integers starting

2009-05-13 Thread Tao Shi
Thanks, Martin! ...Tao > From: maech...@stat.math.ethz.ch > Date: Wed, 13 May 2009 14:13:48 +0200 > To: shi...@hotmail.com > CC: rip...@stats.ox.ac.uk; bcarv...@jhsph.edu; r-help@r-project.org; > maech...@stat.math.ethz.ch > Subject: Re: [R] silhouette: clustering labels have to be consecutive

Re: [R] Input to variables - help please

2009-05-13 Thread Luc Villandre
Steve Sidney wrote: Hi Luc Many thanks for the suggestions. I will take a look at them as soon as I can. Are the functions standard or are they part of a function and if so which one? Regards Steve - Original Message - From: "Luc Villandre" To: "Steve Sidney" Cc: Sent: Wednesda

Re: [R] Input to variables - help please

2009-05-13 Thread Steve Sidney
Hi Luc Many thanks for the suggestions. I will take a look at them as soon as I can. Are the functions standard or are they part of a function and if so which one? Regards Steve - Original Message - From: "Luc Villandre" To: "Steve Sidney" Cc: Sent: Wednesday, May 13, 2009 10:10

[R] Dates and arrays

2009-05-13 Thread myshare
hi, I have a and data frame with date-column and some other columns. My first question is what is the fastest way to get the index of an array if I know the value f.e > x = c(4,5,6,7,8) so i know the value is 6.. i.e. the index is 3. What I currently do is loop over the array, I was thinking if

Re: [R] Input to variables - help please

2009-05-13 Thread Ted Harding
On 13-May-09 19:49:35, Steve Sidney wrote: > Dear list > I have managed to write a short program to evaluate data which is > inputted from a csv file using the following > > x = read.csv("wms_results.csv", header=TRUE) > > All works fine but since I have a number of similar data files which > hav

[R] Overlaying two plots

2009-05-13 Thread dxc13
Hi useR's, I want to overlay an image plot over a world map and I can do it, but just not the way I need to do it. Here is the code I am using (with data file attached) to create my baseline map: library(sp) load("TM_WORLD_BORDERS_SIMPL-0.2.RData") par(bty="l") plot(wrld_simpl, axes = TRUE, ylim

Re: [R] Input to variables - help please

2009-05-13 Thread Luc Villandre
Steve Sidney wrote: Dear list I have managed to write a short program to evaluate data which is inputted from a csv file using the following x = read.csv("wms_results.csv", header=TRUE) All works fine but since I have a number of similar data files which have different names, I would like th

Re: [R] Checking a (new) package - examples require other package functions

2009-05-13 Thread Tony Plate
Did you try putting library("your-package-name", char=TRUE) at the start of the examples? -- Tony Plate Rebecca Sela wrote: I am creating an R package. I ran R CMD check on the package, and everything passed until it tried to run the examples. Then, the result was: * checking examples ..

[R] Input to variables - help please

2009-05-13 Thread Steve Sidney
Dear list I have managed to write a short program to evaluate data which is inputted from a csv file using the following x = read.csv("wms_results.csv", header=TRUE) All works fine but since I have a number of similar data files which have different names, I would like the program to allow me t

[R] scatterplot3d

2009-05-13 Thread Nair, Murlidharan T
Hi!! I am interested in plotting 3 different (x,y,z) coordinate sets on the same plot. How do I achieve using scatterplot3d? Is there an easy method to call to change the projection or rotate the figure along a particular axis? The following is the code that plots if one at a time. Any help i

Re: [R] AFT-model with time-dependent covariates

2009-05-13 Thread spencerg
To see what's available in other packages, try the following: library(RSiteSearch) AFT <- RSiteSearch.function('AFT model') summary(AFT) # 24 help files found in 8 different packages HTML(AFT) # opens a table with 24 rows in a web browser. There may be nothing here that will help you,

[R] simple anova question

2009-05-13 Thread AllenL
Dear R group, Simple anova question: I am attempting to recreate a figure (from chapter 10 of "Mordern Statistics for the Life Sciences", chapter 10, figure 10.8). It is an interaction diagram plotting BYIELD (continuous) as a function of BSPACING (categorical) with different lines/colours for an

Re: [R] Multiple plot margins

2009-05-13 Thread Greg Snow
Here is a response to almost exactly the same question from a couple of weeks ago: http://finzi.psych.upenn.edu/R/Rhelp08/2009-April/196967.html -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > F

[R] Mann-Kendall test

2009-05-13 Thread Rafael Moral
Dear useRs, I've been trying to run a Mann-Kendall test in my data in order to detect trends. I studied the examples given at the Kendall package and I can understand pretty well how it works on time-series data. However, my data consists of values in different sites per year, as I display belo

Re: [R] Calling R from .net environment

2009-05-13 Thread Hutchinson,David [PYR]
Take a look at this article on CodeProject: http://www.codeproject.com/KB/cs/RtoCSharp.aspx Cheers, Dave -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Arun Kumar Saha Sent: Wednesday, May 13, 2009 10:33 AM To: r-h...@stat.math.e

[R] replace() help

2009-05-13 Thread Crosby, Jacy R
Can anyone see what I'm doing wrong here (highlighted below)? This is driving me crazy... probably a ')' or something equally moronic... > genw1[,1] A2 A3 A5 A7 A9 A00010 A00012 A00013 A00014 A00015 A00017 A00018 A00019 A00021 A00023 A00024 CC CC CC CC CC

[R] Checking a (new) package - examples require other package functions

2009-05-13 Thread Rebecca Sela
I am creating an R package. I ran R CMD check on the package, and everything passed until it tried to run the examples. Then, the result was: * checking examples ... ERROR Running examples in REEMtree-Ex.R failed. The error most likely occurred in: > ### * AutoCorrelationLRtest > > flush(stde

Re: [R] Anova

2009-05-13 Thread Gavin Simpson
On Wed, 2009-05-13 at 12:43 -0400, stephen sefick wrote: > melt.updn <- structure(list(date = structure(c(11808, 11869, 11961, 11992, > 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, > 13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, > 12600, 12631, 12753, 12996, 13057

Re: [R] Simulation

2009-05-13 Thread Barry Rowlingson
On Wed, May 13, 2009 at 5:36 PM, Wacek Kusnierczyk wrote: > Barry Rowlingson wrote: >>  Soln - "for" loop: >> >>  > z=list() >>  > for(i in 1:1000){z[[i]]=rnorm(100,0,1)} >> >> now inspect the individual bits: >> >>  > hist(z[[1]]) >>  > hist(z[[545]]) >> >> If that's the problem, then I suggest

[R] Calling R from .net environment

2009-05-13 Thread Arun Kumar Saha
Hi, Currently I am a .net programmer and would like to use R for my statistical computations engine. I already have installed RServer250.exe so that I could call R from my .net programming environment, however unfortunately, i could not be able to find RServer250.exe in the R-(D) COM Interface reg

Re: [R] Multiple plot margins

2009-05-13 Thread Andre Nathan
On Wed, 2009-05-13 at 11:22 +0200, Uwe Ligges wrote: > If not, example: > > par(mfrow = c(2,3), mar = c(0,0,0,0), oma = c(5,5,0,0), xpd=NA) > plot(1, xaxt="n", xlab="", ylab="A") > plot(1, xaxt="n", yaxt="n", xlab="", ylab="") > plot(1, xaxt="n", yaxt="n", xlab="", ylab="") > plot(1, xlab="I", yla

[R] Anova

2009-05-13 Thread stephen sefick
melt.updn <- structure(list(date = structure(c(11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149, 11808, 11869, 11961, 11992, 12084, 12173, 12265, 12418, 12600, 12631, 12753, 12996, 13057, 13149), class = "Date"), variable = structure(c(1L, 1L, 1L, 1L,

Re: [R] Looking for a quick way to combine rows in a matrix

2009-05-13 Thread Chris Stubben
You can automate this step >key[key == "AT"] <- "TA" ## create a function to reverse a string -- see strsplit help page for this strReverse function reverse <- function(x) sapply(lapply(strsplit(x, NULL), rev), paste, collapse="") key <- rownames(a) # combine rownames with reverse (rownames) n<-

Re: [R] ode first step

2009-05-13 Thread Dieter Menne
Benoit Boulinguiez ensc-rennes.fr> writes: > I try to assess the parameters (K1,K2) of a model that describes the > adsorption of a molecule onto on adsorbent. > > equation: dq/dt = K1*C*(qm-q)-K2*q > > I know the value of 'qm' and I experimentally measure the variables 'q', > 'C', and the time

Re: [R] Simulation

2009-05-13 Thread Wacek Kusnierczyk
Barry Rowlingson wrote: > On Wed, May 13, 2009 at 4:26 PM, Gábor Csárdi wrote: > >> On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang wrote: >> >>> Dear R users, >>> >>> Can anyone please tell me how to generate a large number of samples in R, >>> given certain distribution and size. >>> >>>

[R] Centering R output in Sweave/LaTeX

2009-05-13 Thread Jean-Louis Abitbol
Good Day to All, When sweaving the following: \begin{table} \centering <>= ftable(ifmtm$type, ifmtm$gender, ifmtm$marche , ifmtm$nfic, dnn=c("Type","Gender","Ambulant","Visit")) @ \caption{Four-way cross-tabulation on all data} \label{tab:crosstab} \end{table} the output of ftable is not centere

Re: [R] limits

2009-05-13 Thread Gabor Grothendieck
Try the rSymPy or Ryacas packages. In the rSymPy code below the var command defines x as symbolic to sympy and then we perform the computation: > library(rSymPy) Loading required package: rJava > sympy("var('x')") [1] "x" > sympy("limit(x*x + x + 2, x, 2)") [1] "8" Or using devel version define

[R] ode first step

2009-05-13 Thread Benoit Boulinguiez
Hi all, I try to assess the parameters (K1,K2) of a model that describes the adsorption of a molecule onto on adsorbent. equation: dq/dt = K1*C*(qm-q)-K2*q I know the value of 'qm' and I experimentally measure the variables 'q', 'C', and the time 't'. t C q 1 0 144.0

Re: [R] Simulation

2009-05-13 Thread Linlin Yan
Does every 100 numbers in rnorm(100 * 1000, 0, 1) have the N(0,1) distribution? On Wed, May 13, 2009 at 11:13 PM, Debbie Zhang wrote: > > > Dear R users, > > Can anyone please tell me how to generate a large number of samples in R, > given certain distribution and size. > > For example, if I wan

Re: [R] Problems with randomly generating samples

2009-05-13 Thread Ted Harding
On 13-May-09 15:18:05, Debbie Zhang wrote: > Dear R users, > Can anyone please tell me how to generate a large number of samples in > R, given certain distribution and size. > For example, if I want to generate 1000 samples of size n=100, with a > N(0,1) distribution, how should I proceed? > (Sinc

Re: [R] Help with reshape/reShape and indexing

2009-05-13 Thread Dana Sevak
To all of you who answered me: Thank you so much! Each approach taught me something new and I really appreciate your help! Best regards, Dana Sevak __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] Simulation

2009-05-13 Thread Jorge Ivan Velez
Dear Debbie, Here are two options: # Parameters N <- 1000 n <- 100 # Option 1 mys <- replicate(N, rnorm(n)) mys # Option 2 mys2 <- matrix(rnorm(N*n),ncol=N) mys2 HTH, Jorge On Wed, May 13, 2009 at 11:13 AM, Debbie Zhang wrote: > > > Dear R users, > > Can anyone please tell me how to generat

Re: [R] Simulation

2009-05-13 Thread Barry Rowlingson
On Wed, May 13, 2009 at 4:26 PM, Gábor Csárdi wrote: > On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang wrote: >> >> >> Dear R users, >> >> Can anyone please tell me how to generate a large number of samples in R, >> given certain distribution and size. >> >> For example, if I want to generate 1000

Re: [R] limits

2009-05-13 Thread Mike Prager
Uwe Ligges wrote: > So you want some software that can do symbolic calculations? In that > case use other software. R is designed for numerical analyses. In particular, if you are looking for good free software, you might try Maxima. -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed ar

Re: [R] Simulation

2009-05-13 Thread Mike Lawrence
If you want k samples of size n, why generate k*n samples and put them in a k-by-n matrix where you can do what you want to each sample: k = 10 n = 100 x=matrix(rnorm(k*n),k,n) rowMeans(x) If you need to do more complex things to each sample and if k is large enough that you don't want the matrix

Re: [R] Simulation

2009-05-13 Thread Dimitris Rizopoulos
what about putting in a matrix, e.g., matrix(rnorm(1000*100), 1000, 100) I hope it helps. Best, Dimitris Debbie Zhang wrote: Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 10

Re: [R] Problems with randomly generating samples

2009-05-13 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Debbie Zhang > Sent: Wednesday, May 13, 2009 8:18 AM > To: r-help@r-project.org > Subject: [R] Problems with randomly generating samples > > > Dear R users, > Can anyone please t

Re: [R] Simulation

2009-05-13 Thread Gábor Csárdi
On Wed, May 13, 2009 at 5:13 PM, Debbie Zhang wrote: > > > Dear R users, > > Can anyone please tell me how to generate a large number of samples in R, > given certain distribution and size. > > For example, if I want to generate 1000 samples of size n=100, with a N(0,1) > distribution, how shoul

[R] Problems with randomly generating samples

2009-05-13 Thread Debbie Zhang
Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed? (Since I dont want to do "rnorm(100,0,1)" in R for 1000 t

[R] Simulation

2009-05-13 Thread Debbie Zhang
Dear R users, Can anyone please tell me how to generate a large number of samples in R, given certain distribution and size. For example, if I want to generate 1000 samples of size n=100, with a N(0,1) distribution, how should I proceed? (Since I dont want to do "rnorm(100,0,1)" in R for 10

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Liaw, Andy
A few points to consider: - If all the data are numeric, then use matrices instead of data frames. - With either data frames or matrices, there is no way (that I'm aware of anyway) in R to stack them without making at least one copy in memory. - Since none of the files has a header row, I would

Re: [R] where does the null come from?

2009-05-13 Thread Ted Harding
On 13-May-09 14:43:17, Gabor Grothendieck wrote: >> out <- apply(m, 1, cat, '\n') > 1 3 > 2 4 >> out > NULL Or, more explicitly, from ?cat : Value: None (invisible 'NULL'). Ted. > On Wed, May 13, 2009 at 5:23 AM, Wacek Kusnierczyk > wrote: >> _ _m = matrix(1:4, 2) >> >> _ _apply(m,

[R] Histogram + % of cases for a given criteria

2009-05-13 Thread S. Nunes
Hi all, I am doing some explorations using a dataset with the following structure (id, value, flag). For instance: a, 2.2, 1 b, 3.0, 1 c, 2.9, 0 d, 3.1, 1 ... I have plotted a standard histogram using a simple command like: hist(data$value) My question: I would like to superimpose a line ([0%-

[R] Histogram + % of cases for a given criteria

2009-05-13 Thread S. Nunes
Hi all, I am doing some explorations using a dataset with the following structure (id, value, flag). For instance: a, 2.2, 1 b, 3.0, 1 c, 2.9, 0 d, 3.1, 1 ... I have plotted a standard histogram using a simple command like: hist(data$value) My question: I would like to superimpose a line ([0%-

Re: [R] where does the null come from?

2009-05-13 Thread Gabor Grothendieck
> out <- apply(m, 1, cat, '\n') 1 3 2 4 > out NULL On Wed, May 13, 2009 at 5:23 AM, Wacek Kusnierczyk wrote: >    m = matrix(1:4, 2) > >    apply(m, 1, cat, '\n') >    # 1 2 >    # 3 4 >    # NULL > > why the null? > > vQ > > __ > R-help@r-project.or

Re: [R] name siz ein cluster

2009-05-13 Thread Penner, Johannes
I tried for example: Plot(mycluster, font=2) But this changes only the font size of the y-axis. Regards Johannes -- Project Coordinator BIOTA West Amphibians Museum of Natural History Dep. of Research (Herpetology) Invalidenstrasse 43 D-10115 Berlin Tel: +49 (0)30 2093 8708 Fax: +49 (0)30 2093

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Simon Pickett
can you provide reproducible code please? even a fake example would help. I would 1) set up a loop to read in each file from a directory 2) inside the loop chop up/ aggregate the data, each file in turn and spit each new aggreagated file out to a directory using write.table(). This will redu

Re: [R] access to the current element of lapply

2009-05-13 Thread Marc Schwartz
On May 13, 2009, at 9:12 AM, Martial Sankar wrote: Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : (df <- data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 (L<-split(df, df$X1

Re: [R] name siz ein cluster

2009-05-13 Thread Simon Pickett
I'm afraid I have no experience with the clue package, but if all else fails you could consider the hclust package. You change font size in the conventional way with this. Cheers, Simon. - Original Message - From: "Penner, Johannes" To: Sent: Wednesday, May 13, 2009 3:08 PM Subjec

[R] rpart - not for classification?

2009-05-13 Thread Dimitri Liakhovitski
Hello! I very minor point. I typed help.search("classification"). It found a bunch of things including "randomForests" - which makes a lot sense. I am wondering why "rpart" was not found. I think - it should make sense too. -- Dimitri Liakhovitski MarketTools, Inc. dimitri.liakhovit...@markett

Re: [R] Nagelkerkes R2N

2009-05-13 Thread Frank E Harrell Jr
A new version of Design will be posted to CRAN in the next 2 days. After than, update your system, including an update to the survival package. Then re-try. Your formula is wrong as it can't be negative. LR should be the likelihood ratio chi-square stat : -2 times the difference in the two

[R] access to the current element of lapply

2009-05-13 Thread Martial Sankar
Dear All, I would like to use the 'split' function on the dataframe elements contained in a list L. For example : > (df <- data.frame(cbind(c(rep('A',2), rep('B',2)), rep(1:4 X1 X2 1 A 1 2 A 2 3 B 3 4 B 4 > (L<-split(df, df$X1)) $A X1 X2 1 A 1 2 A 2 $B X1 X2 3 B 3 4

[R] name siz ein cluster

2009-05-13 Thread Penner, Johannes
I would like to change to size of the names in a cluster dendrogram (not the axis or the header) (package clue). The "normal" things (pch, cex.label, font) do not work here. Thanks in advance! Johannes __ R-help@r-project.org mailing list https://stat.e

Re: [R] import HTML tables

2009-05-13 Thread Duncan Temple Lang
Dieter Menne wrote: Dimitri Szerman-2 wrote: Hello, I was wondering if there is a function in R that imports tables directly from a HTML document. The XML package can do this: http://markmail.org/message/cyicoa3htme4gei2 Duncan Temple Lang: The htmlParse() and htmlTreeParse() functions in

Re: [R] questions on rpart (tree changes when rearrange the order of covariates?!)

2009-05-13 Thread Dimitri Liakhovitski
I wonder - isn't this issue one of the reasons to use RandomForests rather than CART? On Wed, May 13, 2009 at 8:03 AM, Liaw, Andy wrote: > From: Uwe Ligges >> >> Yuanyuan wrote: >> > Greetings, >> > >> > I am using rpart for classification with "class" method. >> The test data  is >> > the Indian

Re: [R] 3dscatter for linux

2009-05-13 Thread Ben Bolker
threshold wrote: > > Hi, do you have any suggestions how to make 3D scatterplot, BUT under > linux. Worth mentioning is the fact that 'scatterplot3d' does not load > under Ubuntu 8.10. > Do you know any alternatives?? I tried cloud or persp but X,Y and Z axes > are emprical in my case, and cann

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread Mike Lawrence
What types of data are in each file? All numbers, or a mix of numbers and characters? Any missing data or special NA values? On Wed, May 13, 2009 at 7:45 AM, SYKES, Jennifer wrote: > Hello > > > > Apologies if this is a simple question, I have searched the help and > have not managed to work out

Re: [R] read multiple large files into one dataframe

2009-05-13 Thread baptiste auguie
I'd first try plyr and see if it's efficient enough, library(plyr) listOfFiles <- list.files(pattern= ".txt") d <- ldply(listOfFiles, read.table) str(d) alternatively, d <- do.call(rbind, lapply(listOfFiles, read.table)) HTH, baptiste On 13 May 2009, at 12:45, SYKES, Jennifer wrote:

  1   2   >