[R] handling constant factors in prediction using svm

2011-10-04 Thread Divyam
Hi users! I am fitting a model with several factor variables as independents using svm. since there are lots of categorical variables,the training and test data sets have been created using dummy.data.frame option from dummies package. I have a factor A in the training data set with 2 levels (0,1)

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Daniel Malter
I have not read the manual, but I drew 1 random normal vectors and 1 random Poisson vectors of length 1 and was unable to reproduce this behavior. Can you provide an example (self-contained code) that reproduces this problem? Thanks, Daniel Jeanne M. Spicer wrote: > > The summary fu

Re: [R] Efficient way to do a merge in R

2011-10-04 Thread Rainer Schuermann
> Any comments are very welcome, So I give it a shot, although I don't have answers but only some ideas which avenues I would explore, not being an expert at all: 1. I would try to be more restrictive with the columns used for merge, trying something like m1 <- merge( x, y, by.x = "V1", by.y =

[R] shapefile kriging

2011-10-04 Thread Leynnard Rey Matillano
I'm new to R and I'm working on point shapefiles. Is there a way that you could interpolate a shapefile via kriging in R using an attribute? All examples on the internet are using txt files and CSVs. Thanks a lot. [[alternative HTML version deleted]] _

Re: [R] Matrix/Vector manipulation

2011-10-04 Thread fernando.cabrera
Correction to my previous mail: my_cumsum(4,R,W) does not return 4.0, it returns 4.9! -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of fernando.cabr...@nordea.com Sent: 4. oktober 2011 08:37 To: r-help@r-project.org Subject: Re: [R]

Re: [R] Efficient way to do a merge in R

2011-10-04 Thread Joshua Wiley
On Tue, Oct 4, 2011 at 12:40 AM, Rainer Schuermann wrote: >> Any comments are very welcome, > So I give it a shot, although I don't have answers but only some ideas which > avenues I would explore, not being an > expert at all: > > 1. I would try to be more restrictive with the columns used for m

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Rolf Turner
On 04/10/11 19:58, Daniel Malter wrote: I have not read the manual, but I drew 1 random normal vectors and 1 random Poisson vectors of length 1 and was unable to reproduce this behavior. Can you provide an example (self-contained code) that reproduces this problem? The OP *did* provi

Re: [R] Efficient way to do a merge in R

2011-10-04 Thread Matthew Dowle
"Joshua Wiley" wrote in message news:canz9z_kopuwkzb-zxr96pvulhhf2znxntxso9xnyho-_jum...@mail.gmail.com... > On Tue, Oct 4, 2011 at 12:40 AM, Rainer Schuermann > wrote: >>> Any comments are very welcome, >> >> 3. If that fails, and nobody else has a better idea, I would consider >> using a dat

Re: [R] cannot install.packages("data.table")

2011-10-04 Thread Matthew Dowle
Assuming you can install other packages ok, data.table depends on R >=2.12.0. Which version of R do you have? _If_ that's the problem, does anyone know if anything prevents R's error message from stating which dependency isn't satisfied? I think I've seen users confused by this before, for other p

Re: [R] shapefile kriging

2011-10-04 Thread Paul Hiemstra
On 10/04/2011 07:48 AM, Leynnard Rey Matillano wrote: > I'm new to R and I'm working on point shapefiles. Is there a way that you > could interpolate a shapefile via kriging in R using an attribute? All > examples on the internet are using txt files and CSVs. Thanks a lot. > [[alternative H

Re: [R] how do i put two scatterplots on same graph

2011-10-04 Thread Paul Hiemstra
On 10/04/2011 06:19 AM, jricci wrote: > Have two sets of scatterplot data > hypothetically > a) stem lenght vs number of petals in red flowers > b) stem lenght vs number of petals in white flowers > > want to place on same scatter plot with same x,y axis but different collored > markers > > How d

[R] matrix of chi-square results for all combinations of data frame

2011-10-04 Thread christiaan pauw
Hi everybody I have a questionnaire with a lot of questions that allow for more than one option to be chosen (like a tickbox in a html form). The data captured on a mobile device and is supplied in a format where every option is a separate variable (logical). I want to develop a generic function t

Re: [R] The use of period in function names and variable names

2011-10-04 Thread S Ellison
See para 10.3.2 'Identifiers' in the R language definition (always distributed with R in the html help system), or ?make.names, for a concise statement of what constitutes a valid variable name in R. It's actually underscores that might give trouble with older versions, not '.'. But they'd have

Re: [R] Quasi-Binomial simulation

2011-10-04 Thread Ben Bolker
saber fallahpour yahoo.com> writes: > > Hi > I want to do simulation on quasi-binomial distribution with some covariates. > Does anyone have an idea how to do that? > There is no such thing as a quasi-binomial distribution, but if you parameterized the beta-binomial distribution appropriate

[R] Matching two datasets and updating values

2011-10-04 Thread Vincy Pyne
Dear R forum I have two datafarmes with category and cat_val forming one dataframe and cust and cust_category forming another dataframe. category = c("C", "D", "B", "A") cat_val = c(0.10, 0.25, 0.40, 0.54) cust = c("cust_1", "cust_2", "cust_3", "cust_4", "cust_5", "cust_6", "cust_7", "cust_8",

Re: [R] Matching two datasets and updating values

2011-10-04 Thread Petr PIKAL
Hi > > Dear R forum > > I have two datafarmes with category and cat_val forming one dataframe and > cust and cust_category forming another dataframe. > > category = c("C", "D", "B", "A") > cat_val = c(0.10, 0.25, 0.40, 0.54) > cust = c("cust_1", "cust_2", "cust_3", "cust_4", "cust_5", "cust_6"

Re: [R] Parsing variable-length delimited strings into a matrix

2011-10-04 Thread jim holtman
Will this do it for you: > x <- readLines(textConnection("A,B,C + B,B + A,AA,C + A,B,BB,BBB,B,B")) > closeAllConnections() > x.s <- strsplit(x, ',') > # determine max length > x.max <- max(sapply(x.s, length)) > # create character matrix > x.mat <- matrix( + sapply(x.s, function(a) c(a, rep(NA

[R] texi2dvi problem when compiling incorrect Latex code

2011-10-04 Thread syrvn
Hello, I am working on a big R project using Eclipse/StatET/Texlipse. I'd like to write a Latex document within that project but DO NOT want to Sweave it. It's pure Latex. Via the external tools configurations I set up 2 different versions to ensure that my latex document is processed correctly.

[R] Problem with .C

2011-10-04 Thread Grigory Alexandrovich
Hello, I wrote a function in C, which works fine if called from the main-function in C. But as soon as I try to call this function from R like .C('foo', as.double(x), as.integer(y)), the programm crashes. I created a dll with the cmd command R --arch x64 CMD SHLIB foo.c and loaded it into

[R] Adonis and nmds help and questions for a novice.

2011-10-04 Thread Ashley Houlden
Hi, forgive me if someone has already posted about this but I have had a look and cannot find the answer, also I am very new to R and been getting the grips with this. I have been trying to use Adonis to find out if there are significant difference between groups on data that I have analyses w

[R] creating subsets and calculating weights

2011-10-04 Thread Samir Benzerfa
Dear all, propably this question sounds stupid to you, but since I'm new to R I got some troubles regarding the following issue (The table below does not represent my real data, it is just a simplified example): My intention is to first subdivide my data into several groups of vectors, let'

[R] About stepwise regression problem

2011-10-04 Thread pigpigmeow
First of all, I have GAMs noxd<-gam(newNOX~pressure+maxtemp+s(avetemp,bs="cr")+s(mintemp,bs="cr")+s(RH,bs="cr")+s(solar,bs="cr")+s(windspeed,bs="cr")+s(transport,bs="cr"),family=gaussian (link=log),groupD,methods=REML) Then I type " summary(noxd)". and show Family: gaussian Link function: log

[R] package.skeleton generates ".env = "

2011-10-04 Thread pedabreu
Hello, i trying to create a package using package.skeleton. I use R.oo package to create oriented-object classes. When i use package.skeleton, this creates the following file: classA <- structure(function() { extend(Object(),"Class A",

[R] Giant font on the R plots...

2011-10-04 Thread D.Emad
Hello, I've been facing a really stupid problem... When I try to plot using heatplot or hclust or any similar function, the labels of the x-axis - which are the samples names - are giant & overlapping. I can't even read the samples names! I tried cex.lab = 0.5, it helped only with the y axis and

[R] Rug plot curve reversal

2011-10-04 Thread Peter Minting
Dear R-help Can anyone tell me why my curve appears the wrong way round on a rug plot? I am using the same code as on pg 596 of the Crawley R-book. mod<-glm(mort~logBd,binomial) par(mfrow=c(2,2)) xv<-seq(0,8,0.01) yv<-predict(mod,list(logBd=xv),type="response") plot(logBd,mort) lines(xv,yv) I've t

[R] Plotting a polygon with xyplot

2011-10-04 Thread markm0705
Dear R helpers I would like to plot a string of points as a polygon in xyplot. I'm a bit lost as to how to get the points plotting in the correct order. I would also like some hints on how to render or fill the polygon. Scrpt below and data file attached Thanks Markm library("lattice") # se

Re: [R] Merge two data frames and find common values and non-matching values

2011-10-04 Thread francesca casalino
Yes, your code did exactly what I needed. Thank you!! -f [[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 http://www.R-project.org/posting-gu

Re: [R] Import in R with White Spaces

2011-10-04 Thread francesca casalino
Ok I added quoting and it did work...Not sure why, but thank you for both your replies! -f [[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 ht

[R] Correlation based on the attributes of vertices

2011-10-04 Thread Ali.Abbas
Dear all, I have a directed graph - an Igraph to be more precise - which has some vertices attributes (like dorm, year etc). Edges and the graph itself do not have any attributes. Based on the attributes of the vertices, I'd like to calculate correlation among the edges (e.g. how likely people of t

Re: [R] Merge two data frames and find common values and non-matching values

2011-10-04 Thread francesca casalino
Sorry---I thought it worked but I think I am actually definitely doing something wrong... The problem might be that there are NA's and there are also duplicated values...My fault. I can't figure out what is going wrong... I'll be more thorough and modify the two df to mirror more what I have to ex

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Bert Gunter
You are right, but this is difficult or impossible to really solve. The problem is that summary() is an S3 generic(?UseMethod) -- so essentially it can mean anything and do anything depending on the structure to which it's applied. In your case, the structures were a data frame and a vector (that

Re: [R] Plotting a polygon with xyplot

2011-10-04 Thread Ken Knoblauch
markm0705 gmail.com> writes: > I would like to plot a string of points as a polygon in xyplot. I'm a bit > lost as to how to get the points plotting in the correct order. I would > also like some hints on how to render or fill the polygon. > > Scrpt below and data file attached > > Thanks > >

Re: [R] package.skeleton generates ".env = "

2011-10-04 Thread Duncan Murdoch
On 04/10/2011 6:40 AM, pedabreu wrote: Hello, i trying to create a package using package.skeleton. I use R.oo package to create oriented-object classes. When i use package.skeleton, this creates the following file: classA<- structure(function() { extend(Object(),"Clas

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
On Mon, Oct 3, 2011 at 12:24 PM, Thomas Adams wrote: >  I'm interested in creating a graphic -like- this: > > c <- ggplot(mtcars, aes(qsec, wt)) > c + geom_point() + stat_smooth(fill="blue", colour="darkblue", size=2, alpha > = 0.2) > > but I need to show 2 sets of bands (with different shading) u

[R] Adding multiple gates/filters in densityplot

2011-10-04 Thread Michael Jahn
Hi R-Users, I posted this question a while ago on the bioconductor mailing list but got no answers. Maybe here is somebody who might know a solution: I failed at drawing multiple filters in a densityplot() using the FlowCore/FlowViz packages. I found a way to draw multiple filters in xyplot(),

Re: [R] Plotting a polygon with xyplot

2011-10-04 Thread Bert Gunter
?? Use the appropriate panel function, not panel.xyplot(). If you don't know what this means, you need to read up on lattice/trellis graphics. ?panel.polygon -- Bert On Tue, Oct 4, 2011 at 7:14 AM, Ken Knoblauch wrote: > markm0705 gmail.com> writes: > > I would like to plot a string of points

[R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Panagiotis
Hi, I applied a linear mixed effect model in my data using the nlme package. lme2<-lme(distance~temperature*condition, random=~+1|trial, data) and then anova. I want to ask if it is posible to get the least squares means for the interaction effect and the corresponding 95%ci. And then plot this v

[R] [R-pkgs] `partykit': A Toolkit for Recursive Partytioning

2011-10-04 Thread Torsten Hothorn
New package `partykit': A Toolkit for Recursive Partytioning The purpose of the package is to provide a toolkit with infrastructure for representing, summarizing, and visualizing tree-structured regression and classification models. Thus, the focus is not on _inferring_ such a tree structure fro

Re: [R] ggplot2: expression() in legend labels?

2011-10-04 Thread Hadley Wickham
You need to set the labels... Hadley On Sat, Sep 24, 2011 at 3:49 AM, Casper Ti. Vector wrote: > Is there any way to use expression() in legend labels with ggplot2? > > It seems that things like >> scale_shape_manual(value = c( >>   x = expression(italic(x)), >>   y = expression(italic(y)) >> ))

Re: [R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Bert Gunter
Below. On Tue, Oct 4, 2011 at 7:34 AM, Panagiotis wrote: > Hi, > > I applied a linear mixed effect model in my data using the nlme package. > lme2<-lme(distance~temperature*condition, random=~+1|trial, data) and then > anova. > I want to ask if it is posible to get the least squares means for th

Re: [R] how do i put two scatterplots on same graph

2011-10-04 Thread William Revelle
If the data are from one data.frame (e.g., the iris data set), then simply label the red and white flowers with different colors: e.g., with the iris data set plot(iris$Sepal.Length,iris$Sepal.Width,col=c("red","blue","black")[iris$Species],pch=c(16:18)[iris$Species]) Bill On Oct 4, 2011,

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Bert Gunter
On Tue, Oct 4, 2011 at 7:42 AM, Jeanne M. Spicer wrote: > I'm not sure how returning an incorrect result is ever a 'positive' feature > > It is **not** "incorrect"; perhaps unexpected, but that is not the same. > but at least the documentation could more clearly warn users that this > method be

Re: [R] file input with readLines

2011-10-04 Thread Uwe Ligges
On 03.10.2011 19:19, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote: I am using readLines to read a fairly large ASCII file. readLines reads a fixed number of lines, then other R code processes the data, then readLines reads the same number of lines again, then other R code processes the data, th

[R] adding a dummy variable...

2011-10-04 Thread grazia
Hi all, I have a dataset of individuals where the variable ID corresponds to the identification of the household where the individual lives. rel.head stands for the relationship with the household head. so rel.head=1 is the household head, rel.head=2 is the spouse, rel.head=3 is the children. Her

Re: [R] Installation from local Compiled directory

2011-10-04 Thread Uwe Ligges
On 03.10.2011 18:16, Sandeep Patil wrote: Hello everyone I have manually compiled directory of gstat in a particular folder of my Unix system. I want to install this and am unable to use either of the following two commands 1. R CMD INSTALL 2. Install.packages If this is a precompiled (i

[R] [Workshop] Finance with R

2011-10-04 Thread Peter Ruckdeschel
The Financial Mathematics department of Fraunhofer ITWM is offering a two-days workshop on Finance with R: %- [Workshop] Finance with R %- Oct 20, 2011, 10:00-17:00 and Oct 21, 2011, 9:00-16:

Re: [R] handling constant factors in prediction using svm

2011-10-04 Thread Uwe Ligges
On 04.10.2011 08:53, Divyam wrote: Hi users! I am fitting a model with several factor variables as independents using svm. since there are lots of categorical variables,the training and test data sets have been created using dummy.data.frame option from dummies package. I have a factor A in th

Re: [R] The use of period in function names and variable names

2011-10-04 Thread jdospina
Hello. Not at all in the way you have shown. Just to improve your code "readability", try to avoid naming your variables beginning with period (example: .hello). In contrast with Matlab (for example) the period in R is not to have access to an object property. -- View this message in context: h

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Jeanne M. Spicer
I'm not sure how returning an incorrect result is ever a 'positive' feature but at least the documentation could more clearly warn users that this method behaves differently in these cases -- summary(rock[,1]) vs summary(rock[,1:2]) -- and that the method can and does return incorrect results wi

Re: [R] ggplot2: expression() in legend labels?

2011-10-04 Thread Casper Ti. Vector
Hmm, that's my fault when composing this mail, but the problem was really encountered at that time. Nevertheless, neither can I reproduce the problem now, perhaps I just made another mistake at that time. Thanks all the same, and sorry for the disturbance anyway :| On Tue, Oct 04, 2011 at 10:10:56

Re: [R] Question about linear mixed effects model (nlme)

2011-10-04 Thread Ben Bolker
Bert Gunter gene.com> writes: > > Below. > > On Tue, Oct 4, 2011 at 7:34 AM, Panagiotis hi.is> wrote: > > > Hi, > > > > I applied a linear mixed effect model in my data using the nlme package. > > lme2<-lme(distance~temperature*condition, random=~+1|trial, data) and then > > anova. > > I want

Re: [R] ggplot2: expression() in legend labels?

2011-10-04 Thread Dennis Murphy
Hi: Here's a reproducible example: d <- data.frame(grp = factor(rep(c('x', 'y'), each = 5)), ev = rnorm(10), dv = rnorm(10)) labl <- list(expression(italic('x')), expression(italic('y'))) ggplot(d, aes(x = ev, y = dv, shape = grp)) + geom_point() + scale_shape_manual('Group',

Re: [R] The use of period in function names and variable names

2011-10-04 Thread Steve Lianoglou
Hi, On Tue, Oct 4, 2011 at 11:39 AM, jdospina wrote: > Hello. > > Not at all in the way you have shown. Just to improve your code > "readability", try to avoid naming your variables beginning with period > (example: .hello). Well, that's not exactly true. It's "common practice" to name variable

Re: [R] Rug plot curve reversal

2011-10-04 Thread Uwe Ligges
On 04.10.2011 13:30, Peter Minting wrote: Dear R-help Can anyone tell me why my curve appears the wrong way round on a rug plot? I am using the same code as on pg 596 of the Crawley R-book. mod<-glm(mort~logBd,binomial) What is mort, what is logBd? I don't have access to the book. I have

Re: [R] The use of period in function names and variable names

2011-10-04 Thread Duncan Murdoch
On 04/10/2011 7:04 AM, S Ellison wrote: See para 10.3.2 'Identifiers' in the R language definition (always distributed with R in the html help system), or ?make.names, for a concise statement of what constitutes a valid variable name in R. It's actually underscores that might give trouble with

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Uwe Ligges
On 04.10.2011 16:42, Jeanne M. Spicer wrote: I'm not sure how returning an incorrect result is ever a 'positive' feature but at least the documentation could more clearly warn users that this method behaves differently in these cases -- summary(rock[,1]) vs summary(rock[,1:2]) -- and that th

Re: [R] The use of period in function names and variable names

2011-10-04 Thread Uwe Ligges
On 04.10.2011 18:18, Duncan Murdoch wrote: On 04/10/2011 7:04 AM, S Ellison wrote: See para 10.3.2 'Identifiers' in the R language definition (always distributed with R in the html help system), or ?make.names, for a concise statement of what constitutes a valid variable name in R. It's actua

Re: [R] Problem with .C

2011-10-04 Thread Uwe Ligges
Without knowing that C code, we cannot know. Have you read Writing R Extensions carefully? I.e. take care with memory allocation and printing as mentioned in the manual. Uwe Ligges On 04.10.2011 14:04, Grigory Alexandrovich wrote: Hello, I wrote a function in C, which works fine if called f

Re: [R] adding a dummy variable...

2011-10-04 Thread Martyn Byng
Hi, I am sure there are better / more efficient ways of doing this, but the following seems to work ... ids <- sapply(split(df,df$ID),function(x) {length(x$rel.head)==2 & any(x$rel.head==1) & any(x$rel.head==3)}) ids <- as.numeric(names(ids)[ids]) added.dummy <- as.numeric(df$ID%in%ids) cbind(df

Re: [R] Problem with .C

2011-10-04 Thread Jeff Newmiller
This looks like a classic case of not reading the manual, and then compounding it by not reading the posting guide. The manual would be the "Writing R Extensions" pdf that comes with R or you can google it. The posting guide is referenced at the bottom of this and every other posting on this mai

Re: [R] Giant font on the R plots...

2011-10-04 Thread Uwe Ligges
On 04.10.2011 11:10, D.Emad wrote: Hello, I've been facing a really stupid problem... When I try to plot using heatplot or hclust or any similar function, the labels of the x-axis - which are the samples names - are giant& overlapping. I can't even read the samples names! R> heatplot Error:

[R] number of analogs in significance test of MAT reconstructions using randomTF from palaeoSig

2011-10-04 Thread Jason Paul Joines
I'm trying to use the randomTF function from package palaeoSig to test the significance of a MAT reconstruction with nine analogs and a WA-PLS reconstruction with four components. I'm probably missing something obvious here but how do I make sure that randomTF is testing the reconstruction

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas . Adams
Hadley, Thanks for responding. No, not smoothed quantile regression. If you go here: http://www.erh.noaa.gov/mmefs/index.php and click on one of the colored squares, you can see we have 'boxplots'. What I want to express is the uncertainty as depicted in the example from my previous email where

Re: [R] adding a dummy variable...

2011-10-04 Thread Dennis Murphy
Hi: Here's another way to do it with the plyr package, also not terribly elegant. It assumes that rel.head is a factor in your original data frame: > str(df) 'data.frame': 11 obs. of 2 variables: $ ID : Factor w/ 6 levels "17100","17101",..: 1 1 2 3 4 4 5 5 5 6 ... $ rel.head: Factor w/

[R] Reading stopwords from a csv file

2011-10-04 Thread vioravis
I am using the tm package to do text miniing: I have a huge list of stopwords (2000+) that are in a csv file. I read it as follows: stopwordlist <- read.csv("stopwords to be Removed 10042011.csv") myStopwords <- as.character(stopwordlist$stopwords) When try removing the stopwords using tr1=tm_

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
Hi: The smooth is not going to replicate the quantile estimates you get from the 'boxplots'; the smooth is estimating a conditional mean using loess, with confidence limits associated with uncertainty in the estimate of the conditional mean function, which are almost certainly going to be narrower

[R] How to subset() from data frame using specific rows

2011-10-04 Thread Rich Shepard
I have a data frame called chemdata with this structure: str(chemdata) 'data.frame': 14886 obs. of 4 variables: $ site: Factor w/ 148 levels "BC-0.5","BC-1",..: 104 145 126 115 114 128 124 2 3 3 ... $ sampdate: Date, format: "1996-12-27" "1996-08-22" ... $ param : Factor w/ 8 lev

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Sarah Goslee
Hi Rich, You can use something like this: > testdata <- c("A1", "A2", "A3", "B1", "B2", "B3") > grep("^A", testdata) [1] 1 2 3 > grepl("^A", testdata) [1] TRUE TRUE TRUE FALSE FALSE FALSE Sarah On Tue, Oct 4, 2011 at 2:39 PM, Rich Shepard wrote: >  I have a data frame called chemdata with t

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread R. Michael Weylandt
This isn't going to be the most elegant, but it should work: ## Get the factors as characters ff <- as.character(chemdata$site) ## Identify those that match what you want ff <- grepl(ff, "BC-") now use this logical vector to subset chemdata[ff, ] Can't test, but should be good to go assuming

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Rich Shepard
On Tue, 4 Oct 2011, Sarah Goslee wrote: You can use something like this: testdata <- c("A1", "A2", "A3", "B1", "B2", "B3") grep("^A", testdata) [1] 1 2 3 grepl("^A", testdata) [1] TRUE TRUE TRUE FALSE FALSE FALSE Sarah, I don't see how this gives me a data frame containing only thos

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Sarah Goslee
Hi Rich, On Tue, Oct 4, 2011 at 2:58 PM, Rich Shepard wrote: > On Tue, 4 Oct 2011, Sarah Goslee wrote: > >> You can use something like this: >> >>> testdata <- c("A1", "A2", "A3", "B1", "B2", "B3") >>> grep("^A", testdata) >> >> [1] 1 2 3 >>> >>> grepl("^A", testdata) >> >> [1]  TRUE  TRUE  TRUE

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Rich Shepard
On Tue, 4 Oct 2011, R. Michael Weylandt wrote: This isn't going to be the most elegant, but it should work: ## Get the factors as characters ff <- as.character(chemdata$site) ## Identify those that match what you want ff <- grepl(ff, "BC-") Michael, Apparently grep works differently in R

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Jeff Newmiller
?grep ?names Use indexing by name [, namevector] --- Jeff Newmiller The . . Go Live... DCN: Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Em

Re: [R] adding a dummy variable...

2011-10-04 Thread baptiste auguie
Hi, Using ddply, ddply(df, .(ID), mutate, nrows=length(rel.head), test = nrows==2 & all(rel.head %in% c(1,3))) HTH, baptiste On 5 October 2011 06:02, Dennis Murphy wrote: > Hi: > > Here's another way to do it with the plyr package, also not terribly > elegant. It assumes that rel.head is a f

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Bert Gunter
... and, as an aside, if you had simply searched within R for (the obvious?!) ??wildcard you would have received the suggestion for glob2rx() in utils, which actually would have enabled you to use a familiar wildcard expression. However, the answers you've already received are simpler and more st

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread R. Michael Weylandt
No, that was just a typo on my end: the correct order of arguments should have been ff <- grepl("BC-", ff) On Tue, Oct 4, 2011 at 3:07 PM, Rich Shepard wrote: > On Tue, 4 Oct 2011, R. Michael Weylandt wrote: > >> This isn't going to be the most elegant, but it should work: >> ## Get the factors

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Hadley Wickham
> # Function to compute quantiles and return a data frame > g <- function(d) { >   qq <- as.data.frame(as.list(quantile(d$y, c(.05, .25, .50, .75, .95 >   names(qq) <- paste('Q', c(5, 25, 50, 75, 95), sep = '') >   qq   } You could cut out the melt step by making this return a data frame: g <

[R] Tinn-R

2011-10-04 Thread Charles McClure
I am new to R and have recently tried Tinn-R with very mixed and unexpected results. Can you point me to a Tinn-R tutorial on the web or a decent reference book? Thank you for your help; Charles McClure cmccl...@atrcorp.com cfmccl...@verizon.net __ R-

Re: [R] Reading stopwords from a csv file

2011-10-04 Thread vioravis
The following for loops does the work but it takes a good 30 minutes to run: for(i in 1:length(myStopwords)) { currentWord <- myStopwords[i] tr1=tm_map(tr1,removeWords,currentWord) } Are there any faster alternatives?? Thank you. Ravi -- View this message in context: http://r.789695.n4.n

[R] F-values in nested designs

2011-10-04 Thread Marcus Nunes
Hello all I'm trying to learn how to fit a nested model in R. I found a toy example on internet where a dataset that have 3 areas and 4 sites within these areas. When I use Minitab to fit a nested model to this data, this is the ANOVA table that I got: Nested ANOVA: y versus areas, sites Analysi

Re: [R] a question about sort and BH

2011-10-04 Thread R. Michael Weylandt
On Mon, Oct 3, 2011 at 10:08 PM, chunjiang he wrote: > Hi, > > I have two questions want to ask. > > 1. If I have a matrix like this, and I want to figure out the rows whose > value in the 3rd column are less than 0.05. How can I do it with R. > hsa-let-7a--MBTD1    0.528239197    2.41E-05 > hsa-l

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Rich Shepard
On Tue, 4 Oct 2011, Sarah Goslee wrote: You asked for pointers, and didn't provide a reproducible example, so I offered a pointer. Sarah, I did not realize that your pointer was to the factor component of the subset() command. I think the most parsimonious thing for me to do is to modify

Re: [R] How to subset() from data frame using specific rows

2011-10-04 Thread Rich Shepard
On Tue, 4 Oct 2011, R. Michael Weylandt wrote: No, that was just a typo on my end: the correct order of arguments should have been ff <- grepl("BC-", ff) Michael, Thank you. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

[R] joining tables

2011-10-04 Thread Jose Bustos Melo
Hello everyone, I know this is very basic question for you people. I'm working with mani diferent tables, but everyone has the same variables. (V1, V2, V3). The only think that I need to do is to put together this tables. In other words, creating just one big table with all the cases showed in

Re: [R] distance coefficient for amatrix with ngative valus

2011-10-04 Thread R. Michael Weylandt
You are, of course, entirely correct and, once again, I tip my hat to the erudition of those who comment on this list. My initial formulation, for a distance on a normed space inherited from the norm, stands trivially, but as you rightly point out, I'm excluding many interesting and possibly useful

Re: [R] joining tables

2011-10-04 Thread R. Michael Weylandt
Perhaps rbind? Michael On Tue, Oct 4, 2011 at 3:48 PM, Jose Bustos Melo wrote: > Hello everyone, > > I know this is very basic question for you people. I'm working with mani > diferent tables, but everyone has the same variables. (V1, V2, V3). The only > think that I need to do is to put toget

Re: [R] Adonis and nmds help and questions for a novice.

2011-10-04 Thread Gavin Simpson
On Tue, 2011-10-04 at 08:45 +, Ashley Houlden wrote: > Hi, > > forgive me if someone has already posted about this but I have had a > look and cannot find the answer, also I am very new to R and been > getting the grips with this. > > I have been trying to use Adonis to find out if there are

Re: [R] Adonis and nmds help and questions for a novice.

2011-10-04 Thread Gavin Simpson
On Tue, 2011-10-04 at 08:45 +, Ashley Houlden wrote: > Hi, > #distance matrix of samples using bray curtis > d= bcdist(mydata, rmzero=FALSE) In addition, you don't necessarily need ecodist for the bray curtis distance. vegdist() in vegan will compute this for you. Not that there is anything

Re: [R] Tinn-R

2011-10-04 Thread David Scott
On 5/10/2011 7:25 a.m., Charles McClure wrote: I am new to R and have recently tried Tinn-R with very mixed and unexpected results. Can you point me to a Tinn-R tutorial on the web or a decent reference book? Thank you for your help; Charles McClure cmccl...@atrcorp.com cfmccl...@verizon.net

Re: [R] Adonis and nmds help and questions for a novice.

2011-10-04 Thread Sarah Goslee
On Tue, Oct 4, 2011 at 4:41 PM, Gavin Simpson wrote: > On Tue, 2011-10-04 at 08:45 +, Ashley Houlden wrote: >> Hi, > >> #distance matrix of samples using bray curtis >> d= bcdist(mydata, rmzero=FALSE) > > In addition, you don't necessarily need ecodist for the bray curtis > distance. vegdist(

[R] ggplot2: changing default colors of boxplot

2011-10-04 Thread Brian Smith
Hi, I wanted to change the default colors appearing in boxplot. For example, the following code (from the package/documentation): === library(ggplot2) p <- ggplot(mtcars, aes(factor(cyl), mpg)) p + geom_boxplot(aes(fill = factor(am))) === Gives the default colors. What do I nee

Re: [R] a question about sort and BH

2011-10-04 Thread chunjiang he
Dear Michael, Thanks very much. Jiang On Tue, Oct 4, 2011 at 2:39 PM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > On Mon, Oct 3, 2011 at 10:08 PM, chunjiang he wrote: > > Hi, > > > > I have two questions want to ask. > > > > 1. If I have a matrix like this, and I want to figure o

Re: [R] inconsistent behavior of summary function

2011-10-04 Thread Brian Diggs
I'm going to put on my fire suit and wade in (see inline) On 10/4/2011 8:11 AM, Bert Gunter wrote: On Tue, Oct 4, 2011 at 7:42 AM, Jeanne M. Spicerwrote: I'm not sure how returning an incorrect result is ever a 'positive' feature It is **not** "incorrect"; perhaps unexpected, but that is not

Re: [R] how do i put two scatterplots on same graph

2011-10-04 Thread jricci
I am new at this. The two data sets don't have color variable just paired data. How should I structure the data sets in R? Joe Ricci From: William Revelle [via R] To: Joe Ricci Sent: Tue Oct 04 11:18:20 2011 Subject: Re: how do i put two scatterplots on same grap

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Dennis Murphy
Hi Hadley: When I tried your function on the example data, I got the following: dd <- data.frame(year = rep(2000:2008, each = 500), y = rnorm(4500)) g <- function(df, qs = c(.05, .25, .50, .75, .95)) { data.frame(q = qs, quantile(d$y, qs)) } ddply(dd, .(year), g) > ddply(dd, .(year), g) year

Re: [R] Question about ggplot2 and stat_smooth

2011-10-04 Thread Thomas Adams
Hadley: Below is an example of what I am trying to do, I just don't understand how to supply the limits to the blue and pink shaded regions and the values of the black line, which are meant to represent from bottom to top, the 5%, 25%, 50%, 75%, 95% limits that I get from quantile(): h + ge

[R] Assigning genes to CBS segmented output:

2011-10-04 Thread Angel Russo
Hi All, I have an CBS segmentation algorithm output for 10 tumor samples each from 2 different tumors. Now, I am in an urgent need to assign gene (followed by all genes present) that belong to a particular segment after I removed all the CNVs from segment data. The format of the data is: Sample

[R] How many pixels or steps in rasterImage interpolation?

2011-10-04 Thread Carl Witthoft
Hi, I'm looking at a very simple picture created with rasterImage. foo <- matrix(1:9,3,3) foo[,] <- rainbow(9) plot(0:1,0:1,t='n') rasterImage(foo,0,0,1,1) If I choose to specify interpolate=F, I get the expected 9 blocks of color. My question is: how many values (aka pixels) does rasterImage

[R] Problems loading package hydroTSM

2011-10-04 Thread Eduardo M. A. M.Mendes
Hello I have the following problem when loading the package hydroGOF on Windows 7 running R.12.2 library(hydroGOF) Error : package 'hydroTSM' does not have a name space Error: package/namespace load failed for 'hydroGOF' The same command does not result in error on R.13.1 at my Mac r

[R] break.axis all range of data

2011-10-04 Thread Heverkuhn Heverkuhn
Hello R users, I have a plot type=b with x axis at=(1:36), I would like to increase the distance between x tick-marks 8 and 9, and not connect the points x=8 and x=9. I can do the second thing, setting type="p" and then drawing the lines, but I don't know how to do the first. Plus, I was wond

  1   2   >