Re: [R] Converting daily data series to monthly series

2010-04-21 Thread zow...@ncst.go.ke
Thanks Gabor, I have got the idear how to aggregate the daily data into monthly data using the zoo package. However, as I indicated earlier, in the series I am analysing, 29th February of leap years are excluded (so as to have 365 days in each year). How do I coerce(force) the the aggregate

[R] Odp: Basic doubt on ylim

2010-04-21 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 20.04.2010 21:21:26: Hi all, I'm a newbie with R and with a very basic question. Can I define the minor unit for ylim? For example, I have a y scale ranging from 1 to 14, jumping automatically every 2 units, but I want it to jump 1 unit at a

Re: [R] Unwanted boxes in legend

2010-04-21 Thread Steve Murray
Thanks Peter, I'm using version 2.8.0 (2008-10-20). This version should be recent enough to pick up fundamentals such as this, right? I guess the obvious thing to do is update and try again... Cheers, Steve Date: Tue, 20 Apr 2010 11:55:20 -0600

[R] dataframe

2010-04-21 Thread n.via...@libero.it
Dear list I have a question, I would like to get the following results but I dont know how to do it: I have a dataframe like this: NC8PROD X 1X2 1423 P1342 10 1564

Re: [R] Basic doubt on ylim

2010-04-21 Thread Jim Lemon
On 04/21/2010 05:21 AM, poliveira wrote: Hi all, I'm a newbie with R and with a very basic question. Can I define the minor unit for ylim? For example, I have a y scale ranging from 1 to 14, jumping automatically every 2 units, but I want it to jump 1 unit at a time...is it possible? I tried

Re: [R] User inputs

2010-04-21 Thread Dieter Menne
chrisli1223 wrote: (1) I have written a script which requires user input. I am using the readline() command.However, everytime when I run the script, R does not wait for the user input and proceed to the next line. Is there something like par(ask=T) to solve this problem? Depends on how

Re: [R] Best subset of models for glm.nb()

2010-04-21 Thread Jari Oksanen
Tim Clark mudiver1200 at yahoo.com writes: Yes, I have read about the problems with stepwise algorithms and am looking for a valid alternative to narrowing down models when you have a lot of data and a large number of variables your interested in. Tim, This is not an answer to your

Re: [R] dataframe

2010-04-21 Thread Ivan Calandra
Hi, You should send your data using dput() so that we can copy/paste into the console. That said, aggregate() or doBy::summaryBy() might do what you're looking for. HTH, Ivan Le 21-Apr-10 10:01, n.via...@libero.it a écrit : Dear list I have a question, I would like to get the following

Re: [R] ecdf

2010-04-21 Thread Martin Maechler
DW == David Winsemius dwinsem...@comcast.net on Mon, 19 Apr 2010 10:49:51 -0400 writes: DW The OP wrote me privately to say that the errant documantation was at: http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html DW That is a rather old bit of information. It dates

Re: [R] fit a line to power law distribution

2010-04-21 Thread Gábor Csárdi
Hi, perhaps the example at http://igraph.sourceforge.net/screenshots2.html#8 helps. Best, Gabor On Tue, Apr 20, 2010 at 6:42 PM, Narges Zarabi narges.zar...@gmail.com wrote: Hi, I am trying to fit a line in the log plot of my networks degree distribution to show that it is a power-law

Re: [R] having more than one plot in one figure

2010-04-21 Thread Jannis
Where is the problem with your code? You seem to have understood the principle correct and all what you want to to is possible with your code. You only seem to have made some typos (or is there any other reason why you plot num1 twice?), otherwise I do not really understand why you can not add

Re: [R] Converting daily data series to monthly series

2010-04-21 Thread Gabor Grothendieck
If you only have 28 days in Feb in your series then that is what will be summed if you follow those examples. If you mean that your series does include Feb 29th but you want to exclude it from the aggregates then just remove the Feb 29th points first and work with the reduced series:

Re: [R] Unwanted boxes in legend

2010-04-21 Thread Peter Ehlers
The 'border' argument was added in 2.1.10. On 2010-04-21 1:53, Steve Murray wrote: Thanks Peter, I'm using version 2.8.0 (2008-10-20). This version should be recent enough to pick up fundamentals such as this, right? I guess the obvious thing to do is update and try again... Cheers,

[R] VERY basic question about S4 classes

2010-04-21 Thread Albert-Jan Roskam
Hi,   I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even though the two methods belong to the same

Re: [R] VERY basic question about S4 classes

2010-04-21 Thread Duncan Murdoch
On 21/04/2010 7:00 AM, Albert-Jan Roskam wrote: Hi, I'm new to R and S4 classes. I defined a class with two methods (myMethod1 and myMethod2). I want to call myMethod1 within myMethod2. Why does the code below not work? The name 'myMethod1' doesn't appear to have meaning inside myMethod2, even

Re: [R] Unwanted boxes in legend

2010-04-21 Thread Peter Ehlers
On 2010-04-21 4:35, Peter Ehlers wrote: The 'border' argument was added in 2.1.10. Egad! Did I really type that? I meant 'in R 2.10.0'. -Peter Ehlers On 2010-04-21 1:53, Steve Murray wrote: Thanks Peter, I'm using version 2.8.0 (2008-10-20). This version should be recent enough to

Re: [R] Unwanted boxes in legend

2010-04-21 Thread Steve Murray
Ok thanks Peter! That should solve it. Thanks again for looking into this. Steve Date: Wed, 21 Apr 2010 05:04:33 -0600 From: ehl...@ucalgary.ca To: smurray...@hotmail.com CC: r-help@r-project.org; tgstew...@gmail.com Subject: Re: [R] Unwanted boxes

[R] Full Professor Position at LMU Munich

2010-04-21 Thread Friedrich Leisch
The Department of Statistics of the Ludwig-Maximilians-University Munich offers a position as Professor (W3) for Biostatistics and its Applications in the Life Sciences. R plays a central role both in teaching and research at our department, hence we would especially welcome applications from

Re: [R] Help with Partial dependence bar graph

2010-04-21 Thread Liaw, Andy
Store the returned value of partialPlot() in an object and do your own barplot. Read the Value section in the help page for partialPlot. Andy From: Daudi Jjingo Hello, I need to draw a partial dependence bar graph. My the my predictor vectors are continous and so is the response

[R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread Andrea Bernasconi DG
Dear Madame, Dear Sir, I am able to obtain the coefficients from a 'summary' of 'lm', but NOT from a 'summary' of 'aov'. The following example shows my steps. ## Initialize rm(list = ls()) # remove (almost) everything in the working environment utils::data(npk, package=MASS) # get data model -

[R] (no subject)

2010-04-21 Thread Henrik Petri
Dear R-Help, my name is Henrik and I am currently trying to solve a Maximum Likelihood optimization problem in R. Below you can find the output from R, when I use the BFGS method: The problem is that the parameters that I get are very unreasonable, I would expect the absolute value of each

[R] Maximum Likelihood Estimation in R

2010-04-21 Thread Henkep
Dear R-Help, I also send the following post by e-mail to you, however I try to post it here aswell. My name is Henrik and I am currently trying to solve a Maximum Likelihood optimization problem in R. Below you can find the output from R, when I use the BFGS method: The problem is that the

[R] calculating age from year of birth and date?

2010-04-21 Thread Vlatka Matković Puljić
Hi, I have v1 (date of test) and v2 (year of birth). v1 v2 15.5.2008 88 18.6.200954 I want R to use only year in v1; and v2 see as 1988 and calculate age in v3. any ideas how to do that? -- ** Vlatka Matković Puljić 095/8618 171

Re: [R] MiscPsycho - incorrect levenshtein distance?

2010-04-21 Thread Doran, Harold
Ben MiscPsycho 1.6 has been placed on CRAN with the bug fix. Should hit mirrors in a day or so. If for any reason you need it sooner, I can send the tar.gz file. Thanks for the bug report. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Wednesday, April

Re: [R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 8:37 AM, Andrea Bernasconi DG wrote: Dear Madame, Dear Sir, I am able to obtain the coefficients from a 'summary' of 'lm', but NOT from a 'summary' of 'aov'. The following example shows my steps. ## Initialize rm(list = ls()) # remove (almost) everything in the working

[R] Updated MiscPsycho 1.6 on CRAN

2010-04-21 Thread Doran, Harold
An updated version of this package has been placed on CRAN. The following are new/fixed in 1.6: 1) The classical() function now computes design-consistent standard errors for a one-stage cluster sample with unbalanced data. 2) The jml() function now uses better starting values to reduce

[R] median Q?

2010-04-21 Thread Vlatka Matkovic Puljic
Hi, I have dataset n1 and v1 (years). when i ask median(year) [1] NA but if i put summary of dataset n1: summary(n1) R produces median (together with min/max/mean) why it is so? -- ** Vlatka Matkovic Puljic 095/8618 171 [[alternative HTML version

Re: [R] median Q?

2010-04-21 Thread Joshua Wiley
Hello, summary() removes NAs by default. You can get the same results using median(year, na.rm=TRUE) see ?median HTH, Josh On Wed, Apr 21, 2010 at 6:40 AM, Vlatka Matkovic Puljic v.matkovic.pul...@gmail.com wrote: Hi, I have dataset n1 and v1 (years). when i ask median(year) [1] NA

[R] calculating age from year of birth and date?

2010-04-21 Thread Vlatka Matkovic Puljic
Hi, I have v1 (date of test) and v2 (year of birth). v1 v2 15.5.2008 88 18.6.200954 I want R to use only year in v1; and v2 see as 1988 and calculate age in v3. any ideas how to do that? -- ** Vlatka Matković Puljić 095/8618 171

Re: [R] median Q?

2010-04-21 Thread Vlatka Matkovic Puljic
Thank you! 2010/4/21 Joshua Wiley jwiley.ps...@gmail.com Hello, summary() removes NAs by default. You can get the same results using median(year, na.rm=TRUE) see ?median HTH, Josh On Wed, Apr 21, 2010 at 6:40 AM, Vlatka Matkovic Puljic v.matkovic.pul...@gmail.com wrote: Hi,

Re: [R] calculating age from year of birth and date?

2010-04-21 Thread Dimitri Liakhovitski
In what format are you dates? Are they always like this: two digits for day, then one or two digits for month, and four digits for the year? Also - are any of your people born after 1999? Dimitri 2010/4/21 Vlatka Matković Puljić vlatk...@gmail.com: Hi, I have v1 (date of test) and v2 (year

[R] dataframe

2010-04-21 Thread n.via...@libero.it
Dear list, I have a question about the selection of Variables in dataframes. I have a dataframes like this: CFISCA FIRMS YEARVAR VALUE 20345nike 2005

Re: [R] Maximum Likelihood Estimation in R

2010-04-21 Thread Thomas Stewart
Two possible problems: (a) If you're working with a normal likelihood---and it seems that you are---the exponent should be squared. As in: ... + (1/(2*stdev*stdev))*sum( ( y-(rev/12)-lag(y)*exp(-lap/12) )^2 ) (b) lag may not be working like you think it should. Consider this silly example:

Re: [R] calculating age from year of birth and date?

2010-04-21 Thread Dimitri Liakhovitski
And what is the format for year of birth in Excel? Can't you use concatenate to concatenate a new column (that contains only 19) and the column that contains a 2-digit year of birth? And then change all those who are born (in the new column) before 1910 to XX+100 - which will give you 2009 (or

Re: [R] calculating age from year of birth and date?

2010-04-21 Thread Vlatka Matkovic Puljic
Hm, well.. I can do it in xls but I wanted to see if there is some (simple) way to do this in R. 2010/4/21 Dimitri Liakhovitski ld7...@gmail.com And what is the format for year of birth in Excel? Can't you use concatenate to concatenate a new column (that contains only 19) and the column that

Re: [R] calculating age from year of birth and date?

2010-04-21 Thread Dimitri Liakhovitski
Give what you've given us, you can try: x-data.frame(date=c(39804,9527,39917),birth=c(1988,1911,1969)) # your years have to be in 4-digit format # formatting date as Date. What you have is, I think, number of days since 1900 - can anyone correct me? x$date-as.Date(x$date,origin=1900-01-01)

Re: [R] dataframe

2010-04-21 Thread Dimitri Liakhovitski
It's not very clear from what you pasted into your message what your data frame looks like. Does it always have 2 lines per record or just one? Also - in what format is your YEAR? On Wed, Apr 21, 2010 at 9:54 AM, n.via...@libero.it n.via...@libero.it wrote: Dear list, I have a question about

[R] Help: formatting the result of 'cut' function

2010-04-21 Thread Jose Claudio Faria
Dear list, I would like to format the result of the 'cut' function to perform a subsequent frequency distribution table (fdt) suitable for publications. Below an reproducible example: set.seed(1) x - c(rnorm(1e3, mean=10, sd=1), 50, 100) start - 0 end - 110 h -10 c1 - cut(x,

[R] dataframe

2010-04-21 Thread n.via...@libero.it
Dear list, I have a question about the selection of Variables in dataframes. I have a dataframes like this: CFISCAFIRMSYEAR VARVALUE 20345 nike2005EC01 34 20345 nike2006

[R] Unexpected warning from matplot

2010-04-21 Thread Mario Valle
n - 63 a - 1:n x - a-1 y - outer(x,a) matplot(x,y,type='l') Warning message: In matplot(x, y, type = l) : default 'pch' is smaller than number of columns and hence recycled Why is it complaining if I specifically ask for type=l, so no pch involved? Annoyance or feature? The fix (if needed)

[R] RNG

2010-04-21 Thread tamas barjak
Hi all! I would like to generate random numbers between 0 and 1. How can I do this? I downloaded it single RNG but it generates ones between only 1 and 1...:( Thank you for the help! Tamas [[alternative HTML version deleted]] __

Re: [R] RNG

2010-04-21 Thread Gustaf Rydevik
On Wed, Apr 21, 2010 at 4:37 PM, tamas barjak tamas.bar...@gmail.com wrote: Hi all! I would like to generate random numbers between 0 and 1. How can I do this? I downloaded it single RNG but it generates ones between only 1 and 1...:( Thank you for the help! Tamas Hi tamas, I am

Re: [R] RNG

2010-04-21 Thread Dimitri Liakhovitski
Or: sample(1:1,100) # to generate 100 random numbers between 1 and 1 On Wed, Apr 21, 2010 at 10:42 AM, Gustaf Rydevik gustaf.ryde...@gmail.com wrote: On Wed, Apr 21, 2010 at 4:37 PM, tamas barjak tamas.bar...@gmail.com wrote: Hi all! I would like to generate random numbers between 0

Re: [R] How to set proxy settings for R

2010-04-21 Thread Uwe Ligges
On 20.04.2010 12:02, danda wrote: Dear Pete, Thanks, it works now! I did as you suggested: --internet flag to the target line (right click, properties) e.g. C:\Program Files\R\R-2.8.1\bin\Rgui.exe --internet2 Strangely enough, I can now easly download packages but I still get these

Re: [R] Assigning Week Numbers

2010-04-21 Thread Jeffrey J. Hallman
Take a look at the 'ti' stuff in the tis package on CRAN. If I understand you correctly, you want something like this: weekNumber - function(aDate){ aTi - ti(aDate, tif = wfriday) may1ymd - 1*year(aTi) + 501 baseWeek - ti(may1ymd, tif = wfriday) return(aTi - baseWeek + 1) }

Re: [R] Assigning Week Numbers

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 9:40 AM, Michael Hosack wrote: Thank you David, this approach is a start in the right direction but it does not yield the needed results. I need new week numbers to only begin on Saturdays. The only exception will be for the first date (May 01) which will start week 1 on

Re: [R] median Q?

2010-04-21 Thread Vlatka Matkovic Puljic
I have additional Q: v1 is gender (M=1 and F=2) v2 is age I want R to calculate median only for M (1), but my comand is not good :) while(v1=1){median(v2,na.rm=TRUE)} Error: unexpected '=' in while(Q2= 2010/4/21 Vlatka Matkovic Puljic v.matkovic.pul...@gmail.com Thank you! 2010/4/21 Joshua

Re: [R] median Q?

2010-04-21 Thread Mohamed Lajnef
Hi, Try this median(v2[v1==1]) Mohamed Regards Vlatka Matkovic Puljic a écrit : I have additional Q: v1 is gender (M=1 and F=2) v2 is age I want R to calculate median only for M (1), but my comand is not good :) while(v1=1){median(v2,na.rm=TRUE)} Error: unexpected '=' in while(Q2=

Re: [R] median Q?

2010-04-21 Thread Joshua Wiley
Look at ?by for example by(data=v2, INDICES=v1, FUN=median, na.rm=TRUE) This will calculate the median of v2 (age) for each level of the indices v1 (in your case M and F). If you are only interested the median for a single level, Mohamed's solution is simpler. Josh On Wed, Apr 21, 2010 at

Re: [R] median Q?

2010-04-21 Thread Vlatka Matkovic Puljic
Perfect! Thanx a lot! :) 2010/4/21 Joshua Wiley jwiley.ps...@gmail.com Look at ?by for example by(data=v2, INDICES=v1, FUN=median, na.rm=TRUE) This will calculate the median of v2 (age) for each level of the indices v1 (in your case M and F). If you are only interested the median for

Re: [R] Count matches of a sequence in a vector?

2010-04-21 Thread Jeff Brown
One option might be to turn the sequence into a character string, and then use something like grep(). Kind of a kludge, but possibly easy. -- View this message in context: http://n4.nabble.com/Count-matches-of-a-sequence-in-a-vector-tp2019018p2019161.html Sent from the R help mailing list

[R] R crashing oddly

2010-04-21 Thread Michael Steven Rooney
Hi, I am working with the package nlme, and I tried creating a new correlation class (which, according to the help pages, is possible if you write a few new method functions). Anyways, I think I am 99% of the way there, but I have a recurring problem with R crashing on seemingly innocuous

Re: [R] Assigning Week Numbers

2010-04-21 Thread Gustaf Rydevik
On Tue, Apr 20, 2010 at 7:59 PM, Michael Hosack mhosa...@hotmail.com wrote: R experts, How could I extract the week number from a date vector (in Date class) such that week numbering (week 1...2...) begins (May 01) and ends (October 31) on the same specific dates each year? Week numbering

Re: [R] Count matches of a sequence in a vector?

2010-04-21 Thread Phil Spector
If I understand what you're looking for, I think this may work: seq=c(2,3,4) v=c(4,2,5,8,9,2,3,5,6,1,7,2,3,4,5) lseq = length(seq) lv = length(v) matches = sapply(1:(lv-lseq+1),function(i)all(v[i:(i+lseq-1)] == seq)) sum(matches) [1] 1 - Phil Spector

Re: [R] Results from clogit out of range?

2010-04-21 Thread Thomas Lumley
On Tue, 20 Apr 2010, Noah Silverman wrote: I just read the help page for predict.coxph. It indicates that the risk score is just exp(lp) What I'm trying to find, and have seen with some other implementations is the conditional probability within group. Neither the lp or the risk options seem

Re: [R] dataframe

2010-04-21 Thread jim holtman
Here is one way of doing it: x - read.table(textConnection(CFISCAFIRMS YEAR VARVALUE + 20345 nike2005EC01 34 + 20345 nike2006 EC01 45 + 56779

Re: [R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread Andrea Bernasconi DG
Thank you David, but how to get the value of 0.015939 present in s.npk.aov, and not given by s.npk.aov$coef[block,Pr(F)] ? On the other, the procedure to extract coefficients from a summary of lm or aov should be the same. Andrea On 21 Apr, 2010, at 3:20 PM, David Winsemius wrote: On

[R] vegan: grafical problem in ordiplot/ordisurf

2010-04-21 Thread Kim Vanselow
Dear vegan-helpers, I calculated an NMDS with metaMDS and then displayed the results with ordiplot. The NMDS consist of 4 axes. I want to plot two diagrams: 1st vs. 2nd and 3rd vs. 4th axis. I used the ordiplot-command choices = c(1,2) and c(3,4), respectively. 1st vs. 2nd does not make any

[R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Hello all, I would like to compare the similarity of two cluster solutions using a validation criteria (such as Hubert's gamma coefficient, the Dunn index the corrected rand index and so on) I see (from here:http://www.statmethods.net/advstats/cluster.html) that the function cluster.stats() in

Re: [R] Help: formatting the result of 'cut' function

2010-04-21 Thread jim holtman
Try this: set.seed(1) x - c(rnorm(1e3, mean=10, sd=1), 50, 100) start - 0 end - 110 h -10 c1 - cut(x, br=seq(start, end, h), right=TRUE) levels(c1) [1] (0,10](10,20] (20,30] (30,40] (40,50] (50,60] (60,70] (70,80] [9] (80,90] (90,100] (100,110] # I get: # [1]

Re: [R] Help: formatting the result of 'cut' function

2010-04-21 Thread Gabor Grothendieck
gsubfn is like gsub except instead of a replacement string it uses a replacement function whose input is the string matched by the regular expression and whose output replaces the match. The replacement function can optionally be specified as a formula as we do here. If there is no left hand

[R] R crashing oddly

2010-04-21 Thread Michael Steven Rooney
The R version is 2.9.2. nlme version is 3.1-93 The OS is Windows XP. This is for my work computer but I get the same behavior at home using Vista. -- Forwarded message -- From: Sarah Goslee sarah.gos...@gmail.com Date: Wed, Apr 21, 2010 at 11:50 AM Subject: Re: [R] R crashing oddly

Re: [R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 12:09 PM, Andrea Bernasconi DG wrote: Thank you David, but how to get the value of 0.015939 present in s.npk.aov, and not given by s.npk.aov$coef[block,Pr(F)] ? ??? That's not a coefficient. It's a p-value. On the other, the procedure to extract coefficients from a

Re: [R] R crashing oddly

2010-04-21 Thread Uwe Ligges
On 21.04.2010 18:19, Michael Steven Rooney wrote: The R version is 2.9.2. Please try with R-2.11.0 RC (release candidate) to be released tomorrow as well as a recent version of nlme. If its still fails, please send code (and data, if you do not generate them in the code) that reproduces

[R] Assigning week numbers

2010-04-21 Thread Michael Hosack
I provided a minimized version of my dataframe at the bottom of this message containing the results of David's code in variable ('wkoffset') and Jeff Hallman's code in ('WEEK'). Jeff's code produced the correct results (thank you Jeff) though I have been unable to understand it. David, as

Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Uwe Ligges
On 21.04.2010 18:15, Tal Galili wrote: Hello all, I would like to compare the similarity of two cluster solutions using a validation criteria (such as Hubert's gamma coefficient, the Dunn index the corrected rand index and so on) I see (from

Re: [R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 12:36 PM, David Winsemius wrote: On Apr 21, 2010, at 12:09 PM, Andrea Bernasconi DG wrote: Thank you David, but how to get the value of 0.015939 present in s.npk.aov, and not given by s.npk.aov$coef[block,Pr(F)] ? ??? That's not a coefficient. It's a p-value.

Re: [R] Unexpected warning from matplot

2010-04-21 Thread Uwe Ligges
On 21.04.2010 16:36, Mario Valle wrote: n - 63 a - 1:n x - a-1 y - outer(x,a) matplot(x,y,type='l') Warning message: In matplot(x, y, type = l) : default 'pch' is smaller than number of columns and hence recycled Why is it complaining if I specifically ask for type=l, so no pch involved?

Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Thanks for the fast reply Uwe. My hope in posting this was to find if anyone had already done work (in R) in this direction. So far I wasn't able to find any such relevant code, so I turned to the mailing list. Regarding new implementations - thanks for offering! - I have already came around

Re: [R] 3D surface plot with wireframe or persp?

2010-04-21 Thread Uwe Ligges
You cannot specify a dfunction for z, but need to compute the values in the matrix yourself as in: persp(data_for_time, data_for_s, outer(data_for_time, data_for_s, plot_R_i_3d)) Uwe Ligges On 20.04.2010 17:35, Jin wrote: Hello Dear, I have a function, like z=f(x,y), and try a

Re: [R] Assigning week numbers

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 12:50 PM, Michael Hosack wrote: I provided a minimized version of my dataframe at the bottom of this message containing the results of David's code in variable ('wkoffset') and Jeff Hallman's code in ('WEEK'). Jeff's code produced the correct results (thank you

Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Christian Hennig
Dear Tal, I took the definition of the Hubert gamma- and Dunn-index from the Gordon book. They are actually not about comparing two clusters, at least not in that reference, and they require dissimilarities. The adjusted Rand index and Meila's VI, as implemented in cluster.stats, compare

[R] (no subject)

2010-04-21 Thread Benjamin Stewart
I've got a problem with the sparseby command (reshape library), and I have reached the peak of my R knowledge (it isn't really that high).   I have a small data frame of 23 rows and 15 columns, here is a subset, the first four columns are factors and the rest are numeric (only one, line54 is

[R] Cross-checking a custom function for separability indices

2010-04-21 Thread Nikos Alexandris
Hi list! I have prepared a custom function (below) in order to calculate separability indices (Divergence, Bhattacharyya, Jeffries-Matusita, Transformed divergene) between two samples of (spectral land cover) classes. I need help to cross-compare results to verify that it works as expected

Re: [R] Writing methods for existing generic function

2010-04-21 Thread Uwe Ligges
On 19.04.2010 13:51, Viechtbauer Wolfgang (STAT) wrote: Dear All, Suppose I want to write a method for the generic function confint(): args(confint) function (object, parm, level = 0.95, ...) So, it looks like the second really??? and third argument have been predefined in the

Re: [R] Fishy error with NAMESPACE when checking package

2010-04-21 Thread Uwe Ligges
You forgot to rebuild or reinstall ? Uwe Ligges On 18.04.2010 00:25, BXC (Bendix Carstensen) wrote: I am updating the Epi package. I added functions named pc.points and pc.matpoints. Erroneously I wrote pc.plot and pc.matplot in the NAMESPACE file and of course got an error from Rcmd

Re: [R] Question regarding R plot

2010-04-21 Thread Uwe Ligges
optimize(function(x) -scores(x), interval=c(0.5, 0)) $minimum [1] 0.1830174 $objective [1] -11.67820 So the maximum is at x=0.183 with a score of 11.7, numerically. Uwe Ligges On 17.04.2010 16:30, Akito Y. Kawahara wrote: Hi, I am new to R, and have a quick question regarding an R script

[R] Table to List Transformation Scenario

2010-04-21 Thread Idgarad
I have a series of tables, one for each environment indicating a date (row) and a sample at each hour of the day (0 to 23) Test1 Table: Date,Hour1,Hour2,...Hour23 1/1/10,123,123,...,123 I would like to model this as a time series but how can I translate the table into a list such that I can get:

[R] Degrees of Freedom Not Allocated to Residuals in Reduced Model

2010-04-21 Thread wesman2k1
##I am trying to test for fixed factor main effects in an unbalanced mixed effects model but when I fit the reduced model for mic factor effects, the extra degrees of freedom are being allocated to a nested term rather than the residuals. The model has inc, mic and spp are independent

[R] overlaying a levelplot on a map plot

2010-04-21 Thread Simon Goodman
I've generated a levelplot showing the density distribution of a species derived from survey transects, with lon, lat co-ordinates. I'd like to overlay this on a map of the study region specified by: map('worldHires', xlim = range(mlon), ylim = range(mlat)), where mlon, mlat specifies the study

Re: [R] Count matches of a sequence in a vector?

2010-04-21 Thread Jeff Brown
Phil's algorithm is a good one, unless you're worried about optimizing for speed. It makes N * M comparisons, where N is the length of the first vector and M is the length of the second. Explicitly iterating through the longer vector, you could reduce the number of comparisons to M. As is

[R] A question about plot.mcmc

2010-04-21 Thread Xiao D
Dear List members, I am using R to generate MCMC time series plots. This is the code I use; however, everytime an error message will come out saying could not find function plot.mcmc. I have coda package and Lattice package installed. Does anyone know what may get wrong here? Thanks so much for

Re: [R] A question about plot.mcmc

2010-04-21 Thread Uwe Ligges
On 21.04.2010 20:31, Xiao D wrote: Dear List members, I am using R to generate MCMC time series plots. This is the code I use; however, everytime an error message will come out saying could not find function plot.mcmc. I have coda package and Lattice package installed. Does anyone know what

Re: [R] Table to List Transformation Scenario

2010-04-21 Thread Phil Spector
I'm guessing that you are using the words table and list to mean data frame. If that's the case, something like this might get you started: dfnew = reshape(Test1,varying=list(paste('Hour',1:23,sep='')), timevar='Hour',idvar='Date',direction='long') dfnew =

Re: [R] How to obtain the coefficients from a summary of aov ?

2010-04-21 Thread Peter Ehlers
Slight addition below; On 2010-04-21 10:51, David Winsemius wrote: On Apr 21, 2010, at 12:36 PM, David Winsemius wrote: On Apr 21, 2010, at 12:09 PM, Andrea Bernasconi DG wrote: Thank you David, but how to get the value of 0.015939 present in s.npk.aov, and not given by

[R] Assigning Week Numbers

2010-04-21 Thread Michael Hosack
David, there is still a problem. The data in variable 'wkoffset' should be equivalent to the data in 'WEEK'. May 07 should begin wkoffset=2 and the preceeding days should all be assigned wkoffset=1. I did make sure to adjust the year within day.of.week(). Could you please explain what you

[R] Assigning week numbers

2010-04-21 Thread Michael Hosack
Gustaf, That is correct. Schedule3 does contain all of the Saturdays between April 30 and Nov. 01 for a given year. Mike R experts, How could I extract the week number from a date vector (in Date class) such that week numbering (week 1...2...) begins (May 01) and ends (October 31)

Re: [R] overlaying a levelplot on a map plot

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 2:27 PM, Simon Goodman wrote: I've generated a levelplot showing the density distribution of a species derived from survey transects, with lon, lat co-ordinates. I'd like to overlay this on a map of the study region specified by: map('worldHires', xlim = range(mlon),

Re: [R] A question about plot.mcmc

2010-04-21 Thread Tengfei Yin
Hi I have mone quick question I am not quite familiar with, for generic function plot, why some methods are marked by '*', I think plot(as.mcmc()) may dispatch the right method, I try to use get to view the function, but it seems that get() only works for the one with no *, e.g. get('plot.ecdf')

Re: [R] Assigning week numbers

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 1:15 PM, David Winsemius wrote: On Apr 21, 2010, at 12:50 PM, Michael Hosack wrote: I provided a minimized version of my dataframe at the bottom of this message containing the results of David's code in variable ('wkoffset') and Jeff Hallman's code in ('WEEK').

Re: [R] A question about plot.mcmc

2010-04-21 Thread David Winsemius
On Apr 21, 2010, at 3:21 PM, Tengfei Yin wrote: Hi I have mone quick question I am not quite familiar with, for generic function plot, why some methods are marked by '*', I think plot(as.mcmc()) may dispatch the right method, I try to use get to view the function, but it seems that get()

Re: [R] A question about plot.mcmc

2010-04-21 Thread Tengfei Yin
Hi David, Thank you so much, that's just what I want!! Best Tengfei On Wed, Apr 21, 2010 at 2:24 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 21, 2010, at 3:21 PM, Tengfei Yin wrote: Hi I have mone quick question I am not quite familiar with, for generic function plot, why

Re: [R] Can I compare two clusters without using their distance-matrix (dist()) ?

2010-04-21 Thread Tal Galili
Wonderful Christian, thank you for the (*very*) helpful reply! Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |

Re: [R] overlaying a levelplot on a map plot

2010-04-21 Thread Peter Ehlers
Try using contour() instead of levelplot. See the examples in help('contour') for how to add contour lines to an existing plot. -Peter Ehlers On 2010-04-21 13:08, David Winsemius wrote: On Apr 21, 2010, at 2:27 PM, Simon Goodman wrote: I've generated a levelplot showing the density

Re: [R] Table to List Transformation Scenario

2010-04-21 Thread Gabor Grothendieck
Assuming the date as id is the first column followed by 23 values, try the read.reps function found here: http://www.mail-archive.com/r-help@r-project.org/msg92123.html like this: DF - read.csv(myfile, as.is = TRUE) read.reps(DF, 23) On Wed, Apr 21, 2010 at 2:24 PM, Idgarad idga...@gmail.com

Re: [R] Results from clogit out of range?

2010-04-21 Thread Frank E Harrell Jr
Thomas Lumley wrote: On Tue, 20 Apr 2010, Noah Silverman wrote: I just read the help page for predict.coxph. It indicates that the risk score is just exp(lp) What I'm trying to find, and have seen with some other implementations is the conditional probability within group. Neither the lp or

[R] Degrees of Freedom Not Allocated to Residuals in Reduced Model

2010-04-21 Thread wesman2k1
I am trying to test for fixed factor main effects in an unbalanced mixed effects model but when I fit the reduced model for mic factor effects, the extra degrees of freedom are being allocated to a nested term rather than the residuals. The model has inc, mic and spp are independent

[R] Maximum Likelihood in R

2010-04-21 Thread Henkep
Dear R-Help, my name is Henrik and I am currently trying to solve a Maximum Likelihood optimization problem in R. Below you can find the output from R, when I use the BFGS method: The problem is that the parameters that I get are very unreasonable, I would expect the absolute value of each

[R] Count matches of a sequence in a vector?

2010-04-21 Thread mieke
Hey there, I need to count the matches of a sequence seq=c(2,3,4) in a long vector v=c(4,2,5,8,9,2,3,5,6,1,7,2,3,4,5,). With sum(v %in% seq) I only get the sum of sum(v %in% 2), sum(v %in% 3) and sum(v %in% 4), but that's not what I need :( Who can help me? Thanks a lot! -- View this

Re: [R] Count matches of a sequence in a vector?

2010-04-21 Thread Jeff Brown
This sort of calculation can't be vectorized; you'll have to iterate through the sequence, e.g. with a for loop. I don't know if a routine has already been written. -- View this message in context: http://n4.nabble.com/Count-matches-of-a-sequence-in-a-vector-tp2019018p2019108.html Sent from

  1   2   >