Re: [R] sorting subsetting a data.frame

2011-03-07 Thread David Winsemius
On Mar 6, 2011, at 7:34 PM, David Winsemius wrote: On Mar 6, 2011, at 6:05 PM, Liviu Andronic wrote: On Sun, Mar 6, 2011 at 11:53 PM, Liviu Andronic landronim...@gmail.com wrote: On Sun, Mar 6, 2011 at 11:49 PM, Liviu Andronic landronim...@gmail.com wrote: Dear all This may be obvious,

[R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hi, I am missing something obvious. Need to create vector as: (0, i-1 + TheoP(i) - TheoP(i-1), repeat) Where i is the index position in the vector and i[1] is always 0. Found myself having to use a For Loop because I could not get sapply working. Any suggestions ? delta - function(x)

[R] Preferred way to create bubble plots?

2011-03-07 Thread Al Roark
I have to create a number of bubble plots, and am wondering what methods folks prefer for this task. I've been experimenting with the symbols() function, with text() to provide plot labels. Any opinions on the relative merits of this method versus others? One criterion would be the ability to

Re: [R] Zero Inflated Distributions

2011-03-07 Thread vioravis
Any help on this would be appreciated. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/Zero-Inflated-Distributions-tp3334861p3338344.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org

Re: [R] Probabilities outside [0, 1] using Support Vector Machines (SVM) in e1071

2011-03-07 Thread Allan Engelhardt
predict.svm only returns probabilities for model types (Model$type) less than 2, which I guess are classification models (?). In any case, the probabilities are returned as an attribute which your result clearly lacks. Trivial example: model- svm(Species ~ ., data = iris[-1,],

[R] rowSums - am I getting something wrong?

2011-03-07 Thread Thomas.Salvesen
I am trying to construct a data set with some sequences for example: a = seq(0,1,0.1) m = matrix(nrow = 1331, ncol = 3) m[,1] = rep(a,121) m[,2] = rep(a,11,each = 11) m[,3] = rep(a,1,each = 121) I realize that there may be better ways of doing this, but this approach demonstrates the problem

Re: [R] wireframe() display a graph with two colors, not a gradient.

2011-03-07 Thread Deepayan Sarkar
On Sun, Feb 27, 2011 at 1:29 AM, James Platt james-pl...@hotmail.co.uk wrote: Hi all, I'm quite new to wireframe, essentially what I want to do is display a graph, and z-values 1 would be yellow and those 1 would be blue. This is a bit of my data. 0.334643563     0.350913807    

Re: [R] rowSums - am I getting something wrong?

2011-03-07 Thread Ivan Calandra
Hi Tom, That's once again the floating point number issue: see FAQ 7.31. Look at this: sum(m[161,]) [1] 1 sum(m[161,])==1 [1] FALSE sum(m[161,])-1 [1] 2.220446e-16 So 0.6+0.3+0.1 is indeed greater than 1 Try this instead: round(sum(m[161,]))==1 [1] TRUE HTH, Ivan Le 3/7/2011 08:08,

Re: [R] Same color key for multiple lattice contour plots

2011-03-07 Thread Deepayan Sarkar
On Mon, Feb 21, 2011 at 5:29 AM, joepvanderzanden joep_vd_zan...@hotmail.com wrote: Hi all, I'm trying to make multiple lattice contour plots which have the same color key, to allow good comparisons. However, I run into some problems when fitting the plots to the color key. Basically my

Re: [R] sorting subsetting a data.frame

2011-03-07 Thread Liviu Andronic
On Mon, Mar 7, 2011 at 1:38 AM, David Winsemius dwinsem...@comcast.net wrote: subset(x[order(x$Species1), ],  Sepal.Length==6.7 ) Thank you all for the suggestions. Now I can do exactly what I wanted. Regards Liviu __ R-help@r-project.org mailing list

Re: [R] transaction list transformation to use rpart.

2011-03-07 Thread Allan Engelhardt
On 06/03/11 22:34, John Dennison wrote: [...] from data like Customer-ID | Item-ID cust1 | 2 cust1 | 3 cust1 | 5 cust2 | 5 cust2 | 3 cust3 | 2 ... #read in data to a sparse binary transaction matrix txn =

[R] Difference between the S-plus influence and R empinf functions

2011-03-07 Thread The r newbie Fred
Hello everyone ! I am currently trying to convert a program from S-plus to R, and I am having some trouble with the S-plus function called influence(data, statistic,...). This function aims to calculate empirical influence values and related quantities, and is part of the Resample library that

[R] Associating the day of week to a daily xts object

2011-03-07 Thread Victor
I have the following xts objetct temp str(temp) An ‘xts’ object from 2010-12-26 to 2011-03-05 containing: Data: num [1:70, 1] 2.95 0.852 -0.139 1.347 2.485 ... - attr(*, dimnames)=List of 2 ..$ : NULL ..$ : chr t_n Indexed by objects of class: [POSIXct,POSIXt] TZ: GMT xts

[R] clustersets comparison

2011-03-07 Thread Albert Vilella
Hi, I have produced some clustersets with the same program and different parameters and want to compare them. They contain a few thousand clusters each with a few million elements in total. After googling around, I couldn't find much of relevance, so I am asking here. Is there any package in R

[R] Fwd: Fwd: r.dll

2011-03-07 Thread wesley mathew
Thank you very much. -- Forwarded message -- From: Uwe Ligges lig...@statistik.tu-dortmund.de Date: 2011/3/5 Subject: Re: [R] Fwd: r.dll To: wesley mathew wesleycmat...@gmail.com Cc: r-help@r-project.org On 04.03.2011 19:40, wesley mathew wrote: Dear All I downloaded

Re: [R] Problem in installing and starting Rattle

2011-03-07 Thread nerice
CHECK FOR CONFLICTS IN YOUR PATH !!! I had a related problem when trying to use library RGtk2 for the first time. My problem was that when loading the library R was looking for the file zlib1.dll but couldn't find the procedure to launch RGtk2. I was getting an Entry Point not found error from

Re: [R] Associating the day of week to a daily xts object

2011-03-07 Thread Francisco Gochez
Victor, The weekdays function will return the days of the week (as a character vector of names) that a given vector of dates (Date or POSIXct) fall on. These can then be converted into numbers using a look-up table/vector. See below for an example using the sample_matrix data included with the

[R] Array Help

2011-03-07 Thread Usman Munir
Hi, I have two 3 D arrays. Both are of this form array_1- array[n,n,k] array_2-array[m,m,k] Lets say n=83 and m=80 Since nm. I would like to add rows and columns to array_2 to make them equal. I want to keep the size of the third dimension fixed i.e.. k. i.e. if (nrow(array_1)nrow(array_2)) {

Re: [R] Parsing question, partly comma separated partly underscore separated string

2011-03-07 Thread Gabor Grothendieck
On Sun, Mar 6, 2011 at 10:13 PM, Eric Fail eric.f...@gmx.com wrote: Dear R-list, I have a partly comma separated partly underscore separated string that I am trying to parse into R. Furthermore I have a bunch of them, and they are quite long. I have now spent most of my Sunday trying to

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 12:34 AM, rivercode wrote: Hi, I am missing something obvious. Need to create vector as: (0, i-1 + TheoP(i) - TheoP(i-1), repeat) Where i is the index position in the vector and i[1] is always 0. I think your prototype is not agreeing with the code below. Is i

Re: [R] Preferred way to create bubble plots?

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 12:11 AM, Al Roark wrote: I have to create a number of bubble plots, and am wondering what methods folks prefer for this task. I've been experimenting with the symbols() function, with text() to provide plot labels. Any opinions on the relative merits of this method

[R] null model for a single species?

2011-03-07 Thread Penner, Johannes
Dear List members, I would like to test whether an observed occupancy of lakes in a landscape has occurred randomly (by chance) or not. How can I do that? The problem is that it concerns only a single species and I would like to use binary data only. At first I thought of generating null

[R] Conflict between gam::gam and mgcv::gam

2011-03-07 Thread Julian Shaw
I am trying to compare and contrast the smoothing in the {mgcv} version of gam vs. the {gam} version of gam but I get a strange side effects when I try to alternate calls to these routines, even though I detach and unload namespaces. Specifically when I start up R the following code runs

[R] XYPLOT - GROUPING WITH TWO CATEGORICAL VARIABLES

2011-03-07 Thread Marcos Prunello
Hi! I have a dataframe like this: dat=data.frame(Age=c(rep(30,8),rep(40,8),rep(50,8)),Period=rep(seq(2005,2008,1),3),Rate=c(seq(1,8,1),seq(9,16,1),seq(17,24,1)),Sex=rep(c(rep(0,4),rep(1,4)),3))attach(dat)dat    Age Period Rate Sex1   30   2005    1   02   30   2006    2   03   30   2007    3   04

[R] a numeric problem

2011-03-07 Thread baicaidoufu
### An numeric problem in R ###I have two matrix one is## A - matrix(c(21.97844, 250.1960, 2752.033, 29675.88, 316318.4, 3349550, 35336827, 24.89267, 261.4211, 2691.009, 27796.02, 288738.7, 3011839, 31498784, 21.80384, 232.3765, 2460.495, 25992.77,

Re: [R] attr question

2011-03-07 Thread Duncan Murdoch
On 07/03/2011 12:11 AM, Erin Hodgess wrote: Dear R People: When I want to produce a small sample confidence interval using t.test, I get the following: t.test(buzz$var1, conf.level=.98)$conf.int [1] 2.239337 4.260663 attr(,conf.level) [1] 0.98 How do I keep the attr statement from printing,

Re: [R] a numeric problem

2011-03-07 Thread Duncan Murdoch
On 07/03/2011 8:46 AM, baicaidoufu wrote: ### An numeric problem in R ###I have two matrix one is## A- matrix(c(21.97844, 250.1960, 2752.033, 29675.88, 316318.4, 3349550, 35336827, 24.89267, 261.4211, 2691.009, 27796.02, 288738.7, 3011839, 31498784,

Re: [R] XYPLOT - GROUPING WITH TWO CATEGORICAL VARIABLES

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 8:37 AM, Marcos Prunello wrote: Hi! I have a dataframe like this: dat = data .frame (Age=c(rep(30,8),rep(40,8),rep(50,8)),Period=rep(seq(2005,2008,1), 3 ),Rate =c(seq(1,8,1),seq(9,16,1),seq(17,24,1)),Sex=rep(c(rep(0,4),rep(1,4)), 3))attach(dat)dat Age Period Rate Sex1

Re: [R] rowSums - am I getting something wrong?

2011-03-07 Thread rex.dwyer
Hi Thomas, Several of us explained this in different ways just last week, so you might search the archive. Floating point numbers are an approximate representation of real numbers. Things that can be expressed exactly in powers of 10 can't be expressed exactly in powers of 2. So the sum

[R] Re transaction list transformation to use rpart.

2011-03-07 Thread Terry Therneau
However the as.data.frame(a) transforms the matrix into a numeric data.frame so when I implement the rpart algorithm it automatically returns a regression classification tree. Look at help(rpart). The program uses the type of the y variable to GUESS at what you want for the method argument.

Re: [R] null model for a single species?

2011-03-07 Thread Mike Marchywka
Date: Mon, 7 Mar 2011 14:15:49 +0100 From: johannes.pen...@mfn-berlin.de To: r-help@r-project.org Subject: [R] null model for a single species? Dear List members, I would like to test whether an observed occupancy of lakes in a landscape

[R] Teaching R: To quote, or not to quote?

2011-03-07 Thread Muenchen, Robert A (Bob)
Hi All, When I teach an intro workshop on R, I've been minimizing quote confusion by always using quotes around package names in function calls. For example: install.packages(Hmisc) update.packages(Hmisc) library(Hmisc) citation(Hmisc) search() # displays package names in quotes

Re: [R] Teaching R: To quote, or not to quote?

2011-03-07 Thread Duncan Murdoch
On 07/03/2011 9:52 AM, Muenchen, Robert A (Bob) wrote: Hi All, When I teach an intro workshop on R, I've been minimizing quote confusion by always using quotes around package names in function calls. For example: install.packages(Hmisc) update.packages(Hmisc) library(Hmisc) citation(Hmisc)

Re: [R] Array Help

2011-03-07 Thread Richard M. Heiberger
abind works well for this example. a1 - array(1:18, dim=c(3,3,2)) a2 - array(101:150, dim=c(5,5,2)) a1b - abind(a1, array(400, dim=c(2,3,2)), along=1) a1c - abind(a1b, array(500, dim=c(5,2,2)), along=2) dim(a1c) a1 a2 a1c On Mon, Mar 7, 2011 at 6:54 AM, Usman Munir

[R] Sweave with scan()-ed data

2011-03-07 Thread Michael Friendly
In an Sweave slide, I want to use sem::read.moments() and sem::specify.model(), which work by using scan() to read the following lines, up to the first blank line. However, Sweave throws an error: Sweave(sem-thurstone.Rnw) Writing to file sem-thurstone.tex Processing code chunks ... 1 :

Re: [R] Sweave with scan()-ed data

2011-03-07 Thread Duncan Murdoch
On 07/03/2011 10:21 AM, Michael Friendly wrote: In an Sweave slide, I want to use sem::read.moments() and sem::specify.model(), which work by using scan() to read the following lines, up to the first blank line. However, Sweave throws an error: Sweave(sem-thurstone.Rnw) Writing to file

Re: [R] attr question

2011-03-07 Thread MacQueen, Don
One way would be to wrap it in as.vector() as.vector( t.test(rnorm(5),rnorm(5))$conf.int ) [1] -0.9718231 1.2267976 -Don On 3/6/11 9:11 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Dear R People: When I want to produce a small sample confidence interval using t.test, I get the

Re: [R] attr question

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 10:44 AM, MacQueen, Don wrote: One way would be to wrap it in as.vector() as.vector( t.test(rnorm(5),rnorm(5))$conf.int ) [1] -0.9718231 1.2267976 Or even c(): c( t.test(rnorm(5),rnorm(5))$conf.int ) [1] -1.055843 1.742806 -Don On 3/6/11 9:11 PM, Erin Hodgess

[R] species projected in a ordiplot

2011-03-07 Thread santi8
Dear all, I'm performing a detrended correspondence analysis on vascular plant community data (296 species), and I have a question on the species scores projected in the ordination diagram. When I run a ordiplot all species are projected in the output graph, but I'd like to restrict the number of

Re: [R] Preferred way to create bubble plots?

2011-03-07 Thread John Dennison
I'm not sure if this exactly what you need but it is a good introduction. and a great website to boot. http://flowingdata.com/2010/11/23/how-to-make-bubble-charts/ John [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Sweave with scan()-ed data

2011-03-07 Thread William Revelle
At 10:21 AM -0500 3/7/11, Michael Friendly wrote: In an Sweave slide, I want to use sem::read.moments() and sem::specify.model(), which work by using scan() to read the following lines, up to the first blank line. However, Sweave throws an error: Sweave(sem-thurstone.Rnw) Writing to file

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hope this clarifies my Q. Creating a vector where each element is (except the first which is 0) is: the previous element + a calculation from another vector theoP[i] - theoP[i-1] I could not figure out how to do this without a for loop, as the vector had to reference itself for the next

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 11:12 AM, rivercode wrote: Hope this clarifies my Q. Creating a vector where each element is (except the first which is 0) is: the previous element + a calculation from another vector theoP[i] - theoP[i-1] I could not figure out how to do this without a for loop, as

Re: [R] Teaching R: To quote, or not to quote?

2011-03-07 Thread Uwe Ligges
On 07.03.2011 16:17, Duncan Murdoch wrote: On 07/03/2011 9:52 AM, Muenchen, Robert A (Bob) wrote: Hi All, When I teach an intro workshop on R, I've been minimizing quote confusion by always using quotes around package names in function calls. For example: install.packages(Hmisc)

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread William Dunlap
Look at the filter() function, which can do recursive and convolutional filtering. cumsum() and diff(), respectively, are special cases of recursive and convolutional filtering and cumsum() may be enough in your case. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread David Reiner
Isn't c(0, cumsum(diff(theoP)) ) just theoP - theoP[1] ? -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: Monday, March 07, 2011 10:52 AM To: rivercode Cc: r-help@r-project.org Subject: Re: [R]

[R] png inside loop

2011-03-07 Thread Sacha Viquerat
hello list! I'm sorry, I just stumbled over this strange behaviour (at least I am not able to explain the behaviour, therefore I assume it to be a strange behaviour): attach(water) # I know, this is not recommended names(water[3:10]) [1] temp pH DO BOD COD no3 no2 po4 for (i in

Re: [R] png inside loop

2011-03-07 Thread Ivan Calandra
Hi, I myself do not use lattice plots, but I think your problem is in FAQ 7.22: you didn't print() your plots. See the R FAQ for more details on it. HTH, Ivan Le 3/7/2011 18:28, Sacha Viquerat a écrit : hello list! I'm sorry, I just stumbled over this strange behaviour (at least I am not

Re: [R] png inside loop

2011-03-07 Thread Riley, Steve
Try: print(xyplot(N_female~eval(parse(text=i)) |group,xlab=i,ylab=Abundance)) Steve Riley, PharmD, PhD Clinical Pharmacology Specialty Care Medicines Development Group Pfizer Inc. 50 Pequot Ave MS-6025-B2110 New London, CT 06320 Email: steve.ri...@pfizer.com Phone: (860) 732-1796

Re: [R] png inside loop

2011-03-07 Thread Joshua Wiley
Dear Sacha, On Mon, Mar 7, 2011 at 9:28 AM, Sacha Viquerat tweedi...@web.de wrote: hello list! I'm sorry, I just stumbled over this strange behaviour (at least I am not able to explain the behaviour, therefore I assume it to be a strange behaviour): attach(water) # I know, this is not

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread David Winsemius
On Mar 7, 2011, at 12:27 PM, David Reiner wrote: Isn't c(0, cumsum(diff(theoP)) ) just theoP - theoP[1] ? I think it just might be. There is no random or systematic factor that modifies that alternating sign in the series. -- other David. -- David -Original Message- From:

[R] Risk differences with survey package

2011-03-07 Thread Michael . Laviolette
I'm trying to use the survey package to calculate a risk difference with confidence interval for binge drinking between sexes. Variables are X_RFBING2 (Yes, No) and SEX. Both are factors. I can get the group prevalences easily enough with result - svyby(~X_RFBING2, ~SEX, la04.svy, svymean, na.rm

Re: [R] png inside loop

2011-03-07 Thread David Winsemius
You need to print lattice objects. See the FAQ. -- David. On Mar 7, 2011, at 12:28 PM, Sacha Viquerat wrote: hello list! I'm sorry, I just stumbled over this strange behaviour (at least I am not able to explain the behaviour, therefore I assume it to be a strange behaviour):

Re: [R] re-arranging data to create an image (or heatmap)

2011-03-07 Thread pierz
It turned out that rearranging the data was indeed the key to get the image I want. The way I do it now is this: tt - read.csv(file=file.csv, header=T, sep=,, dec=., stringsAsFactors=F) names(tt) - c('time','abs') dat - with(tt, table(time, abs)) image(dat,col=rainbow(256)) I'm now modifying the

[R] Help with uniform distribution

2011-03-07 Thread CarlosBala
Hi I have the table data below Simula.Capital-data.frame(Week=c(0:52), Production=0) Simula.Capital$Production-round(c(120,rnorm(52, mean = 100, sd = 25)), 0) weeks=3 i-1; Sell-NULL; Maximo-NULL for(i in seq(along= Simula.Capital$Production)){ Maximo-Simula.Capital[2,Production]

[R] CDF of Sample Quantile

2011-03-07 Thread Bentley Coffey
Just to tie up this thread, I wanted to report my solution: When (n-1)p is an integer, there is a closed form solution: pbinom(j-1,n,...) When it is not an integer, its fairly easy to approximate the solution by interpolating between the closed-form solutions: fitting log(1 - probability from

[R] linear mixed model with nested factors

2011-03-07 Thread David Dudek
Hi R-help. I am trying to run a linear mixed model with nested factors with either lme or lmer and I am having no luck obtaining the same results as Minitab. Here is Minitab's code: MTB GLM 'count' = site year replicate(site year) site*year; SUBC Random 'year' 'replicate'; Can you tell me

Re: [R] linear mixed model with nested factors

2011-03-07 Thread Doran, Harold
David: It is unlikely you will get a helpful response to this. Instead, you will improve your chances of a good response if you do three things: 1) Provide a mathematical description of the model you are trying to estimate 2) Provide a description of the data you have 3) Provide some code or

Re: [R] linear mixed model with nested factors

2011-03-07 Thread Bert Gunter
Think about it. You have asked for help from the R list but have posted no R code, only Minitab code. That means in order to answer, the helpeR must know Minitab. Well, some may, but there's certainly no reason to expect so on an R list. Don't you therefore think it might be wiser to post a

Re: [R] Risk differences with survey package

2011-03-07 Thread Thomas Lumley
On Tue, Mar 8, 2011 at 6:50 AM, michael.laviole...@dhhs.state.nh.us wrote: I'm trying to use the survey package to calculate a risk difference with confidence interval for binge drinking between sexes. Variables are X_RFBING2 (Yes, No) and SEX. Both are factors. I can get the group

Re: [R] Monte carlo help

2011-03-07 Thread Michael D
The way I see it is that you have a non-homogeneous poisson process to describe the way the students arrive and that you're missing the service time of your tutors. The way you are modeling the arrival of students is *really *bad. At most, only a single student can arrive each hour so to solve

[R] generate 3 distinct random samples without replacement

2011-03-07 Thread Cesar Hincapié
Hello: I wonder if I could get a little help with random sampling in R. I have a vector of length 7375. I would like to draw 3 distinct random samples, each of length 100 without replacement. I have tried the following: d1 - 1:7375 set.seed(7) i - sample(d1, 100, replace=F) s1 - sort(d1[i])

Re: [R] read.ssd() from foreign package

2011-03-07 Thread array chip
Thank you Peter. SAS Universal Viewer can open both SAS datasets. And if I do the following in SAS, it will print out the dataset: libname x 'C:\SASdata'; proc print data=x.a; run; Here are what is in the log files: 1. For the one that doesn't work: tmp-read.ssd(C:\\SASdata,

Re: [R] advice on classes/methods/extending classes

2011-03-07 Thread John Oleynick
Hi Erin, The Chambers book and web page Josh mentioned provide a good description of the S4 object system. Another introduction to S4 is Robert Gentleman's S4 Classes in 15 pages, more or less ( http://www.stat.auckland.ac.nz/S-Workshop/Gentleman/S4Objects.pdf). The help pages for

Re: [R] generate 3 distinct random samples without replacement

2011-03-07 Thread Jonathan P Daily
would this work? s - sample(d1, 300, F) D - data.frame(a = s[1:100], b = s[101:200], c = s[201:300]) -- Jonathan P. Daily Technician - USGS Leetown Science Center 11649 Leetown Road Kearneysville WV, 25430 (304) 724-4480 Is the room still a room when its empty?

Re: [R] generate 3 distinct random samples without replacement

2011-03-07 Thread Sarah Goslee
Cesar, your indexing is wrong: On Mon, Mar 7, 2011 at 2:17 PM, Cesar Hincapié cesar.hinca...@utoronto.ca wrote: Hello: I wonder if I could get a little help with random sampling in R. I have a vector of length 7375.  I would like to draw 3 distinct random samples, each of length 100

[R] use caret to rank predictors by random forest model

2011-03-07 Thread Xiaoqi Cui
Hi, I'm using package caret to rank predictors using random forest model and draw predictors importance plot. I used below commands: rf.fit-randomForest(x,y,ntree=500,importance=TRUE) ## x is matrix whose columns are predictors, y is a binary resonse vector ## Then I got the ranked predictors

Re: [R] use caret to rank predictors by random forest model

2011-03-07 Thread Max Kuhn
It would help if you provided the code that you used for the caret functions. The most likely issues is not using importance = TRUE in the call to train() I believe that I've only implemented code for plotting the varImp objects resulting from train() (eg. there is plot.varImp.train but not

Re: [R] generate 3 distinct random samples without replacement

2011-03-07 Thread Duncan Murdoch
On 07/03/2011 2:17 PM, Cesar Hincapié wrote: Hello: I wonder if I could get a little help with random sampling in R. I have a vector of length 7375. I would like to draw 3 distinct random samples, each of length 100 without replacement. I have tried the following: d1- 1:7375 set.seed(7)

[R] survest() for cph() in Design package

2011-03-07 Thread array chip
Hi, I am trying to run a conditional logistic model on a nested case-control study using cph() and then estimate survival based on the model. The data came from Prof Bryan Langholz website where he also has the SAS code to this, so I am trying to replicate the SAS results. The data attached.

[R] How to reference a package in academical paper

2011-03-07 Thread Jan Hornych
Dear, I am now writing more formal academical paper, and would like to reference an R package. Do you have any recommendation how to do it? Taking for instance the RODBC package as an example, how would the reference look like? http://cran.r-project.org/web/packages/RODBC/index.html Thank you

Re: [R] Teaching R: To quote, or not to quote?

2011-03-07 Thread S Ellison
Duncan Murdoch murdoch.dun...@gmail.com 03/07/11 3:17 PM On 07/03/2011 9:52 AM, Muenchen, Robert A (Bob) wrote: Hi All, When I teach an intro workshop on R, I've been minimizing quote confusion by always using quotes around package names in function calls. ... I'm wondering if there's a

Re: [R] How to reference a package in academical paper

2011-03-07 Thread Saeed Abu Nimeh
http://www.iiap.res.in/astrostat/School07/R/html/utils/html/citation.html On Mon, Mar 7, 2011 at 4:12 PM, Jan Hornych jh.horn...@gmail.com wrote: Dear, I am now writing more formal academical paper, and would like to reference an R package. Do you have any recommendation how to do it?

Re: [R] How to reference a package in academical paper

2011-03-07 Thread Jorge Ivan Velez
Hi Jan, R citation('RODBC') To cite package ‘RODBC’ in publications use: Brian Ripley and and from 1999 to Oct 2002 Michael Lapsley (2010). RODBC: ODBC Database Access. R package version 1.3-2. http://CRAN.R-project.org/package=RODBC A BibTeX entry for LaTeX users is @Manual{,

[R] More appropriate optimization routine?

2011-03-07 Thread Dimitri Liakhovitski
Hello! I have 2 variables - predictor pred and response variable DV: pred-c(439635.053, 222925.718, 668434.755, 194242.330, 5786.321, 115537.344, 100835.368, 7133.206, 159058.286, 4079991.629, 3380078.060, 2661279.136, 2698324.478, 1245213.965, 1901815.503, 1517019.451, 1396857.736,

Re: [R] generate 3 distinct random samples without replacement

2011-03-07 Thread rex.dwyer
Cesar, I think your basic misconception is that you believe 'sample' returns a list of indices into the original vector. It does not; it returns actual elements of the vector: sample(runif(100),3) [1] 0.4492988 0.0336069 0.6948440 I'm not sure why you keep resetting the seed, but if it's

Re: [R] XYPLOT - GROUPING WITH TWO CATEGORICAL VARIABLES

2011-03-07 Thread Dennis Murphy
David, David, David...you forgot the solid and dashed lines :) It's OK, it gives me an excuse to look at this from a slightly different angle. [The intersection() function is a *really* good trick, BTW - thanks for the reminder.] Back to the OP. Let's re-read the data: dat=data.frame(Age =

[R] postscript cuts off left margin

2011-03-07 Thread Eileen Meyer
I am using the following commands: postscript(file=test.eps,paper=special,width=6,height=6,horizontal=FALSE) # fake data x - c(12,13,14) y - c(41,42,43) plot(x,y,type=n,xlab=expression(paste(log ,nu[peak], [Hz],sep=)),ylab=expression(paste(log ,L[peak], [,ergs,

Re: [R] postscript cuts off left margin

2011-03-07 Thread Eileen Meyer
I found the answer, sorry for not waiting longer before asking. For anyone reading the archives, inserting par(mar=c(5,4,4,2)+0.5) should alleviate the problem (default is +0.1). In general, help(par) is a good thing to check for graphical issues. On 03/07/2011 04:53 PM, Eileen Meyer

Re: [R] generate 3 distinct random samples without replacement

2011-03-07 Thread Cesar Hincapié
Thank you all for your helpful comments and suggestions. Both proper indexing and subsetting a random sample of 300 work well. Best wishes, Cesar On 2011-03-07, at 5:31 PM, rex.dw...@syngenta.com rex.dw...@syngenta.com wrote: Cesar, I think your basic misconception is that you believe

Re: [R] attr question

2011-03-07 Thread Bill.Venables
Erin You could use as.vector(t.test(buzz$var1, conf.level=.98)$conf.int) Bill Venables. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Erin Hodgess Sent: Monday, 7 March 2011 3:12 PM To: R help Subject: [R] attr question Dear

[R] compiling r with icc

2011-03-07 Thread Mag Gam
I am using, http://www.rd.dnc.ac.jp/~otsu/lecture/RwithMKL.html to compile R 2.10 . Everything compiles fine but I was wondering if there are any more optimizations I can do with the flags. __ R-help@r-project.org mailing list

Re: [R] linear mixed model with nested factors

2011-03-07 Thread Ben Bolker
David Dudek david.dudek at student.umb.no writes: Hi R-help. I am trying to run a linear mixed model with nested factors with either lme or lmer and I am having no luck obtaining the same results as Minitab. Here is Minitab's code: MTB GLM 'count' = site year replicate(site year)

Re: [R] More appropriate optimization routine?

2011-03-07 Thread Ben Bolker
Dimitri Liakhovitski dimitri.liakhovitski at gmail.com writes: I have 2 variables - predictor pred and response variable DV: pred-c(439635.053, 222925.718, 668434.755, 194242.330, 5786.321, 115537.344, 100835.368, 7133.206, 159058.286, 4079991.629, 3380078.060, 2661279.136, 2698324.478,

Re: [R] still a problem remainingRE: Data lebals xylattice plot: RE: displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-07 Thread Dennis Murphy
Hi: This works only because all of the observations you want to label are in one panel - it is not a general solution. I used the layer() function from the latticeExtra package for this: library(lattice) library(latticeExtra) xyplot(p ~ xvar|chr, data=dataf, panel = function(x, y, ...) {

[R] beamer overlays with Sweave?

2011-03-07 Thread Ben Bolker
This may be asking too much, but I'm wondering if anyone has a solution (even a hack) for creating multiple (overlay) plots in an Sweave file and post-processing the overlays in beamer appropriately. For example, suppose I have a series of figure blocks in my .Rnw file: plot1,fig=TRUE=

Re: [R] Parsing question, partly comma separated partly underscore separated string

2011-03-07 Thread Eric Fail
Thanks to Gabor Grothendieck and Dennis Murphy I can now solve first part of my problem and already impress my colleagues with the R-program below (I know it could be written in a smarter way, but I am learning). It reads my partly comma separated partly underscore separated string and cleans it

[R] extract rows with unique values from data.frame

2011-03-07 Thread Nicolas Gutierrez
Hello! I have the data frame pop: xloc yloc gonad indEneW Agent 123 20 516.74 1 0.02 20.21 0.25 223 20 1143.20 1 0.02 20.21 0.50 321 19 250.00 1 0.02 20.21 0.25 422 15 251.98 1 0.02 18.69 0.25 524 18 598.08 1 0.02

[R] ok to use glht() when interaction is NOT significant?

2011-03-07 Thread array chip
Hi, let's say I have a simple ANOVA model with 2 factors A (level A1 and A2) and B (level B1 and B2) and their interaction: aov(y~A*B, data=dat) It turns out that the interaction term is not significant (e.g. P value = 0.2), but if I used glht() to compare A1 vs. A2 within each level of B, I

Re: [R] extract rows with unique values from data.frame

2011-03-07 Thread Bill.Venables
Here is possibly one method (if I have understood you correctly): con - textConnection( + xloc yloc gonad indEneW Agent + 123 20 516.74 1 0.02 20.21 0.25 + 223 20 1143.20 1 0.02 20.21 0.50 + 321 19 250.00 1 0.02 20.21 0.25 + 422 15

Re: [R] extract rows with unique values from data.frame

2011-03-07 Thread Nicolas Gutierrez
Dear Bill.. .great, thanks for your quick response. Cheers Nico On 3/7/2011 8:16 PM, bill.venab...@csiro.au wrote: i- with(pop, cumsum(!duplicated(cbind(xloc, yloc k- 2 ## how many do you want? no- min(which(i == k)) pop[1:no, ] __

Re: [R] still a problem remainingRE: Data lebals xylattice plot: RE: displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-07 Thread Bert Gunter
As I believe I already told you in my original reply, you have to make use of the subscripts argument in the panel function to subscript the P values etc. vector to be plotted in each panel. Something like: (untested) panel = function(x, y,subscripts,...) { panel.xyplot(x,

Re: [R] Replace for loop when vector calling itself

2011-03-07 Thread rivercode
Hi, Thanks for your replies. In summary: 1. Replace code with c(0, cumsum(diff(theoP)) ). This is indeed correct and I had not realized it !! d = vector(mode = numeric, length= len) d[1] = 0 if (len1) for (i in 2:len) { d[i] = d[i-1] + theoP[i] - theoP[i-1] } 2. How to create

[R] MCMC_glm models

2011-03-07 Thread Nicholas M. Caruso
Hello, I am trying to run multiple glm models for a dataset and need some help First, i generated a matrix of abundance for 1 populations based on the mean and variance of my dataset X - replicate(1, rpois(50, 9.244655)) and entered the years as row names Y - c(1960:2009) rownames(X)-Y

[R] This is supposed to predict a time series?!

2011-03-07 Thread Ben Simpkins
Hello, I just ran the predict.StructTS function using the AirPassengers data and got a ridiculous result. Here's what I ended up with: http://24.210.155.111/PredictWhat!.pdf Who wrote this? Am I seriously supposed to think this function would accurately predict a time series? -AnalogKid

[R] what controls the limits of x axis in hclust

2011-03-07 Thread casperyc
Hi all, I followed the example in http://www.statmethods.net/advstats/cluster.html and apply it to one of my own dataset, I got this tiny problem with the boreders, http://r.789695.n4.nabble.com/file/n3340238/temp.png The red rectangle are 'outside' the plot, so I want to know how do I

[R] Rmpi fails to install

2011-03-07 Thread rose
I try to install Rmpi as root with install.packages(Rmpi). It fails with: ... checking for x86_64-pc-linux-gnu-gcc -std=gnu99 option to accept ISO C89... none needed I am here /usr and it is OpenMPI Trying to find mpi.h ... Found in /usr/include Trying to find libmpi.so or libmpich.a ... Found

[R] still a problem remainingRE: Data lebals xylattice plot: RE: displaying label meeting condition (i.e. significant, i..e p value less than 005) in plot function

2011-03-07 Thread Umesh Rosyara
Hi Lattice Users I have been working to fix this problem, still I am not able to solve fully. I could label those names that have pvalue less than 0.01 but still the label appears in all compoent plots eventhough those who do have the pvalue ! How can I implement it successuflly to grouped data

Re: [R] ok to use glht() when interaction is NOT significant?

2011-03-07 Thread Bert Gunter
Inline below On Mon, Mar 7, 2011 at 8:08 PM, array chip arrayprof...@yahoo.com wrote: Hi, let's say I have a simple ANOVA model with 2 factors A (level A1 and A2) and B (level B1 and B2) and their interaction: aov(y~A*B, data=dat) It turns out that the interaction term is not significant

[R] SEM error

2011-03-07 Thread Kes
Dear All, I am new for R and SEM. I try to fit the model with Y (ordinal outcome), X (4 categorical data), M1-M3 (continuous), and 2 covariates (Agesex) as a diagram. library(polycor) model.ly -specify.model() 1: x - m1, gam11, NA 2: x - m2, gam12, NA 3: x - m3, gam13, NA 4: age - m1, gam14, NA

  1   2   >