Re: [R] species projected in a ordiplot

2011-03-07 Thread Jari Oksanen
santi8 unisi.it> writes: > > 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,

Re: [R] allocating factor levels

2011-03-07 Thread Dennis Murphy
Hi: Here's one way to piece it together. All we need is the first variable, so I'll manufacture a vector of Start.action's and go from there. w <- data.frame(Start.action = c(rep('Start.setting', 3), rep('Start.hauling', 4), rep('Start.setting', 4), rep('Start.hau

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

2011-03-07 Thread array chip
Hi Bert, thank you for your thoughtful and humorous comments, :-) It is scientifically meaningful to do those comparisons, and the results of these comparisons actually make sense to our hypothesis, i.e. one is significant at B2 level while the other is not at B1 level. Just unfortunately, the

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

2011-03-07 Thread Jim Lemon
On 03/08/2011 08:26 AM, Jorge Ivan Velez wrote: Hi Jan, R> citation('RODBC') Hi all, Upon reading this, I decided to check that this worked in the plotrix package. The first format is correct, but for some reason the BibTeX format isn't: To cite package 'plotrix' in publications use: L

Re: [R] Sorting

2011-03-07 Thread Jorge Ivan Velez
Hi Whitney, If I understood correctly, what you actually want is to construct a 2x2 table considering "smoking" and "retlevel". Perhaps something along the lines of with(yourdata, table(retlevel, smoking)) could give you some insights. See ?table for more details. HTH, Jorge On Mon, Mar 7, 2

Re: [R] MCMC_glm models

2011-03-07 Thread Jorge Ivan Velez
Hi Nick, The following would be one way of doing what you want: # function to estimate one model foo <- function(mu = 9.244655, n = 50){ X <- rpois(n, mu) glm(X ~ Y, family = poisson) # note I am using family = poisson } B <- 1000 # number of samples -- change accordingly Y <- 19

[R] problem in plot after calculating the derivative

2011-03-07 Thread Hong Qin
Here is a test code to calculate the derivative of a curve in sliding windows. I generated a linear example, and it should plot the derivative in a straight line. But, it does not?! -- x = seq(0,10,by=0.1) y = x * 0.5 + 0.1 window=15; half = floor( window/2) x2 = half: (length(x)-hal

Re: [R] allocating factor levels

2011-03-07 Thread Don McKenzie
Maybe clumsy but shows the activity. The idea is to use a numeric index to separate cases where Start.action is the same. (untested) my.data$action <- rep("set.or.haul ",20) my.data$recnums <- c(1:20) my.data$action[my.data$Start.action=="Start.setting" & my.data $recnums < 7] <- "set1" my.d

[R] Sorting

2011-03-07 Thread Whitney Kistler
I apologize in advance if this is posted all ready I have not been able to find any information about it. I have this data frame and I want to sort smoking by retlevel. Age Gender BMI Calories Fat Fiber Alc retlevel Smoking 164 Female 18.87834 1828.0 63.4 14.7 0.0

[R] Nesting random effects in lmer

2011-03-07 Thread MRak
Dear R experts, Could you please tell me how to nest random effects in an lmer model? Right now, my function looks like this: Full<-lmer(Consortship~((1|Male)+(1|Female))+MaleRank+MaleAge+MMGroom+MMAggrRankControl+FemaleRank+FemaleAge+MFAggrMating+GroomBirth07+MatNoConsortGroomF, family=poisson)

[R] allocating factor levels

2011-03-07 Thread Darcy Webber
Dear R users, I am working on allocating the rows within a dataframe into some factor levels.Consider the following dataframe: Start.action Start.time 1Start.setting2010-12-30 17:58:00 2Start.setting2010-12-30 18:40:00 3S

[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 (Age&sex) 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, gam1

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 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 (e.g. P value =

[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

[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 l

[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 cont

[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] 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)<

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 (len>1) for (i in 2:len) { d[i] = d[i-1] + theoP[i] - theoP[i-1] } 2. How to create

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, y,...

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, ] __ R

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

[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 f

[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

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 up

[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: <>= [stuff] @ <>= [st

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, ...) {

Re: [R] More appropriate optimization routine?

2011-03-07 Thread Ben Bolker
Dimitri Liakhovitski 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, 1245213.965, 19

Re: [R] linear mixed model with nested factors

2011-03-07 Thread Ben Bolker
David Dudek 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) site*year

[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 https://stat.ethz.ch/mailma

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

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, wrote: Cesar, I think your basic misconception is that you believe 'sample' returns a list of indices into the origi

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 wrote:

[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," ",s^-1,"]",

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 = rep(c(

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 imp

[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, 1034030

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{, titl

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 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? > > Taking for instanc

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

2011-03-07 Thread S Ellison
>>> Duncan Murdoch 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 downs

[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

[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. B

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) i

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 plot.

[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 predi

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é 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 hav

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 empt

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 ?setClas

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", "a",sascmd=

[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] 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" t

Re: [R] Risk differences with survey package

2011-03-07 Thread Thomas Lumley
On Tue, Mar 8, 2011 at 6:50 AM, 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 > prevalences easily enough with > > resul

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 caref

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 any

[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 h

[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 clo

[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"] S

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 modif

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): attach(wate

[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] 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-h

Re: [R] png inside loop

2011-03-07 Thread Joshua Wiley
Dear Sacha, On Mon, Mar 7, 2011 at 9:28 AM, 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): > > attach(water) # I know, this is not recommended 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 >>-Ori

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 ab

[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"

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] Replac

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 Messa

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") update.p

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 t

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 eleme

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 fil

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

[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 s

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"

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" wrote: >Dear R People: > >When I want to produce a small sample confidence interval using >t.test, I get the following: > >> t.test(buz

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 s

[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 : t

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 wrote: > Hi, > > I ha

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("H

[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 detac

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 land

[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" argum

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 0.6+0

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] 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] 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 printin

[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, 2

[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] 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 su

[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 model

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 ve

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] 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 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 figure this

[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 n>m. 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] 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

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 f

[R] Fwd: Fwd: r.dll

2011-03-07 Thread wesley mathew
Thank you very much. -- Forwarded message -- From: Uwe Ligges Date: 2011/3/5 Subject: Re: [R] Fwd: r.dll To: wesley mathew Cc: r-help@r-project.org On 04.03.2011 19:40, wesley mathew wrote: > Dear All > > I downloaded R-2.12.2.tar file, but I could not find R.dll file there

[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 t

[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 Attr

[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 t

  1   2   >