[R] Hashing a set

2010-09-29 Thread Lorenzo Isella
Dear All, I am given a time series such at, at every time t_i, I am given a set of data (every element of the set is just an integer number). What I need is an injective function able to map every set into a number (possibly an integer number, but that is not engraved in the stone). Does anybody

[R] fitting model to resampled data

2010-09-29 Thread Michael Larkin
I apologize if this comes across as confusing. I will try to explain my situation as best I can. I have R bootstrapping my growth data for fish. It's resampling my database of age and length data and then produces several new datasets for me. In this case, it's resampling my data to

[R] Obtaining lattice equivalent smoothed (loess) plot in ggplot

2010-09-29 Thread A Herath
Hello, I have been struggling to do a plot in ggplot(2) that's of lattice equivalent. The following code shows the lattice plot.

[R] Script auto-detecting its own path

2010-09-29 Thread Stu Field
Hi all, Forgive me if this question has been addressed, but I was unable to find anything in the r-help list or in cyberspace. My question is this: is there a function, or set of functions, that will enable a script to detect its own path? I have tried file.path() but that was not what I was

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Henrique Dallazuanna
Try this: PATH - dirname(sys.frame(1)$ofile) On Wed, Sep 29, 2010 at 5:00 PM, Stu Field s...@colostate.edu wrote: Hi all, Forgive me if this question has been addressed, but I was unable to find anything in the r-help list or in cyberspace. My question is this: is there a function, or set

Re: [R] resampling issue

2010-09-29 Thread Dennis Murphy
Hi: The deal with replicate() is that its second argument is a *function*; more specifically, a function *call*. That's why Henrique's solution worked and your attempt didn't. Inside replicate(), if the function has arguments, they need to be supplied. This works: testdat - function(df, n)

Re: [R] fitting model to resampled data

2010-09-29 Thread Derek Ogle
Mike, Without completely knowing your end game with these questions and this procedure it does seem like you are re-inventing the wheel here. If that is true and given the nls() fit that you are using I would suggest that you look at boot.case() in the alr3 package or nlsBoot() in the

Re: [R] fitting model to resampled data

2010-09-29 Thread Henrique Dallazuanna
Try this: growthBoot - replicate(3, growth[sample(9,12,replace=T),], simplify = FALSE) lapply(growthBoot, nls, formula = Length ~ Linf * (1 - exp(-K * (Age - to))), start = par) On Wed, Sep 29, 2010 at 4:56 PM, Michael Larkin mlar...@rsmas.miami.eduwrote: I apologize if this comes across as

[R] Controling R from MS Access

2010-09-29 Thread Felipe Carrillo
HI: I've seen a few threads about this topic but still can't find a straightforward way on this.   Is there a package that can control R within an access form. For example, I want to send a query to R, perform some statistics in R and send the output or summary back to Access and display it on a

[R] graph margins

2010-09-29 Thread Mohsen Jafarikia
Hello All, I am drawing a graph having 18 small graphs inside using par(mfrow = c(6,3)) command. My problem is how to specify the margins of the whole 18 graphs. I used par(mar=c(6.5, 6.5, 1.5, 1.5)) for each graph separately already but it does not left any margins for the 'mtext()' for the

Re: [R] graph margins

2010-09-29 Thread Jonathan Flowers
Use par(oma=c(1,1,1,1)) # oma = outer margin area Is this what your looking for? On Wed, Sep 29, 2010 at 5:03 PM, Mohsen Jafarikia jafari...@gmail.comwrote: Hello All, I am drawing a graph having 18 small graphs inside using par(mfrow = c(6,3)) command. My problem is how to specify the

Re: [R] Obtaining lattice equivalent smoothed (loess) plot in ggplot

2010-09-29 Thread Dennis Murphy
Hi: There's no way you could produce a loess plot based on the data supplied below. V1, your purported x-variable, is a factor; moreover, you have one point per V1 * V2 factor combination. (BTW, you might also consider using the carriage return when demarcating individual lines of code.) The

[R] sample exponential r.v. by MCMC

2010-09-29 Thread Zhongyi Yuan
Dear R users, I am leaning MCMC sampling, and have a problem while trying to sample exponential r.v.'s via the following code: samp - MCMCmetrop1R(dexp, theta.init=1, rate=2, mcmc=5000, burnin=500, thin=10, verbose=500, logfun=FALSE) I tried

[R] how to to if a calculation is out range?

2010-09-29 Thread song song
for example, when I am calculating a posterior density, I need to calculate gamma(75*3+5)=gamma(220) which is out of the bound of gamma function. what shall I do for this condition Thank you [[alternative HTML version deleted]] __

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Hadley Wickham
Forgive me if this question has been addressed, but I was unable to find anything in the r-help list or in cyberspace. My question is this: is there a function, or set of functions, that will enable a script to detect its own path? I have tried file.path() but that was not what I was

[R] Split data

2010-09-29 Thread Ali S
I used split() to split a variable by 3 years, but am wondering how to call up that split data and use it in further analyses. Can I make separate columns for the 3 resulting year groups? [[alternative HTML version deleted]] __

Re: [R] drawing samples based on a matching variable

2010-09-29 Thread L Brown
Thanks much for all the help, R-helpers. Ended up getting the counts of the categories of the matching variable in both x and y and then limiting the sample from there. No longer really random, but I think it's fine for my purposes. Thanks again. LB On 28 September 2010 18:40, Michael Bedward

[R] Repeated Measure ANCOVA Example

2010-09-29 Thread Chun (Jimmie) Ye
Hi, I've been reading quite a bit about the proper way of analyzing repeated measured data and understand the advantages/pitfalls of doing it using either a MANCOVA or linear mixed model approach. But I was wondering, for the sake of really understanding, if anyone has some data to show how a

Re: [R] Split data

2010-09-29 Thread Phil Spector
Ali - A reproducible example would be very helpful, but I'll try to guess what you mean. mydat = data.frame(year=rep(2008:2010,each=5),var=1:15) sdat = split(mydat$var,mydat$year) do.call(cbind,sdat) 2008 2009 2010 [1,]16 11 [2,]27 12 [3,]38 13 [4,]4

Re: [R] sample exponential r.v. by MCMC

2010-09-29 Thread Zhongyi Yuan
Hi Dennis, Sorry for not being considerate. I should have at least mentioned I was using MCMCpack. I have no idea about traceback() though. I appreciate your suggestion. Best, Zhongyi On Wed, Sep 29, 2010 at 5:00 PM, Dennis Murphy djmu...@gmail.com wrote: Hi: It might be helpful to

Re: [R] nlminb and optim

2010-09-29 Thread Ravi Varadhan
Can you send your code and data as separate files so we can get it into R easily? Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410)

[R] sample from very large distribution

2010-09-29 Thread Matthew Finkbeiner
I don't have enough RAM for this problem, so I need a work around. This is what I want to do: y- sample(2^32, 10, replace=FALSE) but my machine won't let me do that. so I now do this: x- seq(1,2^32, by=100) y- sample(x, 10, replace=FALSE) this works fine, but by selecting every 100th

Re: [R] sample from very large distribution

2010-09-29 Thread Charles C. Berry
On Thu, 30 Sep 2010, Matthew Finkbeiner wrote: I don't have enough RAM for this problem, so I need a work around. This is what I want to do: y- sample(2^32, 10, replace=FALSE) y - trunc(runif( 10, 1, 2^32+1)) while( any( dup.y -duplicated(y) ) ) y[dup.y] -

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Stu Field
Hadley, I'm not sure this will solve the issue because if I move the script, I would still have to go into the script and edit the /path/to/my/script.r, or do I misunderstand your workaround? I'm looking for something like: file.path.is.here(myscript.r) and which would return something like:

Re: [R] cochran Q test

2010-09-29 Thread Kohleth Chia
THanks for all the replies. I guess I should have been clearer from the beginning. When I said I don't want to write my code, I meant I don't want to CREATE a new function. Not because I can't, but because I don't want to. The cmh.test in the {lawstat} package still doesn't look like the

Re: [R] matrix plot

2010-09-29 Thread Gabor Grothendieck
On Wed, Sep 29, 2010 at 6:55 AM, hairryharry hairryha...@tesco.net wrote: Hi, Fairly new to R - have done basic plots but now faced with plotting a matrix/table of results -I know what I want but cannot find out how to do it. Basically have individual questions ( x) to which an organization

Re: [R] repeat a function

2010-09-29 Thread Michael Bedward
On 30 September 2010 02:48, Michael Larkin mlar...@rsmas.miami.edu wrote: testdat - replicate( 50, growth[ sample(nrow(growth), 8, rep=TRUE) ] ) I can't seem to get it to work.  I keep getting the error message of undefined columns selected Any advice? I'd need to know the dimensions of

Re: [R] repeat a function

2010-09-29 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Michael Bedward Sent: Wednesday, September 29, 2010 5:34 PM To: Michael Larkin; Rhelp Subject: Re: [R] repeat a function On 30 September 2010 02:48, Michael Larkin

Re: [R] how to to if a calculation is out range?

2010-09-29 Thread Jonathan Christensen
Perhaps use lgamma? lgamma(220) [1] 964.8206 Jonathan On Wed, Sep 29, 2010 at 3:22 PM, song song rprojecth...@gmail.com wrote: for example, when I am calculating a posterior density, I need to calculate gamma(75*3+5)=gamma(220) which is out of the bound of gamma function. what shall I do

[R] How to get a proportion of a Vector Member

2010-09-29 Thread Gundala Viswanath
I have a vector that looks like this: foo [1] o o o x o o o o o x x o x How can we find the percentage of o and x in that vector in R? - G.V __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] How to get a proportion of a Vector Member

2010-09-29 Thread Peter Langfelder
On Wed, Sep 29, 2010 at 6:43 PM, Gundala Viswanath gunda...@gmail.com wrote: I have a vector that looks like this: foo [1] o o o x o o o o o x x o x How can we find the percentage of o and x in that vector in R? table(foo)/length(foo) Peter __

[R] how to convert time axis in year, month, day, hour ?

2010-09-29 Thread Yogesh Tiwari
Dear R Users, I have model simulated data for 240 days. The day 1 is Jan 1, 2009, 00:00 hrs and then with 3-hourly interval and so on. The time axis is 1,2,3,4..1920; so the total rows in the data are 1920. How to convert above time axis in year month day hour format Great Thanks,

[R] cor() alternative for huge data set

2010-09-29 Thread Jyotasana Gulati
Hi, I am have a data set of around 43000 probes(rows), and have to calculate correlation matrix. When I run cor function in R, its throwing an error message of RAM shortage which was obvious for such huge number of rows. I am not getting a logical way to cut off this huge number of entities,

Re: [R] How to get a proportion of a Vector Member

2010-09-29 Thread Henrique Dallazuanna
Try this: prop.table(table(foo)) On Wed, Sep 29, 2010 at 10:43 PM, Gundala Viswanath gunda...@gmail.comwrote: I have a vector that looks like this: foo [1] o o o x o o o o o x x o x How can we find the percentage of o and x in that vector in R? - G.V

Re: [R] How to get a proportion of a Vector Member

2010-09-29 Thread Peng, C
sum(foo==o)/length(foo) -- View this message in context: http://r.789695.n4.nabble.com/How-to-get-a-proportion-of-a-Vector-Member-tp2720060p2720067.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] Obtaining lattice equivalent smoothed (loess) plot in ggplot

2010-09-29 Thread A Herath
Hello, My apologies, it was the hotmail writer which ate my post (hopefully this will get there, intact). dd-rbind(data.frame(rbind(c(V1,A,0.3),c(V2,A,0.5),c(V3,A,0.2))),      data.frame(rbind(c(V1,B,0.3),c(V2,B,0.4),c(V3,B,0.8))),     data.frame(rbind(c(V1,C,0.9),c(V2,C,0.2),c(V3,C,0.4

Re: [R] Obtaining lattice equivalent smoothed (loess) plot in ggplot

2010-09-29 Thread Dennis Murphy
Here's my cooked up example: # Faked data x - sample(1:100, 300, replace = TRUE) # y = a + bx + cx^2 + noise, where a, b, c differ in each group y - rep(c(2, 5, 3), each = 100) + rep(c(-0.5, 0.5, 1), each = 100) * x + rep(c(0.01, -0.01, 0.02), each = 100) * x^2 + rnorm(300, 0, 10) g -

Re: [R] [R-pkgs] ez version 2.0

2010-09-29 Thread Shai
Hi Thanks for the wonderful package! I have a question on plotting. How do I control the dodging (like the position_dodge in ggplot2) of the points after creating a plot with ezPlot? when plotting a 2-way ANOVA the error bars cover each other... Thanks! shai On Aug 31, 2:53 pm, Mike Lawrence

[R] spatial correlogram

2010-09-29 Thread tara
Hello I am trying to use the correlog function to estimate a spatial correlogram for the residuals of a logistic regression and I have run accross the following error. summary(binom1 - glm(Use~X20mslop+X20mdem+soilsst, family=binomial, + data=M60m2000NE_1.df)) correlog1.1 -

Re: [R] cor() alternative for huge data set

2010-09-29 Thread Peter Langfelder
On Wed, Sep 29, 2010 at 1:27 PM, Jyotasana Gulati jgul...@ice.mpg.de wrote: Hi, I am have a data set of around 43000 probes(rows), and have to calculate correlation matrix. When I run cor function in R, its throwing an error message of RAM shortage which was obvious for such huge number of

[R] print only 2 digits of number

2010-09-29 Thread Christian Schoder
hi R-users! does anyone know how I can access/print only the first two digits of a number? if i have the number 23732, i would like to get 23. if i have 355 i would like to get 35. if i have 4 i would like to get 40. thanks for your help! christian

Re: [R] print only 2 digits of number

2010-09-29 Thread Peter Langfelder
On Wed, Sep 29, 2010 at 7:18 PM, Christian Schoder schoc...@newschool.edu wrote: hi R-users! does anyone know how I can access/print only the first two digits of a number? if i have the number 23732, i would like to get 23. if i have 355 i would like to get 35. if i have 4 i would like to get

Re: [R] print only 2 digits of number

2010-09-29 Thread Henrique Dallazuanna
Try this: trunc(x / 10 ^ nchar(x) * 100) On Wed, Sep 29, 2010 at 11:18 PM, Christian Schoder schoc...@newschool.eduwrote: hi R-users! does anyone know how I can access/print only the first two digits of a number? if i have the number 23732, i would like to get 23. if i have 355 i would

[R] Accessing Vector of A Data Frame

2010-09-29 Thread Gundala Viswanath
I have a variable that looks like this: print(pred$posterior) ox 1 2.356964e-03 9.976430e-01 2 8.988153e-01 1.011847e-01 3 9.466137e-01 5.338627e-02 4 2.731429e-11 1.00e+00 Now what I want to do is to access o and x How come this approach fail?

Re: [R] Accessing Vector of A Data Frame

2010-09-29 Thread jim holtman
Give us more information to work with. What does str(pred$posterior) show so that we can see the structure of the data. Is it a matrix, if so then you would do pred$posterior[, 'o'] On Wed, Sep 29, 2010 at 10:41 PM, Gundala Viswanath gunda...@gmail.com wrote: I have a variable that looks

Re: [R] how to rotate the x axis lable to an interested angle?

2010-09-29 Thread komais
Thank you for your help -- View this message in context: http://r.789695.n4.nabble.com/how-to-rotate-the-x-axis-lable-to-an-interested-angle-tp2718591p2720118.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]

<    1   2