Re: [R] column and line graphs in R

2013-03-14 Thread Marc Girondot
When you send data, use dput() to send them. It is much more easy for people who want to help you. Here is an example. I am not sure if it is what you want but you can play with the code. Sincerely Marc fungal <- structure(list(rel.abund = c(0.003, 0.029, 0.033, 0.023, 0.009, 0.042, 0.069, 0.0

[R] Reassign values based on multiple conditions

2013-03-14 Thread Cat Cowie
Hi all, I have a simple data frame of three columns - one of numbers (really a categorical variable), one of dates and one of data. Imagine: collar date data 1 01/01/2013 x 2 02/01/2013 y 3 04/01/2013 z 4 04/01/2013 a 5 07/01/2013 b The 'collar' is a GPS collar that's been worn by an animal fo

Re: [R] Elasticnet - Cross validation problem

2013-03-14 Thread Noah Silverman
Thanks Steve! -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences Building Los Angeles, CA 90095 On Mar 14, 2013, at 12:54 PM, Steve Lianoglou wrote: > Hi, > > On Thu, Mar 14, 2013 at 2:36 PM, Noah Silverman > wrote: >> Hello, >> >> I am attempting to use elasticnet to

Re: [R] cnfidence intervals for survfit()

2013-03-14 Thread David Winsemius
Sent from my iPhone On Mar 14, 2013, at 2:49 PM, array chip wrote: > Hi, I am wondering how the confidence interval for Kaplan-Meier estimator is > calculated by survfit(). For example, > >> summary(survfit(Surv(time,status)~1,data),times=10) > Call: survfit(formula = Surv(rtime10, rstat10)

[R] Fw: showing ratio in ggplot bar plot with facets

2013-03-14 Thread Melanie Zoelck
Dear R help members, I have constructed a bar plot using ggplot, where I am showing the number of particles in 10m depth bins (from 0-150m) by release area (3 different ones) and Model (also 3 different ones). My problem is that for each release area a different number of particles was released

Re: [R] different color indicates difference magnitude

2013-03-14 Thread meng
Many thanks for your reply. At 2013-03-14 19:22:41,"Jim Lemon" wrote: >On 03/14/2013 12:10 PM, meng wrote: >> Thanks for your notice. >> >> >> >> >> >> >> >> >> >> At 2013-03-14 00:18:48,"John Kane" wrote: >>> The R-help list strips most attachements other than text (and perhaps pngs?

Re: [R] plotting

2013-03-14 Thread Jim Lemon
On 03/15/2013 02:46 AM, li li wrote: Hi alL, I have a data frame with 4 columns: "value", "time", "group" and "id". I would like to plot "value" vs. "time" with different colors for different levels of "group" and different symbols for different values of "id". I think I could do thi

Re: [R] error: object of type 'closure' is not subsettable

2013-03-14 Thread Thomas Lumley
On Fri, Mar 15, 2013 at 1:05 AM, robert.koellner wrote: > > But now I get new error massages: > > Error in wilcox.test.default(measurement, mu = 0) : > not enough (finite) 'x' observations > 'Not enough' here means none. You tried to do a test on a sample of size zero. > In addition: There w

[R] Introductory R - new book

2013-03-14 Thread Rob Knell
Dear all Just a short note to say that my book is now up for sale for kindle on Amazon and shortly as an ePub on Kobo and iBooks. It's designed for undergraduates and postgraduates with some statistical knowledge, and is mostly written with a biological / ecological slant. If anyone would like

Re: [R] Grep with wildcards across multiple columns

2013-03-14 Thread William Dunlap
grep(pattern, textVector) returns of the integer indices of the elements of textVector that match the pattern. E.g., > grep("T", c("One","Two","Three","Four")) [1] 2 3 The '&' operator naturally operates on logical vectors of the same length (If you give it numbers it silently converts 0 to F

Re: [R] Grep with wildcards across multiple columns

2013-03-14 Thread arun
HI, Not sure whether this helps. If you take out the grep(",par.obj,..), it works without any warning. eval(parse(text=paste(   "dt2 <- dt[", "grep('", par.fund, "', fund) & ",   "grep('", par.func, "', func)",   ", sum(amount), by=c('code', 'year')]" , sep="")))  dt[grep('^1.E$',fund) & grep('^1.

Re: [R] Determining maximum hourly slope per day

2013-03-14 Thread Nathan Miller
Thanks for your example Peter. It does seem like one means of getting the job done and if I'm unable to figure out a means with zoo::rollapply I may follow your example. Hopefully someone else can chime in. Thanks, Nate --- Nathan A. Miller Romberg T

[R] cnfidence intervals for survfit()

2013-03-14 Thread array chip
Hi, I am wondering how the confidence interval for Kaplan-Meier estimator is calculated by survfit(). For example,  > summary(survfit(Surv(time,status)~1,data),times=10) Call: survfit(formula = Surv(rtime10, rstat10) ~ 1, data = mgi)  time n.risk n.event survival std.err lower 95% CI upper 95% C

Re: [R] does R read commands from scripts instantanously or seuqently during processing

2013-03-14 Thread Rolf Turner
On 03/15/2013 05:13 AM, Jannis wrote: Dear R community, when I source a script into R via: R --slave < scriptname.R is the whole script file read at once during startup or is each indivdual line of code read seqnetially during the execution (i.e. directly before r processes the respective

Re: [R] Error message in vars package

2013-03-14 Thread Peter Ehlers
On 2013-03-14 11:10, Jose Iparraguirre wrote: Hi I'm getting an error message with the roots() function in the vars package. Even the example in the help file comes up with an error: data(Canada) var.2c <- VAR(Canada, p = 2, type = "const") roots(var.2c) Error in UseMethod("roots") : no ap

[R] Grep with wildcards across multiple columns

2013-03-14 Thread Bush, Daniel P. DPI
I have a fairly large data set with six variables set up like the following dummy: # Create fake data df <- data.frame(code = c(rep(1001, 8), rep(1002, 8)), year = rep(c(rep(2011, 4), rep(2012, 4)), 2), fund = rep(c("10E", "10E", "10E", "27E"), 4),

Re: [R] Equivalent of deal in R?

2013-03-14 Thread Greg Snow
I think that the better approach in R, if you really need to do this, is to convert your array to a list, assign the names to the list, then attach the list to the search path so you can access the variables by name. For example: > x <- c(1,2,3) > x2 <- as.list(x) > names(x2) <- c('a','b','c') >

Re: [R] Accuracy of some classifiers

2013-03-14 Thread Nicolás Sánchez
Precision. 2013/3/14 Patrick Connolly > On Wed, 13-Mar-2013 at 09:04AM +0100, Nicolás Sánchez wrote: > > |> I am using machine learning for one researching. I am using some > |> classifiers with 5-fold CV . I would like to know how it is possible to > |> extract the accuracy, for example, for K

Re: [R] Elasticnet - Cross validation problem

2013-03-14 Thread Steve Lianoglou
Hi, On Thu, Mar 14, 2013 at 2:36 PM, Noah Silverman wrote: > Hello, > > I am attempting to use elasticnet to classify a number of documents. > > The features are words. The data is coded into a matrix with each document > as a row and each word as a column. The data is binary, with {0,1} > in

Re: [R] get the sign of a value

2013-03-14 Thread Ben Tupper
Hi, On Mar 14, 2013, at 3:41 PM, Dimitri Liakhovitski wrote: > Hello! Can't figure it out - hope it's simple: > > # I have some value (can be anything), e.g.: > x = 12 > # I'd like it to become 1. > > # If the value is negative (again, it can be anything), e.g.: > y = -12 > # I'd like it to bec

[R] Course Birmingham: Regression, GLM & GAM. With R intro

2013-03-14 Thread Highland Statistics Ltd
There are a few places left on the following course: Data exploration, regression, GLM, GAM in R - With introduction to R - When: 22 - 26 April 2013 Where: Conference Aston Hotel and Event Venues Aston University, Aston Triangle, Birmingham, UK Further information: http://www.highstat.com/s

Re: [R] get the sign of a value

2013-03-14 Thread Dimitri Liakhovitski
Thanks a lot, Sarah, - that's it! Never used it before! Dimitri On Thu, Mar 14, 2013 at 3:48 PM, Sarah Goslee wrote: > You might perhaps look at: > ?sign > > > On Thu, Mar 14, 2013 at 3:41 PM, Dimitri Liakhovitski > wrote: > > Hello! Can't figure it out - hope it's simple: > > > > # I have some

Re: [R] get the sign of a value

2013-03-14 Thread Sarah Goslee
You might perhaps look at: ?sign On Thu, Mar 14, 2013 at 3:41 PM, Dimitri Liakhovitski wrote: > Hello! Can't figure it out - hope it's simple: > > # I have some value (can be anything), e.g.: > x = 12 > # I'd like it to become 1. > > # If the value is negative (again, it can be anything), e.g.:

[R] get the sign of a value

2013-03-14 Thread Dimitri Liakhovitski
Hello! Can't figure it out - hope it's simple: # I have some value (can be anything), e.g.: x = 12 # I'd like it to become 1. # If the value is negative (again, it can be anything), e.g.: y = -12 # I'd like it to become -1. How could I do it? Thanks a lot! -- Dimitri Liakhovitski [[al

[R] Tomorrow: The Evolution of Regression from Classical Linear Regression to Modern Ensembles (hands-on)

2013-03-14 Thread Lisa Solomon
Tomorrow, Friday March 15 Maybe you missed Part 1 of "The Evolution of Regression Modeling from Classical Linear Regression to Modern Ensembles " webinar series, but you can still join for Parts 2, 3, & 4 > Register Now for Parts 2, 3, 4: > https://www1.gotomeeting.com/register/500959705 > > C

Re: [R] Accuracy of some classifiers

2013-03-14 Thread Patrick Connolly
On Wed, 13-Mar-2013 at 09:04AM +0100, Nicolás Sánchez wrote: |> I am using machine learning for one researching. I am using some |> classifiers with 5-fold CV . I would like to know how it is possible to |> extract the accuracy, for example, for KNN,neural networks and J48, for |> each one of 5-

[R] Elasticnet - Cross validation problem

2013-03-14 Thread Noah Silverman
Hello, I am attempting to use elasticnet to classify a number of documents. The features are words. The data is coded into a matrix with each document as a row and each word as a column. The data is binary, with {0,1} indicating the presence of a word. I want to use the cross validation fu

Re: [R] plotting

2013-03-14 Thread li li
Thank you very much! 2013/3/14 John Kane > > > It is easy to do in base graphics, but probably a bad idea just because > it > > is very hard to decode the symbol/color combinations. > > I just appropriated your data set and tried it in ggplot2 and your > objection looks valid there as well. > >

[R] Error message in vars package

2013-03-14 Thread Jose Iparraguirre
Hi I'm getting an error message with the roots() function in the vars package. Even the example in the help file comes up with an error: > data(Canada) > var.2c <- VAR(Canada, p = 2, type = "const") > roots(var.2c) Error in UseMethod("roots") : no applicable method for 'roots' applied to an ob

Re: [R] date & time manipulation- R 2.15.1 windows 7

2013-03-14 Thread arun
HI, 1. date1<-c("5 jan 2013", "1 jan 2013")  date1<-as.Date(date1,format="%d %b %Y") date1[1]-date1[2] #Time difference of 4 days 2. If you only have the week number of year without any other information, it would be difficult to predict which day that would be. You could get the week numb

Re: [R] Equivalent of deal in R?

2013-03-14 Thread Marc Schwartz
On Mar 14, 2013, at 12:17 PM, Sahana Srinivasan wrote: > HI, I'm looking for a function that does the same as deal() in MATLAB, i,e, > for an array x[1 2 3] > [a,b,c]=x; > such that > a=1, b=2, c=3 > > Does R have any functions similar to this? There are various R/MATLAB references floating

Re: [R] Equivalent of deal in R?

2013-03-14 Thread Ista Zahn
Maybe x <- array(1:3) for(i in seq_along(x)) { assign(letters[i], x[i]) } but usually there is no need for this kind of thing. Why do you want to do that? Best, Ista On Thu, Mar 14, 2013 at 1:17 PM, Sahana Srinivasan wrote: > HI, I'm looking for a function that does the same as deal() in MA

Re: [R] Working with string

2013-03-14 Thread arun
In addition to Marc's suggestion: sprintf("%-5s",Vec) #[1] "sada " "asdsa" "sa   "  formatC(Vec,width=-5) #[1] "sada " "asdsa" "sa   " formatC(Vec,width=5) #[1] " sada" "asdsa" "   sa" format(Vec,justify="right") #[1] " sada" "asdsa" "   sa" A.K. - Original Message - From: Marc Schwart

[R] Equivalent of deal in R?

2013-03-14 Thread Sahana Srinivasan
HI, I'm looking for a function that does the same as deal() in MATLAB, i,e, for an array x[1 2 3] [a,b,c]=x; such that a=1, b=2, c=3 Does R have any functions similar to this? [[alternative HTML version deleted]] __ R-help@r-project.org mailing

Re: [R] ggplot2 problem

2013-03-14 Thread Ista Zahn
Hi Catalin, Untested, but I think data.m$Month <- factor(data.m$Month, levels = month.abb) before plotting will do it. Best, Ista On Thu, Mar 14, 2013 at 12:51 PM, catalin roibu wrote: > Hello all! > I have a problem with ggplot2 library. I want to do an heat map and the y > variables are the

Re: [R] Add a continuous color ramp legend to a 3d scatter plot

2013-03-14 Thread Zhuoting Wu
I have two follow-up questions: 1. If I want to reverse the heat.colors (i.e., from yellow to red instead of red to yellow), is there a way to do that? 2. I also created this interactive 3d scatter plot as below: library(rgl) plot3d(x=x, y=y, z=z, col=nbcol[zcol], box=FALSE) Is there any way to

Re: [R] date & time manipulation- R 2.15.1 windows 7

2013-03-14 Thread Gabor Grothendieck
On Thu, Mar 14, 2013 at 9:45 AM, yash kajaria wrote: > Hi, > I wanted to learn how to solve a date and time manipulation where i can > do the following two > 1. difference of two dates eg (differnce between 5th jan 2013 and 1st > jan 2013) > > 2.Suppose i have week number of the year,

Re: [R] Add a continuous color ramp legend to a 3d scatter plot

2013-03-14 Thread Zhuoting Wu
Marc, Thank you so much! It works! I really appreciate your help! best, Z On Wed, Mar 13, 2013 at 8:39 PM, Marc Girondot wrote: > Hi, > > Try this. > Sincelery, > > Marc > > x <- rnorm(128, 10, 2) > y <- rnorm(128, 10, 2) > > z <- x+y > > nbcol <- heat.colors(128) > > # standardize z to be fr

Re: [R] does R read commands from scripts instantanously or seuqently during processing

2013-03-14 Thread Jeff Newmiller
Your use of the "<" redirection operator is an operating system feature, not an R feature. I am not aware of any operating system that that would function properly in the use case you describe. It is possible, and common, to construct your input file as a stream as you go. But a stream is not a

[R] ggplot2 problem

2013-03-14 Thread catalin roibu
Hello all! I have a problem with ggplot2 library. I want to do an heat map and the y variables are the year months. If I use the following code, he y values are in alphabetical order, but I want it in month order. The code is: library(reshape) library(ggplot2) library(scales) p <- ggplot(data.m, ae

Re: [R] error: object of type 'closure' is not subsettable

2013-03-14 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of robert.koellner > Sent: Thursday, March 14, 2013 1:05 PM > To: r-help@r-project.org > Subject: Re: [R] error: object of type 'closure' is not subsettable > > Edit: OK I got i

Re: [R] evtree

2013-03-14 Thread Achim Zeileis
On Thu, 14 Mar 2013, G Girija wrote: hi I got the following error in 'evtree'. could u help pl. Error in if (var(mf[, nVariables]) <= 0) stop("variance of the denpendent variable is 0") : argument is of length zero I would guess that your model formula and/or corresponding data frame is som

[R] Features Selection using RWeka

2013-03-14 Thread Nicolás Sánchez
Does this package include any methods to do features selection? Thanks! [[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

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-03-14 Thread John Kane
No , but please RSVP if you disagree with me. John Kane Kingston ON Canada > -Original Message- > From: cl...@ecy.wa.gov > Sent: Thu, 14 Mar 2013 09:28:46 -0700 (PDT) > To: gunter.ber...@gene.com > Subject: Re: [R] NLS results different from Excel -- Tricky fortunes > nomination > > F

Re: [R] plotting

2013-03-14 Thread John Kane
> It is easy to do in base graphics, but probably a bad idea just because it > is very hard to decode the symbol/color combinations. I just appropriated your data set and tried it in ggplot2 and your objection looks valid there as well. And Michael was right, the shape command can go in the fir

Re: [R] saving vector output as numeric

2013-03-14 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Aimee Kopolow > Sent: Wednesday, March 13, 2013 5:39 AM > To: r-help > Subject: [R] saving vector output as numeric > > Hi everybody, > > I'm trying to create a numerical da

[R] map question

2013-03-14 Thread Andras Farkas
Dear All,   wondering if anyone could help with a working code for the following:   I would like to plot a map using R that includes New York City (with counties of Kings, Queens, Bronx, New York and Richmond), Westchester, Nassau, Suffolk  and Rockland counties (any color would be ok per county a

Re: [R] NLS results different from Excel -- Tricky fortunes nomination

2013-03-14 Thread Clint Bowman
Following up on Bert's nomination, may I take one from a recent email I received? "The second file is air concentrations against frequencies plotted by SAS; however we don't have the SAS statistical package..." I thought the original name for SAS was Statistical Analysis System--am I missing

Re: [R] Re move row.names column in dataframe

2013-03-14 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of jeharmse > Sent: Monday, March 11, 2013 5:28 PM > To: r-help@r-project.org > Subject: Re: [R] Re move row.names column in dataframe > > > 1.If your data frame is

Re: [R] plotting

2013-03-14 Thread John Kane
Also going from memory Michael's ggplot should almost work but I think yo need to change symbol = id in the aes statement to geom_point(aes(shape = id)) although it may work in the first aes() statement. John Kane Kingston ON Canada > -Original Message- > From: michael.weyla...@gmail

Re: [R] plotting

2013-03-14 Thread David L Carlson
It is easy to do in base graphics, but probably a bad idea just because it is very hard to decode the symbol/color combinations. I added a crude legend: # Provide reproducible data set.seed(42) value <- round(rnorm(20), 2) time <- round(runif(20)*10, 1) group <- sample(1:4) id <- sample(1:5) dta <

Re: [R] merge function to combine two tables

2013-03-14 Thread jim holtman
Take a look at your data. When I loaded what you attached, there were only 9 species that were in common across the two files: > dim(s16) [1] 226 83 > dim(s15) [1] 96 41 > sum(s15$species %in% s16$species) [1] 10 > sum(s16$species %in% s15$species) [1] 10 > length(intersect(s16$species, s15$spec

[R] does R read commands from scripts instantanously or seuqently during processing

2013-03-14 Thread Jannis
Dear R community, when I source a script into R via: R --slave < scriptname.R is the whole script file read at once during startup or is each indivdual line of code read seqnetially during the execution (i.e. directly before r processes the respective command)? In other words, can I savel

Re: [R] merge function to combine two tables

2013-03-14 Thread John Kane
Below , in line John Kane Kingston ON Canada > -Original Message- > From: michael.eisenr...@gmx.ch > Sent: Thu, 14 Mar 2013 11:51:49 +0100 > To: r-help@r-project.org > Subject: [R] merge function to combine two tables > > Dear R-help members > > I would be grateful if anyone could help

[R] How to copy current line in Tinn-R

2013-03-14 Thread Fabio Berzaghi
Hello All, A very simple question about Tinn-R. I am able to use the send line shortcut, but I want to be able to just copy the current line to the clipboard and then paste in the current document or somewhere else. It's so tedious to select the whole line and then copy it. Thanks _

Re: [R] NADA and cenmle

2013-03-14 Thread Shane Carey
Ah ok, thanks. I understand now. The data are chemical concentrations but are reported back as negative values. I have a Lower limit of detection (LLD) of 1 for one element but a value of -2.9 gets reported back to me. One last question, for a different element the LLD is reported as 10, anything

Re: [R] NADA and cenmle

2013-03-14 Thread Rich Shepard
On Thu, 14 Mar 2013, Shane Carey wrote: Ah ok, thanks. I understand now. The data are chemical concentrations but are reported back as negative values. I have a Lower limit of detection (LLD) of 1 for one element but a value of -2.9 gets reported back to me. One last question, for a different e

Re: [R] NADA and cenmle

2013-03-14 Thread Cade, Brian
Shane: Just to add some practical advice on top of Rich's interpretation of the censoring process (which is correct), my recent experiences with analyzing below-detection limit chemical concentrations in water using left-censoring estimators indicates that historically people have not always indic

Re: [R] plotting

2013-03-14 Thread R. Michael Weylandt
I think you'll find this easiest with ggplot2: library(ggplot2) ggplot(dat, aes(x = value, y = time, color = group, symbol = id)) + geom_point() # symbol = might not be the right argument -- I'm doing this from memory or similar MW On Thu, Mar 14, 2013 at 3:46 PM, li li wrote: > Hi alL, >

[R] plotting

2013-03-14 Thread li li
Hi alL, I have a data frame with 4 columns: "value", "time", "group" and "id". I would like to plot "value" vs. "time" with different colors for different levels of "group" and different symbols for different values of "id". I think I could do this but I would like to see what is an easie

Re: [R] date & time manipulation- R 2.15.1 windows 7

2013-03-14 Thread John Kane
A good place to start might be http://www.jstatsoft.org/v40/i03/paper for the lubridate package or have a look at the zoo package John Kane Kingston ON Canada > -Original Message- > From: yash.kaja...@gmail.com > Sent: Thu, 14 Mar 2013 19:15:00 +0530 > To: r-help@r-project.org > Subject

[R] R programmer

2013-03-14 Thread Andrea Spano
Quantide is looking for an junior R programmer for a three/six month contract in Milan (Italy). If interested please email your resume to me Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] column and line graphs in R

2013-03-14 Thread John Kane
The easiest way to supply data is to use the dput() function. Example with your file named "testfile": dput(testfile) Then copy the output and paste into your email. For large data sets, you can just supply a representative sample. Usually, dput(head(testfile, 100)) will be sufficient.

Re: [R] NADA and cenmle

2013-03-14 Thread Rich Shepard
On Thu, 14 Mar 2013, Shane Carey wrote: Thanks for your reply. My data frame contains the value and a true/false to indicate whether they are censored or not. So I have something like: Data Censored -1.2 TRUE -5.5 TRUE 5 FALSE These negative

Re: [R] Working with string

2013-03-14 Thread Bert Gunter
Duhhh... You already knew about nchar!! So (untested): nc <- nchar(vec) mx <- max(nc) blanks <- rep(" ",mx-nchar+1) ## +1 needed for rep paddedvec <-substring(paste(vec,blanks,sep=""),1,mx) You can also do this at one go with str_pad in the stringr package, found by searching on "pad strings.'

Re: [R] question about nls

2013-03-14 Thread Gabor Grothendieck
On Thu, Mar 14, 2013 at 5:07 AM, meng wrote: > Hi,all: > I met a problem of nls. > > My data: > xy > 60 0.8 > 80 6.5 > 100 20.5 > 120 45.9 > > I want to fit exp curve of data. > > My code: >> nls(y ~ exp(a + b*x)+d,start=list(a=0,b=0,d=1)) > Error in nlsModel(formula, mf, start, wts) : > sin

Re: [R] Working with string

2013-03-14 Thread Marc Schwartz
On Mar 14, 2013, at 9:42 AM, Christofer Bogaso wrote: > Hello again, > > Let say I have following string: > > Vec <- c("sada", "asdsa", "sa") > > Now I want to make each element of this vector with equal length. > Basically I want following vector: > > c("sada ", "asdsa", "sa ") > > There

Re: [R] Working with string

2013-03-14 Thread arun
library(stringr)  str_pad(Vec,5,"right") #[1] "sada " "asdsa" "sa   " #or str_pad(Vec,max(nchar(Vec)),"right") #[1] "sada " "asdsa" "sa   " str_count(str_pad(Vec,5,"right"),"") #[1] 5 5 5 A.K. - Original Message - From: Christofer Bogaso To: r-help Cc: Sent: Thursday, March 14, 20

Re: [R] NADA and cenmle

2013-03-14 Thread Rich Shepard
On Thu, 14 Mar 2013, Shane Carey wrote: I am using the cenmle function from the NADA package and some of my data are negative values. As a result the cenmle function will not work and NaN's are produced. I try to change the distribution to Gaussian, but it still will not run. Could somebody ple

Re: [R] Working with string

2013-03-14 Thread Bert Gunter
?nchar will tell you how many characters are in each string (mod multibyte locales) and you can use this to extend any that are shorter than the max with blanks or whatever. -- Bert On Thu, Mar 14, 2013 at 7:42 AM, Christofer Bogaso < bogaso.christo...@gmail.com> wrote: > Hello again, > > Let

Re: [R] error: object of type 'closure' is not subsettable

2013-03-14 Thread robert.koellner
Edit: OK I got it >for ( dye in c("A","B","C","F","G","K","L","M")) + { + for (cond in 1:8) + { + measurement = *my*table[mytable[,"bed"]==cond & mytable[,"dye"]==dye,"differenz"] + print(median(measurement)) + wilcox.test(measurement,mu=0) +

[R] Demean argument in ar function

2013-03-14 Thread soham chakraborty
Hello, I understand that the/ demean/ argument in the *ar()* function to fit an autoregressive model selects the best AR model fitted to the mean deleted observations. What is the purpose of using this demean procedure at all? Its seems silly as the post doesn't deal with R problems Thanks

[R] date & time manipulation- R 2.15.1 windows 7

2013-03-14 Thread yash kajaria
Hi, I wanted to learn how to solve a date and time manipulation where i can do the following two 1. difference of two dates eg (differnce between 5th jan 2013 and 1st jan 2013) 2.Suppose i have week number of the year, i want to know if i can find out the day it refers to eg( say week

[R] question about nls

2013-03-14 Thread meng
Hi,all: I met a problem of nls. My data: xy 60 0.8 80 6.5 100 20.5 120 45.9 I want to fit exp curve of data. My code: > nls(y ~ exp(a + b*x)+d,start=list(a=0,b=0,d=1)) Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates I can't find out

[R] NADA and cenmle

2013-03-14 Thread Shane Carey
Hi, I am using the cenmle function from the NADA package and some of my data are negative values. As a result the cenmle function will not work and NaN's are produced. I try to change the distribution to Gaussian, but it still will not run. Could somebody please help me with this? Thanks -- Sh

[R] evtree

2013-03-14 Thread G Girija
hi I got the following error in 'evtree'. could u help pl. Error in if (var(mf[, nVariables]) <= 0) stop("variance of the denpendent variable is 0") : argument is of length zero [[alternative HTML version deleted]] __ R-help@r-project.org mai

[R] error: object of type 'closure' is not subsettable

2013-03-14 Thread robert.koellner
Hi all, when i run this script: >read.table("Angelika.txt",header=T,sep="\t") >mytable=read.table("Angelika.txt",header=T,sep="\t") >for ( dye in c("A","B","C","F","G","K","L","M")) + { + for (cond in 1:8) + { + measurement = table[mytable[,"bed"]==cond & mytable[,"dye"

[R] Working with string

2013-03-14 Thread Christofer Bogaso
Hello again, Let say I have following string: Vec <- c("sada", "asdsa", "sa") Now I want to make each element of this vector with equal length. Basically I want following vector: c("sada ", "asdsa", "sa ") Therefore we can get: > nchar(c("sada ", "asdsa", "sa ")) [1] 5 5 5 Is there any

Re: [R] column and line graphs in R

2013-03-14 Thread Gian Maria Niccolò Benucci
Hi again, Thank you all for your support. I would love to have a graph in which two variables are contemporary showed. For example a histogram and a curve should be the perfect choice. I tried to use twoord.plot() but I am not sure I understand how to manage the the arguments lx, ly, rx, ry... Any

Re: [R] how to import DNA sequences in R

2013-03-14 Thread Gian Maria Niccolò Benucci
Thank you all guys, for the useful information. Gian On 14 March 2013 14:14, Martin Morgan wrote: > On 03/14/2013 02:19 AM, Gian Maria Niccolò Benucci wrote: > >> Dear all, >> >> I was wondering how to read DNA sequences in R, is there a specific >> function and/or a specific package for that?

Re: [R] column and line graphs in R

2013-03-14 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example You really need to read the posting guide and supply some sample data at the very least. Here is about as simple minded a plot as R will do as an example however dat1 <- structure(list(abond = c(17L, 3L,

[R] Ignoring NA in matplot

2013-03-14 Thread eliza botto
Dear useRs,How to "matplot" a column of matrix while ignoring NA values in it. More precisely, If a column has 10values in it, and row 7 and 8 are NA, instead of reading 7 and 8 as zeros, it should link 6th row with 9th.I hope my question is understandable...Thanks in advanceElisa

Re: [R] Create patterns within a plot?

2013-03-14 Thread Viechtbauer Wolfgang (STAT)
Same idea, but just using base graphics and using an x-axis with log units: library(metafor) data(dat.bcg) res <- rma(measure="OR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, slab=paste(dat.bcg$author, dat.bcg$year, sep=", ")) forest(res, cex=.9, at=log(c(.05, .25, 1, 4)), xlim=c(-10,7)

Re: [R] how to import DNA sequences in R

2013-03-14 Thread Martin Morgan
On 03/14/2013 02:19 AM, Gian Maria Niccolò Benucci wrote: Dear all, I was wondering how to read DNA sequences in R, is there a specific function and/or a specific package for that? Thank you very much in advance, Bioconductor has many sequence-related packages; a basic starting point is http

Re: [R] why predict() gives zero length prediction?

2013-03-14 Thread Adams, Jean
If you look at the help for predict.naiveBayes, you can see that newdata is supposed to be a data.frame. However, you are providing newdata as a vector, titanic_small[,-1]. Try using titanic_small[,-1, drop=FALSE] instead. Jean On Tue, Mar 12, 2013 at 11:35 PM, S. Zhou wrote: > titanic_small[

Re: [R] Same eigenvalues but different eigenvectors using 'prcomp' and 'principal' commands

2013-03-14 Thread John Fox
Dear Arlindo, When, as here, the eigenvalues are distinct, corresponding eigenvectors are defined only up to multiplication by a nonzero constant. As you can verify, the first set of eigevectors is normalized to length 1 while the second set is normalized to have length equal to the correspondi

Re: [R] Same eigenvalues but different eigenvectors using 'prcomp' and 'principal' commands

2013-03-14 Thread Ben Bolker
Arlindo Meque yahoo.com.br> writes: > > > Dear all, > > I've used the 'prcomp' command to > calculate the eigenvalues and eigenvectors of a matrix(gg). > > Using the command 'principal' from the > 'psych' package  I've performed the same exercise. I got the same > eigenvalues but different

Re: [R] column and line graphs in R

2013-03-14 Thread Marc Girondot
Le 14/03/13 11:05, Gian Maria Niccolò Benucci a écrit : Hi all, I would love to plot my data with R. I have abundance and frequency of fungal taxonomic data that should be plotted in the same graph. In Microsoft Excel is that possible but the graphic result is, as always, very poor. Is there a f

Re: [R] how to change "`Year_Month)201103`" into "Year_Month)201103" using R?

2013-03-14 Thread arun
x<- "`Year_Month)201103`"  gsub("[`]","",x) #[1] "Year_Month)201103" A.K. - Original Message - From: Tammy Ma To: "r-help@r-project.org" Cc: Sent: Thursday, March 14, 2013 4:23 AM Subject: [R] how to change "`Year_Month)201103`" into "Year_Month)201103" using R? HI, I have the pat

Re: [R] how to import DNA sequences in R

2013-03-14 Thread Marc Girondot
Le 14/03/13 10:19, Gian Maria Niccolò Benucci a écrit : Dear all, I was wondering how to read DNA sequences in R, is there a specific function and/or a specific package for that? Thank you very much in advance, Gian ** Before to write on the list, a simple google search brings you a lot of i

Re: [R] Modifying a data frame based on a vector that contains column numbers

2013-03-14 Thread Dimitri Liakhovitski
Thank you so much, Bill and Arun! Dimitri On Wed, Mar 13, 2013 at 9:36 PM, arun wrote: > HI, > Try this: > mydf1<- mydf > mydf1[]<-lapply(1:3,function(i) {mydf[which(i== myindex),i]<-1; mydf[,i]}) > mydf1 > # c1 c2 c3 > #1 1 NA NA > #2 NA 1 NA > #3 NA NA 1 > #4 NA 1 NA > #5 1 NA NA > >

Re: [R] HOw to achieve big vector times big dataframe in R?

2013-03-14 Thread Uwe Ligges
On 14.03.2013 11:27, Jan van der Laan wrote: apply((t(as.matrix(b)) * a), 2, sum) ... where colSums(.) should be faster than apply(., 2, sum), Uwe Ligges should do what you want. Why this works; see, http://cran.r-project.org/doc/manuals/r-release/R-intro.html#The-recycling-rule and the

Re: [R] Viewing Compelete Decision Tree in R - R.2.15.2 - Wndows7 32bit

2013-03-14 Thread Uwe Ligges
On 14.03.2013 10:49, Manoj G wrote: I tried drawing some decision trees. Since the number of levels are more in the tree, the plot result for the decision tree is not clear and conjusted. If i save it as pdf or png also, the image is same. So how can i view the complete clear plot of decisio

Re: [R] Bootstrap encounter histories data

2013-03-14 Thread Rui Barradas
Hello, One more thing, if you have the data as strings of states/space/group, you can split it in vectors state/group with # This is your data example x <- c( "1100222101 1", "020010 3", "0010101022 2" ) mat <- do.call(rbind, strsplit(x, " ")) But this creates a matrix, so you'll need t

Re: [R] how to change "`Year_Month)201103`" into "Year_Month)201103" using R?

2013-03-14 Thread Hasan Diwan
On 14 March 2013 01:56, Marc Girondot wrote: >> cat(gsub("`", "", x)) might want to add fixed=TRUE to the gsub line. -- Sent from my mobile device Envoyait de mon portable __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] Bootstrap encounter histories data

2013-03-14 Thread Rui Barradas
Hello, It doesn't seem very complicated. First of all, for the function fun below to work, you need the data not as strings of staes followed by a space followed by a broup number, but in two columns vectors, a character vector of states and a vector of groups. The vector of groups can be of c

Re: [R] different color indicates difference magnitude

2013-03-14 Thread Jim Lemon
On 03/14/2013 12:10 PM, meng wrote: Thanks for your notice. At 2013-03-14 00:18:48,"John Kane" wrote: The R-help list strips most attachements other than text (and perhaps pngs? ) to deduce the risk of virus or malware being recieved. You could try parking the file on something like

Re: [R] Create patterns within a plot?

2013-03-14 Thread Jim Lemon
On 03/14/2013 09:19 PM, Öhagen Patrik wrote: Please note that I want to use log-scale on the x-axis which makes the polygon function sad. Cheers, Patrik -Ursprungligt meddelande- Från: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] För Öhagen Patrik Skickat: den

Re: [R] Create patterns within a plot?

2013-03-14 Thread Sarah Goslee
Providing s reproducible example would help a lot. Also, can you not just feed polygon() log-transformed coordinates? On Thursday, March 14, 2013, Öhagen Patrik wrote: > > Please note that I want to use log-scale on the x-axis which makes the > polygon function sad. > > Cheers, Patrik > > >

Re: [R] holding argument(s) fixed within lapply

2013-03-14 Thread Benjamin Tyner
Thank you Blaser; this is helpful. On 03/13/2013 12:22 PM, Blaser Nello wrote: > One way is to use the do.call function. For example: > > ret2 <- lapply(X=mylist2, >FUN=do.call, >what=function(...) f2(y=Y, ...)) > > Best, > Nello > > -Original Message- > Date: Tue, 12 Ma

  1   2   >