Re: [R] Restructuring data - unstack, reshape?

2011-09-26 Thread Dennis Murphy
Hi: Here's one approach using the reshape() function in base R: # Read in your data: d - read.table(textConnection( Candidate.IDSpecialty Office Score 110002 C London 47 110002 C East 48

Re: [R] How to see the previous commands after save workspace/load workspace ?

2011-09-26 Thread Bogdan Lataianu
OK, I save/load history. This option is under File On Aug 4, 2:54 pm, R. Michael Weylandt michael.weyla...@gmail.com wrote: Check out ?savehistory in utils. Also, I think most GUI's do this - I can certainly attest that RStudio does Michael Weylandt On Thu, Aug 4, 2011 at 11:55 AM,

Re: [R] Standardized beta-coefficients in regression

2011-09-26 Thread Jeroen Ooms
Unfortunately I found myself in the same position as outlined above, where I was requested to reproduce 'standardized regression coefficients' as reported by SPSS. Below an example that produces something very similar to the results table from an SPSS Linear Regression procedure, including the

[R] Disabling Auto-complete

2011-09-26 Thread Vikram Bahure
Hi, I am a new user to R. I am having the following problem while using R: The defined function is having following a$unit as input but if I define a$unit1 then still I am getting the output which is not desired. __ *Function:* testfunction-function(a){

Re: [R] Data import

2011-09-26 Thread Jan van der Laan
You can with the routines in the memisc library. You can open a file using spss.system.file and then import a subset using subset. Look in the help pages of spss.system.file for examples. HTH Jan On 09/25/2011 11:56 PM, sassorauk wrote: Is it possible to import only certain variables from

Re: [R] Disabling Auto-complete

2011-09-26 Thread Allan Engelhardt (CYBAEA)
The $ operator does partial matching by default so for example print(b$u) [1] 1 The [[ operator does not print(b[[unit]]) NULL print(b[[unit1]]) [1] 1 See help($) for more details and also the warnPartialMatch* arguments in help(options). Try testfunction - function(x) if (exists(unit,

[R] how to handle with gap's in panel data (plm package)

2011-09-26 Thread Cecilia Carmo
Hi everyone, I’m working with a panel of firm/years observations. My panel not only is unbalanced but also have some gap’s in years. For example, firm 1 has 1999, 2000, 2001, 2004, 2005, firm 2 has 2000, 2001, 2003, 2005, and so on. I’m using the plm package and what I’m asking is how can I

Re: [R] Data import

2011-09-26 Thread Ben Bolker
B77S bps0002 at auburn.edu writes: I have never used that function, but I know that with read.csv() you can do the following to select only the columns you want: chosen_vars - read.csv(Workbook1.csv, header=T)[c(variable1, variable3)] This is not actually selectively importing: it's

[R] Changing colour in barchart

2011-09-26 Thread shikantaza
Hello. I've been trying to change the colour of the bars in the auto.key to blue and red. I have tried: barchart(Rate~Digit,Ben,groups=Cat, horizontal=FALSE,ylab=Rate (%),auto.key=list(points=FALSE,rectangles=TRUE,space=right),col = c(blue, red),main=Benford's rate vs combined \n sample rate Lab

Re: [R] spatstat = owin + image

2011-09-26 Thread tkdweber
Hej, Thanks for the idea. I will try and see if I can make progress. + I appologise for the shortcut explanations. I'll dedicate myself to greater accuracy in future. tkd -- View this message in context: http://r.789695.n4.nabble.com/spatstat-owin-image-tp3837023p3843284.html Sent from the R

[R] vegan cca: syntax

2011-09-26 Thread fpgraz
Dear all, I am a new member to the list - and to the analysis that I am attempting. I have the following case A group of us have been monitoring (over a period of a few years) a number of paired plots that were flooded and / or burnt. The plots are located in two topographical settings, some

Re: [R] Trouble creating and adjacency matrix

2011-09-26 Thread Spartina
Hello all, Thanks for your answers! I'll give your suggestions a try later on today. Cheers, Léa -- View this message in context: http://r.789695.n4.nabble.com/Trouble-creating-and-adjacency-matrix-tp3842106p3843660.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Standardized beta-coefficients in regression

2011-09-26 Thread Frank Harrell
It is true that our lives are complex but we have to stick to principles. Plus, statisticians have the lowest unemployment rate in all of the sciences (1% according to NSF from a poll taken 2 years ago) so we should be able to capitalize on that by sticking to well-founded beliefs and facts and

Re: [R] Homography with R

2011-09-26 Thread Paul Hiemstra
On 09/23/2011 03:00 PM, PtitBleu wrote: Hello, I would like to know if it exists a package including something equivalent to this page: http://www.developpez.net/forums/d740403/autres-langages/algorithmes/contribuez/image-geometrie-projective-homography/

[R] problem with 'dgev' in fExtremes with log=TRUE

2011-09-26 Thread Gaz D
Hi, The function 'dgev' in the 'fExtremes' package contains a 'log' argument, for returning the log of the gev density. For example: library(fExtremes) x = seq(100,1000) density_values_log = dgev(x, 0.21, 455, 150, log=TRUE) density_values_nolog = dgev(x, 0.21, 455, 150, log=FALSE) However,

[R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Philip Rhoades
People, It appears that there is no way of getting Boxplots to plot using Mean, SD, Max Min - is there something else that would do what I want? I couldn't find it . . Thanks, Phil. -- Philip Rhoades GPO Box 3411 Sydney NSW 2001 Australia E-mail: p...@pricom.com.au

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread ONKELINX, Thierry
Dear Phil, Have a look at the ggplot2 package. library(ggplot2) #classic boxplot ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_boxplot() #custom boxplot myboxplot - cast(cyl ~ ., value = mpg, data = mtcars, fun = c(min, max, sd, mean)) ggplot(myboxplot, aes(x = factor(cyl))) +

Re: [R] Data import

2011-09-26 Thread sassorauk
Thanks for your responses. Ben is right that I am looking for a way to import a subset of data from SPSS into R. If I could do this it would mean not having to save large datasets which takes a long time and would mean duplicating a lot of the same information each time. I find SPSS slow to

[R] Packages for snp, CNV data

2011-09-26 Thread carol white
Hi, In addition to GADA, what are the available package in R and bioconductor to analyze amplification, deletion, LOH and indels of CNV, SNP data? Any reference is welcome. Best, Carol __ R-help@r-project.org mailing list

[R] How to Store the executed values in a dataframe rle function

2011-09-26 Thread sujitha
Hi group, This is how my test file looks like: Chr start end sample1 sample2 chr2 9896633 9896683 0 0 chr2 9896639 9896690 0 0 chr2 14314039 14314098 0 -0.35 chr2 14404467 14404502 0 -0.35 chr2 14421718 14421777 -0.43 -0.35 chr2 16031710 16031769 -0.43 -0.35 chr2 16036178 16036237 -0.43

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote: People, It appears that there is no way of getting Boxplots to plot using Mean, SD, Max Min - is there something else that would do what I want?  I couldn't find it . . Try replacing the stats component of boxplot's

[R] How to determine the efficient frontier portfolios using the Black-Litterman model?

2011-09-26 Thread jaosma
I'm trying to find 50 portfolios on the efficient frontier using the Black-Litterman model but have not found a suitable method for doing so. I tried using the portfoliosFrontier function given in the package fPortfolio using the optimalPortfolios.fPort function on package BLCOP but does not

Re: [R] Packages for snp, CNV data

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 10:30 AM, carol white wrote: Hi, In addition to GADA, what are the available package in R and bioconductor to analyze amplification, deletion, LOH and indels of CNV, SNP data? Any reference is welcome. Cross-posting is deprecated in the R mailing list. Please read the

[R] Intersection between circle and line?

2011-09-26 Thread Chris82
Dear R users, I am thinking about an easy and especially fast solution to calculate the x,y coordinates of the interesection between the borders of the red circle and the line. short example: plot(c(-3,0,3,9,21),c(-8,0,5,12,25)) draw.circle(0,0,radius=6,border=red,col=NA,lty=1,lwd=1) x -

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread William Dunlap
If you draw the whiskers out to the extrema of the data you may wish to omit the outliers, which are encoded by the out and group components of boxplot's return value: d - split(Nile, factor(time(Nile)1902, labels=c(pre-dam, post-dam))) par(mfrow=c(1,2)) b - boxplot(d, main=Default Boxplot)

[R] Package for Neural Network Classification Quality

2011-09-26 Thread Alejandro Coca Castro
Hi, somebody knows about one R-package which i can evaluate quality (recall, precision, accuracy, etc) of Neural network classification with more than 2 classes. I found ROCT package, http://cran.r-project.org/web/packages/ROCR/index.html, but it only workes with binary classifications, Best

Re: [R] How to determine the efficient frontier portfolios using the Black-Litterman model?

2011-09-26 Thread R. Michael Weylandt
You might get a more satisfactory answer from the R-SIG-Finance list, but more immediately, can you say what was unsatsifactory about the results the two mentioned packages? Specifically, minimal working example with data etc. Michael On Mon, Sep 26, 2011 at 10:32 AM, jaosma

Re: [R] Supporting R/Membership

2011-09-26 Thread Joshua Wiley
Thanks for the insight, Ben. I can appreciate not wanting the hassle of administration, and I suppose there are already sufficient funds for the fixed costs of stuff like the website. I like the idea of an intermediary that would handle all the issues related to donations, non-profit, etc. Then

Re: [R] Intersection between circle and line?

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 11:03 AM, Chris82 wrote: Dear R users, I am thinking about an easy and especially fast solution to calculate the x,y coordinates of the interesection between the borders of the red circle and the line. This would seem to be the solution to two simultaneous equations

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Philip Rhoades
Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote: People, It appears that there is no way of getting Boxplots to plot using Mean, SD, Max Min - is there something else that would do what I want?  I couldn't

[R] normalizing a negative binomial distribution and/or incorporating variance structures in a GAMM

2011-09-26 Thread Meredith Jantzen
 Hello everyone, Apologies in advance, as this is partially a stats question and partially an R question.  I have been using a GAM to model the activity level of bats going into and coming out from a forested edge.  I had eight microphones set up in a line transect at each of eight sites, and

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Vining, Kelly
You can also eliminate the outliers from boxplots with the outline=F parameter. --Kelly V. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Monday, September 26, 2011 8:12 AM To: p...@pricom.com.au Cc:

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote: People, It appears that there is no way of getting Boxplots to plot using Mean, SD,

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Philip Rhoades
Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote: People, It appears

Re: [R] Kolmogorov-Smirnov test

2011-09-26 Thread Greg Snow
There are criteria to tell if differences are meaningless, but they come from the science and the researcher, not from statistics tests and algorithms. Consider the question: Is one second of difference important? to answer that needs a bunch of context. One second can be a large period of

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread William Revelle
Dear Phil, An alternative solution is to draw a regular Tukey Box Plot but overlay the means +/- 1 sd: boxplot(anscombe) psych:::error.bars(anscombe,sd=TRUE,add=TRUE) Bill At 3:45 AM +1000 9/27/11, Philip Rhoades wrote: Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On

[R] horizontal labels for a dendrogram

2011-09-26 Thread Juhász Péter
Dear R-help list, I'd like to create visualize the clustering of a dataset with a dendrogram. I'm using the following script: data = read.table(data.csv, header=T, sep=;) require(cluster) res = as.dendrogram(agnes(data)) chlab - function(n) { if(is.leaf(n)) { att - attributes(n) labx -

[R] producing an aggregate table of top 3 by cost

2011-09-26 Thread Chris Conner
Help-Rs   As someone who is newer to R and trying to make the transition from Access into R, there is a frequetnly used function that I'd like to try and duplicate in the R world.  It involved creating an aggregate table of the top (n)  orders for an item by sum of cost over a select period of

[R] Reading two-cloumn CSV file into a hash table

2011-09-26 Thread Khanvilkar, Shashank
Hello All, Thanks in advance for all help, I am trying to read a two column csv file in R, which looks like: X,1 Y,2 Z,3 I am using R commands: tmp = read.csv(test.csv, colClasses=c(character, character)) How can make this into a hash table, so that I can access, tmp[X] and it will return me

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 1:45 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011

Re: [R] Changing colour in barchart

2011-09-26 Thread Deepayan Sarkar
On Mon, Sep 26, 2011 at 2:55 PM, shikantaza martyn.wilkin...@uhb.nhs.uk wrote: Hello. I've been trying to change the colour of the bars in the auto.key to blue and red. I have tried: barchart(Rate~Digit,Ben,groups=Cat, horizontal=FALSE,ylab=Rate

[R] Off topic -- A BAD idea. Was: Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Bert Gunter
On the original question though, why isn't there something off the shelf that will do what I want? Surely, a boxplot using mean, SD, max and min would be a common enough need to justify it? Gabor Grothendieck replied: tarr is not a list or a data frame. Use.data.frame(tarr) so

[R] merger two 3-d scatter plot

2011-09-26 Thread XINLI LI
Dear R groups: I have the data as follows, I want to plot the Rank1 ~ obs30*Cases and Rank2 ~ obs30*Cases on the same plot as one 3-D scatter plot, how to do that? Any help is highly appreciated. ID obs30 Cases RANK1 RANK2 1 0.03175 63 82 81 2 0.0 34 1 34 3 0.0 36 2 41 4 0.0 54 3

[R] Mahalanobis Distance

2011-09-26 Thread jorgeA
Hello R helpers, I'm trying to use Mahalanobis distance to calculate distance of two time series, to make some comparations with euclidean distance, DTW, etc, but I'm having some dificults. I have, for example, two objects: s.1 - c( 5.6324702, 1.3994353, -3.2572327, -3.8311846, -1.2248719,

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Philip Rhoades
Gabor, On 2011-09-27 04:31, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 1:45 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 3:24 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 04:31, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 1:45 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011

Re: [R] Mahalanobis Distance

2011-09-26 Thread David Cross
When I first saw your question, I thought the problem might have something to do with inverting the variance-covariance matrix, S, but that is not the case, I think: S for s.1 and s.2: S [,1] [,2] [1,] 1.835044e+01 8.392485e-04 [2,] 8.392485e-04 4.093558e-07 inverse(S):

[R] Testing for arguments in a function

2011-09-26 Thread Gene Leynes
I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){ ret = vec[i] ret } ## My data: i = 10 vec = 1:100 ## Expected input and behavior: myfun(vec, i) ## Missing an argument, but error is not caught! ## How is subsetting

[R] Triangular matrix upper to down

2011-09-26 Thread m.marcinmichal
Hi, suppose that we have a triangular upper matrix A test - matrix(ncol = 4, nrow = 4) test[1, ] - c(NA,1,1,1) test[2, ] - c(NA,NA,1,1) test[3, ] - c(NA,NA,NA,1) test[4, ] - c(NA,NA,NA,NA) I know how quickly set diagonal value diag(test) - 1. But how quickly set down value i.e. matrix is

Re: [R] merger two 3-d scatter plot

2011-09-26 Thread XINLI LI
Dear David and R groups: I have the data as follows, I want to plot the Rank1 ~ obs30*Cases and Rank2 ~ obs30*Cases on the same plot as one 3-D scatter plot, how to do that? Any help is highly appreciated. // ID obs30 Cases RANK1 RANK2 1

Re: [R] Triangular matrix upper to down

2011-09-26 Thread R. Michael Weylandt
On Mon, Sep 26, 2011 at 4:09 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: How about: test[lower.tri(test)] - test[upper.tri(test)] Try it with this data so you can see that it actually works: (the ones obscure possible false solutions) test - matrix(ncol = 4, nrow = 4)

[R] Reading two-cloumn CSV file into a hash table

2011-09-26 Thread Khanvilkar, Shashank
Sending it again, with correct subject line. Hello All, Thanks in advance for all help, I am trying to read a two column csv file in R, which looks like: X,1 Y,2 Z,3 I am using R commands: tmp = read.csv(test.csv, colClasses=c(character, character)) How can make this into a hash table, so

Re: [R] Kolmogorov-Smirnov test

2011-09-26 Thread Greg Snow
One additional point, you may want to look at the vis.test function in the TeachingDemos package for one option of comparing that focuses more on meaningful or at least visible differences. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] Triangular matrix upper to down

2011-09-26 Thread R. Michael Weylandt
Nope, I was sloppy and missed that. Thanks ... forwarding to list and OP Michael On Mon, Sep 26, 2011 at 4:26 PM, William Dunlap wdun...@tibco.com wrote: My r-help mail is arriving out of order, so perhaps you have already corrected this, but you need a call to t() to make this work. Your

[R] survival analysis: interval censored data

2011-09-26 Thread Ruth Arias
hello: my data looks like: time1  time2   event  catagoria 2004    2006        1            C 2004    2005        0            C 2005    2010        1            E 2007    2009        1            C 2006    2007        0            E 2008    2010        0            C 2008    2010       

Re: [R] Triangular matrix upper to down

2011-09-26 Thread William Dunlap
And, of course, I messed up that example as well by not reinitializing the matrix. It should be test[lower.tri(test)] - NA test [,1] [,2] [,3] [,4] [1,] NA123 [2,] NA NA45 [3,] NA NA NA6 [4,] NA NA NA NA test[lower.tri(test)] -

Re: [R] Mahalanobis Distance

2011-09-26 Thread jorgeA
Hello David, Thank you for the help anyway. Well answering your question However, I wonder how much value there is to computing the Mahalanobis distance with two variables that are measured on such different scales?: These two variables are subseries of the same time series. What I'm doing is

[R] as.POSIXct and time zones

2011-09-26 Thread Folkes, Michael
Hello all, I'm struggling with POSIXt objects. I've read the refman, the Rnews from 2001 and hopefully all the pertinent help pages. I'm running windows xp. It appears my time zone variable isn't set, which hopefully is fine for this exercise. Sys.getenv(TZ) TZ help(as.POSIXct) states:

Re: [R] Reading two-cloumn CSV file into a hash table

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 4:16 PM, Khanvilkar, Shashank skhan...@qualcomm.com wrote: Sending it again, with correct subject line. Hello All, Thanks in advance for all help, I am trying to read a two column csv file in R, which looks like: X,1 Y,2 Z,3 I am using R commands: tmp =

Re: [R] Testing for arguments in a function

2011-09-26 Thread Duncan Murdoch
On 26/09/2011 3:39 PM, Gene Leynes wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){ ret = vec[i] ret } ## My data: i = 10 vec = 1:100 ## Expected input and behavior: myfun(vec, i) ## Missing an argument, but

Re: [R] producing an aggregate table of top 3 by cost

2011-09-26 Thread Jean V Adams
Chris Conner wrote on 09/26/2011 11:33:05 AM: Help-Rs As someone who is newer to R and trying to make the transition from Access into R, there is a frequetnly used function that I'd like to try and duplicate in the R world. It involved creating an aggregate table of the top (n)

Re: [R] Reading two-cloumn CSV file into a hash table

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 4:16 PM, Khanvilkar, Shashank wrote: Sending it again, with correct subject line. Hello All, Thanks in advance for all help, I am trying to read a two column csv file in R, which looks like: X,1 Y,2 Z,3 I am using R commands: tmp = read.csv(test.csv,

[R] scatterplot3D

2011-09-26 Thread XINLI LI
Is there any way to plot a 3-D scatter plot for two groups on one graph? Thanks, XINLI [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Testing for arguments in a function

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 4:56 PM, Duncan Murdoch wrote: On 26/09/2011 3:39 PM, Gene Leynes wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){ ret = vec[i] ret } ## My data: i = 10 vec = 1:100 ## Expected input

Re: [R] Testing for arguments in a function

2011-09-26 Thread Gabor Grothendieck
On Mon, Sep 26, 2011 at 3:39 PM, Gene Leynes gley...@gmail.com wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){    ret = vec[i]    ret } ## My data: i = 10 vec = 1:100 ## Expected input and behavior:

Re: [R] Triangular matrix upper to down

2011-09-26 Thread m.marcinmichal
Mhy, I think that this solution It doesn't work with odd dimension. Suppose we have a reference matrix 13x13 (near i present a table format i.e save by write.table). This matrix name a response2. V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 1 0 1.4142135623731 1 1.73205080756888 1.4142135623731

[R] Sample Size Calculation using a Drop the Loser/Keep the Winner Design

2011-09-26 Thread Paul Miller
Hello Everyone,   I need to perform a sample size calculation using a drop the loser/keep the winner design. I've been searching for examples of how to do this using R but haven't found much.   The most promising possibility thus far is an R function called DrpLsrNRst. This appears in the book

Re: [R] Triangular matrix upper to down

2011-09-26 Thread m.marcinmichal
Ok, thanks this solution test[lower.tri(test)] - t(test)[lower.tri(test)] works perfectly well :) Thanks Best marcin M. -- View this message in context: http://r.789695.n4.nabble.com/Triangular-matrix-upper-to-down-tp3845107p3845352.html Sent from the R help mailing list archive at

[R] compute probabilities on a Bayesian Network

2011-09-26 Thread Marcio Pupin Mello
Deal R Users, I'm trying to find out how can I compute probabilities on a Bayesian Network using R. The Bayesian Network I modelled is shown at http://www.dsr.inpe.br/~mello/1727/BNgrapmodel.png and I'd like to know how can I proceed (commands on R) to answer questions like: (1) what is the

Re: [R] scatterplot3D

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 5:14 PM, XINLI LI wrote: Is there any way to plot a 3-D scatter plot for two groups on one graph? Color the points? Thanks, XINLI [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] SVM accuracy question

2011-09-26 Thread Riccardo G-Mail
Hi, I'm working with support vector machine for the classification purpose, and I have a problem about the accuracy of prediction. I divided my data set in train (1/3 of enteire data set) and test (2/3 of data set) using the sample function. Each time I perform the svm model I obtain

[R] findAssocs()

2011-09-26 Thread Henri-Paul Indiogine
I am trying to find the math behind the tm package findAssocs() ?findAssocs does not say anything besides association and correlate Usually entering findAssocs at the CLI gives the code for a R function, but in this case I obtain: function (x, term, corlimit) UseMethod(findAssocs, x)

Re: [R] SVM accuracy question

2011-09-26 Thread R. Michael Weylandt
Why exactly do you want to stabilize your results? If it's in preparation for publication/classroom demo/etc., certainly resetting the seed before each run (and hence getting the same sample() output) will make your results exactly reproducible. However, if you are looking for a clearer picture

Re: [R] Testing for arguments in a function

2011-09-26 Thread Duncan Murdoch
On 11-09-26 5:15 PM, David Winsemius wrote: On Sep 26, 2011, at 4:56 PM, Duncan Murdoch wrote: On 26/09/2011 3:39 PM, Gene Leynes wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun = function(vec, i){ ret = vec[i] ret } ## My

Re: [R] scatterplot3D

2011-09-26 Thread Duncan Murdoch
On 11-09-26 5:14 PM, XINLI LI wrote: Is there any way to plot a 3-D scatter plot for two groups on one graph? If you are using rgl::plot3d, plot the second with add=TRUE. As David said, use colours or something to distinguish. For example, library(rgl) data1 - matrix(rnorm(30), ncol=3)

Re: [R] findAssocs()

2011-09-26 Thread Rolf Turner
On 27/09/11 12:56, Henri-Paul Indiogine wrote: I am trying to find the math behind the tm package findAssocs() ?findAssocs does not say anything besides association and correlate Usually entering findAssocs at the CLI gives the code for a R function, but in this case I obtain: function (x,

Re: [R] Testing for arguments in a function

2011-09-26 Thread Gene Leynes
Alan and Duncan, or test them explicitly with missing(). If you want to do this automatically, then you shouldn't be using substrings and deparse, you should work at the language level. But I don't see the reason you want to do this... Absolutely. That wasn't the way I wanted to do it,

Re: [R] Testing for arguments in a function

2011-09-26 Thread Gene Leynes
Actually, this version is more general, doesn't need to know the name of the function: f = function(x,y){ curfun = deparse(match.call()[1]) curfun = substr(curfun,1,nchar(curfun)-2) if(length(formals(curfun))!=nargs()) stop('Something is missing...') } f() Putting this code

[R] Randomly selecting rows with unique values in two columns

2011-09-26 Thread hasan
Hello, I am trying to randomly select rows with unique values in columns 1 and 2. I want to generate multiple subsets to estimate a statistic for each data set. Below is a simplified example. L1 L2 L3 L4 L5 1 a b 1 2 3 2 a c 4 5 6 3 a d 7 8 9 4 a e 10 11 12 5 a f 13 14

[R] Conditional Evaluation

2011-09-26 Thread Thiem Alrik
Dear mailing list, how can I identify all those rows of matrix B which fulfill some condition based on another matrix A? More precisely, A - matrix(c(1, 1, 0, 1, -9, 1, -9, 1, 0, 0, 1, 1, 0, -9, 1, 0, -9, 0, 1, 1, 1, -9, 1, 1, 1), ncol = 5, byrow = TRUE) B -

[R] BDS test

2011-09-26 Thread Md. Ashraful Islam Khan
Hi, I want to know about BDS test statistics computation in R (tseries). Does the numerator of the BDS statistic catculate using bootstrap? If not, how can I use bootstrap? I am eagerlt waiting for your reply. Regards, Khan [[alternative HTML version deleted]]

[R] Nearest neighbour in a matrix

2011-09-26 Thread Spartina
Hello all, I am brand new to R and doing an exercise for a class. I need to find the nearest neighbour for points in the following matrix: DistanceMatrix x1 x2 x3 x4 x5 [1,] 0.00 2.828427 1.581139 2.236068 2.00 [2,] 2.828427 0.00 1.581139 4.123106

Re: [R] Testing for arguments in a function

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 8:04 PM, Duncan Murdoch wrote: On 11-09-26 5:15 PM, David Winsemius wrote: On Sep 26, 2011, at 4:56 PM, Duncan Murdoch wrote: On 26/09/2011 3:39 PM, Gene Leynes wrote: I don't understand how this function can subset by i when i is missing ## My function: myfun =

Re: [R] Randomly selecting rows with unique values in two columns

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 5:42 PM, hasan wrote: Hello, I am trying to randomly select rows with unique values in columns 1 and 2. I want to generate multiple subsets to estimate a statistic for each data set. Below is a simplified example. L1 L2 L3 L4 L5 1 a b 1 2 3 2 a c 4 5 6

Re: [R] Randomly selecting rows with unique values in two columns

2011-09-26 Thread R. Michael Weylandt michael.weyla...@gmail.com
It sounds like you've already done the hard(er) part: just use sample(nrow, noWanted) now to pick which rows to select. Michael Weylandt On Sep 26, 2011, at 5:42 PM, hasan halhad...@ucdavis.edu wrote: Hello, I am trying to randomly select rows with unique values in columns 1 and 2. I

Re: [R] Nearest neighbour in a matrix

2011-09-26 Thread R. Michael Weylandt michael.weyla...@gmail.com
There's a general no homework policy on this list, but if you use apropos() with some fairly intuitive search terms the problem won't be hard at all once you hit the 'magic' function. You also might want to look at ?apply. After that, ask your TA... Sorry we couldn't be more help, Michael

Re: [R] Nearest neighbour in a matrix

2011-09-26 Thread David Winsemius
On Sep 26, 2011, at 7:56 PM, Spartina wrote: Hello all, I am brand new to R and doing an exercise for a class. I need to find the nearest neighbour for points in the following matrix: DistanceMatrix x1 x2 x3 x4 x5 [1,] 0.00 2.828427 1.581139

Re: [R] Conditional Evaluation

2011-09-26 Thread Dennis Murphy
Hi: The problem is that in your example, you have unequal numbers of rows in B that match the 1's pattern in A[i, ]. The function below cycles through the rows of A and returns, for each row of A, the rows in B that have 1's in the same columns as A[i, ]. By necessity, this returns a list. Notice

[R] Error in optim function.

2011-09-26 Thread jango
I'm trying to calculate the maximum likelihood estimate for a binomial distribution. Here is my code: y - c(2, 4, 2, 4, 5, 3) n - length(y) binomial.ll - function (pi, y, n) {## define log-likelihood output - y*log(pi)+(n-y)*(log(1-pi)) return(output) } binomial.mle - optim(0.01,

Re: [R] Error in optim function.

2011-09-26 Thread Berend Hasselman
jango wrote: I'm trying to calculate the maximum likelihood estimate for a binomial distribution. Here is my code: y - c(2, 4, 2, 4, 5, 3) n - length(y) binomial.ll - function (pi, y, n) {## define log-likelihood output - y*log(pi)+(n-y)*(log(1-pi)) return(output) }

[R] How to terminate R program if found any execution error

2011-09-26 Thread arunkumar1111
Hi I want to terminate R process if there are any execution error. a=a b=10 c=try(a/b) if(class(c)[1]==try-error) { stop(Wrong Input Value) } d=c*c if c fails then it should terminate the process. Please can anyone help -- View this message in context:

[R] two-way anova help

2011-09-26 Thread Austin Paul
Hello, I am having some trouble coding a two-way anova due to replicated treatments. I have a factorial design with three male parents and three female parents. They were mated in all combinations and their babies were grown out and measured for size. 50 babies were measured for each of the 9

Re: [R] Error in optim function.

2011-09-26 Thread Rolf Turner
(a) This is pretty obviously homework; the r-help list is *not* for giving help with homework. (b) *Read* the error message! (c) Your expression for the log likelihood is wrong in more than one way. (The number of observations is *not* the same thing as the number of trials for a given

Re: [R] survival analysis: interval censored data

2011-09-26 Thread Daniel Malter
Please adhere to the posting guide (i.e., provide a sample of self contained code and provide the error message). And what does but it is not working mean? Is there an error code? rueu wrote: hello: my data looks like: time1  time2   event  catagoria 2004    2006        1            C

Re: [R] Boxplot BUT with Mean, SD, Max Min ?

2011-09-26 Thread Petr PIKAL
Gabor, Bill, On 2011-09-27 02:51, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 12:11 PM, Philip Rhoades p...@pricom.com.au wrote: Gabor, On 2011-09-27 00:35, Gabor Grothendieck wrote: On Mon, Sep 26, 2011 at 9:56 AM, Philip Rhoades p...@pricom.com.au wrote:

Re: [R] Testing for arguments in a function

2011-09-26 Thread Duncan Murdoch
On 11-09-26 8:49 PM, David Winsemius wrote: On Sep 26, 2011, at 8:04 PM, Duncan Murdoch wrote: On 11-09-26 5:15 PM, David Winsemius wrote: On Sep 26, 2011, at 4:56 PM, Duncan Murdoch wrote: On 26/09/2011 3:39 PM, Gene Leynes wrote: I don't understand how this function can subset by i

Re: [R] two-way anova help

2011-09-26 Thread Indrajit Sengupta
Can you explain what do you mean by 5 replicate tanks? Doing a two way anova is very simple in R. You would need to fit a linear model (lm function). Eg.: model - lm(y ~ male + female + male:female, data =) Regards, Indrajit From: Austin Paul

Re: [R] How to terminate R program if found any execution error

2011-09-26 Thread Duncan Murdoch
On 11-09-27 12:20 AM, arunkumar wrote: Hi I want to terminate R process if there are any execution error. a=a b=10 c=try(a/b) if(class(c)[1]==try-error) { stop(Wrong Input Value) } d=c*c if c fails then it should terminate the process. Please can anyone help Keep the

Re: [R] two-way anova help

2011-09-26 Thread Austin Paul
Hi, Yes. As I explained, the three male and three female types were crossed in all combinations (9 ways). For each of the 9 types, I have *5 replicate tanks* (45 total tanks). And from each of the 45 tanks I have 50 observations for size. So the 5 replicates are somehow nested within the