[R] Graphing a piece-wise defined function

2010-03-08 Thread thedoctor81877
Hello. I am new to R, and am typing some homework for my undergrad Analysis class. I am trying to graph the following function in R: f(x) = x^2 for x >=0, and f(x) = 0 for x <0. How do I do this in R? Thanks for the help. -- View this message in context: http://n4.nabble.com/Graphing-a-piece-wi

Re: [R] Average regions of non-zeros

2010-03-08 Thread bogaso.christofer
Hi Jim I was following this thread and found that your answer is perfect there. However I could not comprehend the meaning of the expression " cumsum(x == 0)". If I paste it in R window, I get following : > cumsum(x == 0) [1] 1 2 2 2 2 3 4 4 4 4 I gone through the help page of cumsum() function

[R] Odp: Graphing a piece-wise defined function

2010-03-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.03.2010 05:23:25: > > Hello. I am new to R, and am typing some homework for my undergrad Analysis > class. I am trying to graph the following function in R: f(x) = x^2 for x > >=0, and f(x) = 0 for x <0. How do I do this in R? I would probably use

Re: [R] barplot with factors problem

2010-03-08 Thread Jim Lemon
On 03/08/2010 04:48 AM, casperyc wrote: http://n4.nabble.com/file/n1583733/100307070476876317b486a941.jpg I want to get a histogram by factors. Hi casperyc, Have a look at the third example for the barp function in the plotrix package. Jim __ R-

Re: [R] as>date parsing

2010-03-08 Thread ManInMoon
Thanks Gabor - sprintf did the trick -- View this message in context: http://n4.nabble.com/as-date-parsing-tp1582868p1584218.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

[R] Lattice: barchart, error bars and grouped data

2010-03-08 Thread Johannes Graumann
Hi, How can I, given the code snippet below, draw the error bars in the center of each grouped bar rather than in the center of the group? Thanks for any hints, Joh library(lattice) barley[["SD"]] <- 5 barchart( yield ~ variety | site, data = barley, groups=year, origin=0, lowDev=b

Re: [R] Redhat Linux Install

2010-03-08 Thread Paul Hiemstra
Marc Schwartz wrote: On Mar 5, 2010, at 3:45 PM, Ryan Garner wrote: I just installed R on Redhat Linux at work for the first time and have two questions. 1. I tried to install R to have png and cairo capabilities and was unsuccessful. Before running make, I ran ./configure --with-libpng=yes

[R] plot a distance matrix

2010-03-08 Thread Rosa Manrique
Dear friends, I have problems to plot a matrix from an already distance-matrix. I Just want to plot it, the distance calculation were already done, I don' have the original data to re-calculate the distance in R that will be easy. If some one can prove, here goes the data. Thank you Rosa._

Re: [R] How to match vector with a list ?

2010-03-08 Thread Carlos Petti
Thank you for answers. My code is very slow compared with yours ;-) #my code system.time(r0<-f0(iBig,jBig)) user system elapsed 82.489 15.060 97.544 #Holtman's code system.time(r1<-f1(iBig,jBig)) user system elapsed 0.100 0.012 0.113 #Dunlap's code system.time(r2<-f2(iBig,jBig)) u

Re: [R] Some hints for the R beginner

2010-03-08 Thread Ivan Calandra
Hi Patrick, I've read it quickly and it seems to be a good resource for beginners that have just downloaded R and have no idea what to do. My guess is that it should be a good introduction to other documents such as the "An introduction to R". I'll test it with the next students in my team th

Re: [R] Unsigned Posts; Was Setting graphical parameters

2010-03-08 Thread stephen's mailinglist account
On 4 March 2010 23:47, Jim Lemon wrote: > On 03/05/2010 04:11 AM, Bert Gunter wrote: >> >> Folks: >> >> Rolf's (appropriate, in my view) response below seems symptomatic of an >> increasing tendency of posters to hide their identities with pseudonyms >> and >> fake headers. While some of this may

[R] error_hier.part

2010-03-08 Thread Marco Jorge
Hi everyone, BEGINNER question: I get the error below when running hier.part. Probably i´m doing something wrong. Error in glm.fit(x = X, y = Y, weights = weights, start = start, etastart = etastart, : object 'fit' not found In addition: Warning messages: 1: In glm.fit(x = X, y = Y, weights =

Re: [R] How to match vector with a list ?

2010-03-08 Thread Linlin Yan
Maybe you can create a helper vector first: > helper <- structure(names = unlist(j), rep(names(j), sapply(j, length))) > helper acbd "j1" "j1" "j2" "j2" > helper[i] aabbbccd "j1" "j1" "j2" "j2" "j2" "j1" "j1" "j2" On Sat, Mar 6, 2010 at 1:42 AM, Carlos

Re: [R] Lattice: barchart, error bars and grouped data

2010-03-08 Thread Dieter Menne
Johannes wrote: > > > How can I, given the code snippet below, draw the error bars in the center > of each grouped bar rather than in the center of the group? > http://markmail.org/message/oljgimkav2qcdyre Dieter -- View this message in context: http://n4.nabble.com/Lattice-barchart-erro

Re: [R] Graphing a piece-wise defined function

2010-03-08 Thread Karl Ove Hufthammer
On Sun, 7 Mar 2010 20:23:25 -0800 (PST) thedoctor81877 wrote: > Hello. I am new to R, and am typing some homework for my undergrad Analysis > class. I am trying to graph the following function in R: f(x) = x^2 for x > >=0, and f(x) = 0 for x <0. How do I do this in R? f=function(x) ifelse(x >= 0,

Re: [R] Interpretation of 'swtich'

2010-03-08 Thread Duncan Murdoch
Duncan Murdoch wrote: On 07/03/2010 5:26 PM, rkevinbur...@charter.net wrote: Thatnk you. The documentation indicates as you indicated that if there is not an exact match then the next element is chosen. But it does not indicate the case that contains an exact match but there is not value t

Re: [R] POSIXct type lost

2010-03-08 Thread ManInMoon
It appears that I am creating a matrix where als columns are of type number, so my Date column has been converted to a number. Is there a way to show or display this number column as a Date again? -- View this message in context: http://n4.nabble.com/POSIXct-type-lost-tp1584379p1584410.html Sen

[R] POSIXct type lost

2010-03-08 Thread ManInMoon
I am generating a column of dates using POSIXct, but when I try to assign it to an existing dataframe - it gets "stored" as numbers instead of as POSIXct. Is there a way to force a column to be a specific type (POSIXct)? Thanks, Moon -- View this message in context: http://n4.nabble.com/POSIX

Re: [R] POSIXct type lost

2010-03-08 Thread Gabor Grothendieck
Add the number to the POSIXct origin. See table at end of R News 4/1. On Mon, Mar 8, 2010 at 7:11 AM, ManInMoon wrote: > > It appears that I am creating a matrix where als columns are of type number, > so my Date column has been converted to a number. > > Is there a way to show or display this n

Re: [R] Average regions of non-zeros

2010-03-08 Thread jim holtman
What I was looking for was the string of non-zero values and where they 'broke' at. I could have used 'rle', but I sometime find this approach just as easy. Every place there is a zero will be TRUE which has the value 1. 'cumsum' will generate a running sum of these values. When there is a non-z

[R] Speed up sparse matrices

2010-03-08 Thread Feng Li
Dear R, I have three matrices like this K: pp-by-pp commutation matrix, I: p-by-p diagonal matrix, X: p-by-q dense matrix, and I wish to calculate K(IoX) where `o' denotes Kronecker product. Can you give me any suggestion to speed it up when `p' and `q' are large? Thanks in adv

Re: [R] Average regions of non-zeros

2010-03-08 Thread Linlin Yan
Nice shot of cumsum(). Just improve it a little: > x <- c(0,0,1,2,3,0,0,4,5,6) > x.groups <- split(x, (x != 0) * cumsum(x == 0))[-1] > x.groups $`2` [1] 1 2 3 $`4` [1] 4 5 6 > lapply(x.groups, mean) $`2` [1] 2 $`4` [1] 5 On Mon, Mar 8, 2010 at 11:02 AM, jim holtman wrote: > Try this: > >> x <

[R] black cluster in salt and pepper image

2010-03-08 Thread Sylvain Sardy
Hi, on a lattice, I have binary 0/1 data. 1s are rare and may form clusters. I would like to know the size/length of largest cluster. Any help warmly welcome, Sylvain. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] arbitrary scaling

2010-03-08 Thread Petr PIKAL
Hi all I know I probably reinvented wheel but it was maybe simpler then search in docs or ask help before I did my part. I made a simple function which can scale a vector between chosen values. Do anybody know simpler/better approach? myscale<-function(x, miny=0.5, maxy=1) { rx <- diff(range(

Re: [R] scientific (statistical) foundation for Y-RANDOMIZATION in regression analysis

2010-03-08 Thread Liaw, Andy
That sounds like a particular form of permutation test. If the "scrambling" is replaced by sampling with replacement (i.e., some data points can be sampled more than once while others can be left out), that's the simple (or nonparametric) bootstrap. The goal is to generate the distribution of the

Re: [R] How can I understand this sentenc e,and express it by means of Mathema tical approach?

2010-03-08 Thread Liaw, Andy
If your ultimate interest is in real scientific progress, I'd suggest that you ignore that sentence (and any conclusion drawn subsequent to it). Cheers, Andy From: bbslover > > This topic refer to independent variables reduction, as we > know ,a lot of > method can do with it,however, for pre

Re: [R] arbitrary scaling

2010-03-08 Thread Gabor Grothendieck
Perhaps approx: approx(range(x), c(0.5, 1), xout = x)$y A one-linear, but longer, is also possible based on lm: predict(lm(c(0.5, 1) ~ x, data.frame(x = range(x))), data.frame(x)) On Mon, Mar 8, 2010 at 9:37 AM, Petr PIKAL wrote: > Hi all > > I know I probably reinvented wheel but it was

Re: [R] r code to generate interaction columns

2010-03-08 Thread Sharma, Dhruv
thanks Kieth. I wanted something generic code to check column data type and loop through and create the interaction columns automatically as I want to test this out as a new algorithm for data mining. Traditional regression may give misleading results with multi-collinearity and thus I wanted t

Re: [R] Is there an equivalence of lm's "anova" for an rpart object ?

2010-03-08 Thread Liaw, Andy
One way to do it (no p-values) is explained in the original CART book. You basically add up all the "improvement" (in fit$split[, "improve"]) due to each splitting variable. Andy From: Tal Galili > > Simple example: > > # Classification Tree with rpart > > library(rpart) > > # grow tree > >

Re: [R] arbitrary scaling

2010-03-08 Thread Petr PIKAL
Thanks I would never deduct it out from the help page of approx. Regards Petr r-help-boun...@r-project.org napsal dne 08.03.2010 15:47:37: > Perhaps approx: > >approx(range(x), c(0.5, 1), xout = x)$y > > A one-linear, but longer, is also possible based on lm: > > predict(lm(c(0.5, 1)

[R] setClass or setValidity?

2010-03-08 Thread Albert-Jan Roskam
Hi,   I'm reading up on S4 classes *). There seem to be at least two ways of input validation: setClass() (using the 'validity' argument)  and setValidity(). Is it a matter of taste which function is used? Or should more complex validation code better be put in a setValiditity call? *) A (Not

Re: [R] setClass or setValidity?

2010-03-08 Thread Albert-Jan Roskam
Sorry: there was an error in the last sentence: And, inside those validity checks, is most of the checking done with 'if' 'else' computations, or is it also common to use try()? Cheers!! Albert-Jan ~~ In the face of ambiguity, r

[R] Data.frame issue (pls help)

2010-03-08 Thread GULATI, BRIJESH (Global Markets FF&O NY)
Hi: I want to obtain a particular value from a data.frame. Following is my dataframe: > Quotes BID ASK Name CT2 GOVT99.9296999.9375 CT2 TUM0 COMDTY 108.53125 108.5469TUM0 CT5 GOVT

[R] using sprintf to pass a variable to a RMySQL query

2010-03-08 Thread alison waller
Hello, I am using RmySQL and would like to iterate through a few queries. I would like to use sprintf but I think I'm having problems mixing and matching the sprintf syntax and the SQL regex. I have checked my sqlcmd and it works when I wan to match %MG1% but how do I iterate for i 1-72? Escape

Re: [R] POSIXct type lost

2010-03-08 Thread ManInMoon
What is "R News 4/1"? -- View this message in context: http://n4.nabble.com/POSIXct-type-lost-tp1584379p1584464.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

[R] fit a gamma pdf using Residual Sum-of-Squares

2010-03-08 Thread vincent laperriere
Hi all, I would like to fit a gamma pdf to my data using the method of RSS (Residual Sum-of-Squares). Here are the data: x <- c(86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174) y <- c(2, 5, 10, 17, 26, 60, 94, 128, 137, 128, 77,

[R] (box-) plot annotation: italic within paste?

2010-03-08 Thread Bernd Panassiti
Dear R users, in the example below the name of the genus will be displayed in the main titles using the variable predictor[i] and paste. I would like to have the genus name in italic. However all my attempts using expression and substitute failed. Does anybody know a solution? Thanks a lot in a

[R] tcltk

2010-03-08 Thread Vasco Cadavez
Hi, I'm trying to install tcltk in R-2.10.1, however I get error. someone can help? thanks Vasco __ 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-guide.

Re: [R] POSIXct type lost

2010-03-08 Thread Gabor Grothendieck
Try google. On Mon, Mar 8, 2010 at 8:09 AM, ManInMoon wrote: > > What is "R News 4/1"? > -- > View this message in context: > http://n4.nabble.com/POSIXct-type-lost-tp1584379p1584464.html > Sent from the R help mailing list archive at Nabble.com. > > _

[R] combinations and table selection problem

2010-03-08 Thread Carlos Guerra
Dear all, I have a table like this: a <- read.csv("test.csv", header = TRUE, sep = ";") a UTM pUrb pUrb_class pAgri pAgri_class pNatFor pNatFor_class 1 NF188520.160307 NA 79.921386NA

Re: [R] tcltk

2010-03-08 Thread Rubén Roa
I doubt it. Guess why? Dr. Rubén Roa-Ureta AZTI - Tecnalia / Marine Research Unit Txatxarramendi Ugartea z/g 48395 Sukarrieta (Bizkaia) SPAIN -Mensaje original- De: r-help-boun...@r-project.org [mailto

Re: [R] Data.frame issue (pls help)

2010-03-08 Thread Ivan Calandra
Hi, I cannot really test since your dataframe is completely distorted, but what happens if you try: format(QuoteBID, nsmall=5)? I think it's just a matter of printing, which uses the number of digits from options(digits=). See: ?options, ?format, etc. But I'm not an expert and cannot really

Re: [R] [help] deleting rows which contain more than 2 NAs or zeros

2010-03-08 Thread sjaffe
If the data is a dataframe or matrix 'd': d <- d[apply(d, 1, function(v) sum( is.na(v) ) <= 2 & sum(v==0, na.rm=T) <= 2 ), ] which can be deconstructed as follows: i1 <- apply(d, 1, function(v) sum(is.na(v)) <= 2 ) ## true for rows with 2 or fewer na's i2 <- apply(d, 1, function(v) sum( v == 0,

[R] quickest way convert 1-col df to vector?

2010-03-08 Thread sjaffe
anything shorter than as.vector(as.matrix( df ) )? -- View this message in context: http://n4.nabble.com/quickest-way-convert-1-col-df-to-vector-tp1584646p1584646.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

Re: [R] (box-) plot annotation: italic within paste?

2010-03-08 Thread Miguel Porto
Hello, Try this way (not sure if it's the best way, but it works): boxplot(x[,i], main=substitute(expression(paste(a," ",italic(b)," ",c)),list(a=mainlabel1,b=predictor[i],c=mainlabel2)), ylab=paste(ylabel),cex.lab=cexalabel,cex.main=cexmlabel,cex.axis=1.5) Best, Miguel On Mon, Mar 8, 2010 at

Re: [R] quickest way convert 1-col df to vector?

2010-03-08 Thread Erik Iverson
sjaffe wrote: anything shorter than as.vector(as.matrix( df ) )? df[[1]] __ 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-guide.html and provide comm

Re: [R] quickest way convert 1-col df to vector?

2010-03-08 Thread Steve Jaffe
D'oh -- thanks! I'm always forgetting the double-bracket extractor... -Original Message- From: Erik Iverson [mailto:er...@ccbr.umn.edu] Sent: Monday, March 08, 2010 10:50 AM To: Steve Jaffe Cc: r-help@r-project.org Subject: Re: [R] quickest way convert 1-col df to vector? sjaffe wrote:

Re: [R] using sprintf to pass a variable to a RMySQL query

2010-03-08 Thread jim holtman
Try this: i<-1 sqlcmd_ScaffLen<-sprintf('SELECT scaffold.length FROM scaffold,scaffold2contig,contig2read WHERE scaffold.scaffold_id=scaffold2contig.scaffold_id AND scaffold2contig.contig_id=contig2read.contig_id AND contig2read.read_id LIKE \'%%MG%d%%\'' ,i) sqlcmd_ScaffLen Your problem: 1. Need

Re: [R] using sprintf to pass a variable to a RMySQL query

2010-03-08 Thread Gabor Grothendieck
Another possibility is to use fn$ in the gsubfn package. Just preface any command with fn$ to enable a quasi-perl-like string interpolation. In this example $i is replaced with 1: > library(gsubfn) > library(sqldf) > i <- 1 > fn$sqldf("select count(*) from CO2 where Plant like '%n$i%'") count(*)

[R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Guy Green
Hello, I have a set of data with two columns: "Target" and "Actual". A http://n4.nabble.com/file/n1584647/Sample_table.txt Sample_table.txt is attached but the data looks like this: Actual Target -0.125 0.016124906 0.135 0.120799865 ... ... ... ... I want t

[R] [help] deleting rows which contain more than 2 NAs or zeros

2010-03-08 Thread AuriDUL
Hello. I have just started learning how to work with R program but I have encountered a problem. I can't think up how to remove the rows which contain two (2) or more NA or Zero (0). I would be glad if you could help me because I just have some basic knowledge so far and I even haven't mastered

[R] compare tables

2010-03-08 Thread Laetitia Schmid
Hi! I need some help to finish my script. I have two tables that I combine randomly to produce a third table. This I do for hundreds of iterations. In the output file I get all the simulated tables after each other. It looks like this (in this case 3 iterations): output file: [[1]]

Re: [R] (box-) plot annotation: italic within paste?

2010-03-08 Thread Peter Ehlers
Here's a variation on the theme: boxplot(x[,i]) title(main = bquote(.(mainlabel1)~~italic(.(predictor[i]))~~.(mainlabel2)) ) -Peter Ehlers On 2010-03-08 8:46, Miguel Porto wrote: Hello, Try this way (not sure if it's the best way, but it works): boxplot(x[,i], main=substitute(expressi

Re: [R] fit a gamma pdf using Residual Sum-of-Squares

2010-03-08 Thread Matthew Dowle
Thanks for making it quickly reproducible - I was able to see that message in English within a few seconds. The start has x=86, but the data is also called x. Remove x=86 from start and you get a different error. P.S. - please do include the R version information. It saves time for us, and we l

Re: [R] black cluster in salt and pepper image

2010-03-08 Thread Gregoire Pau
Hello, The function bwlabel() in the Bioconductor package EBImage, extracts the connected components of an image. Denoting your binary matrix by x, the following code gives you the first 10 largest clusters (in size). > library(EBImage) > y = bwlabel(x) > sort(table(y), dec=TRUE)[1:10] See h

Re: [R] Is there an equivalence of lm's "anova" for an rpart object ?

2010-03-08 Thread Tal Galili
Thanks Liaw! I just implemented it using tapply: tapply(fit$splits[, "improve"], rownames(fit$splits), sum) If you can reference me to any other source / example and so on - it would be great. but either way - you helped me a lot, thank you ! Tal Contact Details:--

Re: [R] fit a gamma pdf using Residual Sum-of-Squares

2010-03-08 Thread Peter Ehlers
On 2010-03-08 8:24, vincent laperriere wrote: Hi all, I would like to fit a gamma pdf to my data using the method of RSS (Residual Sum-of-Squares). Here are the data: x<- c(86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174) y<

[R] Combinations and table selection problem (reviewed)

2010-03-08 Thread Carlos Guerra
Dear all, I have the following dataset: t <- structure(list(pUrb = c(20.160307, 51.965649, 26.009581, 3.141484, 64.296826 ), pUrb_class = structure(c(1L, 1L, 1L, 1L, 1L), .Label = c("0", "1"), class = "factor"), pAgri = c(79.921386, 46.657713, 40.269204, 0, 0.440691), pAgri_class =

[R] how to convert character variables into numeric variables directly

2010-03-08 Thread Xumin Zeng
Here is the example. > age=18:29 > height=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) > type=c("A", "B", "C", "D","A", "B", "C", "D","A", "B", "C", "D") > typec=c("0","4","2","9","0","7","2","3","0","1","2","3") > typen=c(0,1,2,3,0,1,2,3,0,1,2,3) > data1=data.frame(age=age,height=

[R] questions

2010-03-08 Thread amitava
Can somebody tell me how can I calculate derivatives of some functions through r citing some examples?? by Taylor's expansion formulae how can I handle complecated functions which can not be handled properly manually by r-script? -- View this message in context: http://n4.nabble.com/questions-tp

Re: [R] how to convert character variables into numeric variables directly

2010-03-08 Thread milton ruser
Try: as.numeric(as.character( typec)) milton On Mon, Mar 8, 2010 at 12:55 PM, Xumin Zeng wrote: > Here is the example. > > > age=18:29 > > height=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) > > type=c("A", "B", "C", "D","A", "B", "C", "D","A", "B", "C", "D") > > typec=c("0","4",

Re: [R] how to convert character variables into numeric variables directly

2010-03-08 Thread Xumin Zeng
Thanks, it works! Xumin milton ruser 03/08/2010 01:02 PM To Xumin Zeng cc r-help Subject Re: [R] how to convert character variables into numeric variables directly Try: as.numeric(as.character( typec)) milton On Mon, Mar 8, 2010 at 12:55 PM, Xumin Zeng wrote: Here is the example.

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Peter Ehlers
On 2010-03-08 8:47, Guy Green wrote: Hello, I have a set of data with two columns: "Target" and "Actual". A http://n4.nabble.com/file/n1584647/Sample_table.txt Sample_table.txt is attached but the data looks like this: Actual Target -0.125 0.016124906 0.135 0.120799865 ...

Re: [R] Working with combinations

2010-03-08 Thread Erich Neuwirth
I had a bug in my last solution. This one should work. next.combin <- function(oldcomb,n){ lcomb <- length(oldcomb) hole.pos <- last.hole.pos(oldcomb,n) if ((hole.pos == lcomb) & oldcomb[lcomb]==n) { return(NA) } newcomb<-oldcomb newcomb[hole.pos:lcomb]<-oldcomb[hole.pos]+(1:(lcomb

[R] Executable for Production Use

2010-03-08 Thread Ma Ismail - NewYork-MEAG-NY
Hi, A few of the developers on our Quant team are using R for data calculation and to generate a resulting CSV file. They have R installed on their workstations. We are interested in having this deployed to user workstations where the users will not have R installed on their workstations. Is

Re: [R] Executable for Production Use

2010-03-08 Thread Barry Rowlingson
On Mon, Mar 8, 2010 at 6:44 PM, Ma Ismail - NewYork-MEAG-NY wrote: > Hi, > > A few of the developers on our Quant team are using R for data calculation > and to generate a resulting CSV file.  They have R installed on their > workstations.  We are interested in having this deployed to user works

Re: [R] using sprintf to pass a variable to a RMySQL query

2010-03-08 Thread Don MacQueen
I always use paste() i <- 1 sqlcmd_ScaffLen <- paste("SELECT scaffold.length FROM scaffold, scaffold2contig, contig2read WHERE scaffold.scaffold_id=scaffold2contig.scaffold_id AND scaffold2contig.contig_id=contig2read.contig_id AND contig2read.read_id LIKE '%MG", i ,"%'", sep='') That should cre

Re: [R] Monetary support to the R-project (Was: Re: Executable for Production Use)

2010-03-08 Thread Henrik Bengtsson
On Mon, Mar 8, 2010 at 8:46 PM, Barry Rowlingson wrote: > On Mon, Mar 8, 2010 at 6:44 PM, Ma Ismail - NewYork-MEAG-NY > wrote: >> Hi, >> >> A few of the developers on our Quant team are using R for data calculation >> and to generate a [snip] >  I've noticed a lot of financial corporates getti

Re: [R] Executable for Production Use

2010-03-08 Thread Stefan
Ma Ismail - NewYork-MEAG-NY meag-ny.com> writes: > > Hi, > > A few of the developers on our Quant team are using R for data calculation andto generate a resulting CSV file. They have R installed on their workstations. We are interested in having this deployed to user workstations where the u

[R] likelihood

2010-03-08 Thread Ashta
Hi all, Does any one know how to write the likelihood function for Poisson distribution in R when P(x=0). For normal case, it an be written as follows, n * log(lambda) - lambda * n * mean(dat) Any help is highly appreciated Ashta

[R] error when using svm routine: Error in if (any(co)) { : missing value where TRUE/FALSE needed

2010-03-08 Thread Xumin Zeng
Hi, I met with this error message with the following data set. Do you know how to resolve it? Thanks. > data<-read.table("c://temp3//abc.csv", sep = ",", header=T) > classwt<-c( 0.5806452, 0.4193548) > y<-data[,1] > x<-data[,2:ncol(data)] > print(y) [1] 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 1 1 1 1 1

[R] Making FTP operations with R

2010-03-08 Thread Orvalho Augusto
Dears I need to make some very basic FTP operations with R. I need to do a lot of "get" and issue a respective "delete" command too on the same connection. How can I do that? Thanks in advance Caveman __ R-help@r-project.org mailing list https://stat

[R] why this function does not run correctly?

2010-03-08 Thread Marco Bressan
Hi, my name is Marco Bressan i'm working to improve ADati package. I study psicology ad Padua University (Italy). I have this problem: why bartlett.test function running good and my anova.welch function no? Ciao, il mio nome è Marco Bressan e sto lavorando per migliorare il pacchetto ADati. St

Re: [R] setClass or setValidity?

2010-03-08 Thread Martin Morgan
On 03/08/2010 07:18 AM, Albert-Jan Roskam wrote: > Sorry: there was an error in the last sentence: > And, inside those validity checks, is most of the checking done with 'if' > 'else' computations, or is it also common to use try()? For me it's a matter of taste, and usual to use if... (because y

Re: [R] questions about "Cusum"

2010-03-08 Thread Christopher W. Ryan
I've found the "surveillance" package useful for monitoring walk-in clinic visits in our county as the influenza pandemic evolved. It might serve your needs for monitoring IFI (invasive fungal infections?) in your hospital. --Chris Christopher W. Ryan, MD SUNY Upstate Medical University Clinic

[R] page boundaries for latex printing of summary.formula objects in Hmisc

2010-03-08 Thread Erik Iverson
Hello, Warning, I'm guessing only those who have used the Hmisc package's summary.formula function with LaTeX will be able to offer much help here. I am using the Hmisc package's summary.formula function to produce tables for a LaTeX report. The "latex" function in the same package supports

Re: [R] aggregate for zoo or its?

2010-03-08 Thread Jeffrey J. Hallman
Or for real power and flexibility, see the 'convert()' function in package tis. Jeff Gabor Grothendieck writes: > See ?aggregate.zoo, e.g. > > library(zoo) > z <- zoo(1:1000, as.Date("2000-01-01") + 0:999) > aggregate(z, as.yearmon, mean) > > or replace mean with whatever summarization you want.

[R] confused by classes and methods.

2010-03-08 Thread Rob Forler
Hello, I have a simple class that looks like: setClass("statisticInfo", representation( max = "numeric", min = "numeric", beg = "numeric", current = "numeric", avg = "numeric",

[R] variance of discrete uniform distribution

2010-03-08 Thread casperyc
Hi all, I am REALLY confused with the variance right now. for a discrete uniform distribution on [1,12] the mean is (1+12)/2=6.5 which is ok. y=1:12 mean(y) then var(y) gives me 13 1- on http://en.wikipedia.org/wiki/Uniform_distribution_%28discrete%29 wiki the variance is (12^2-1)/12=

Re: [R] variance of discrete uniform distribution

2010-03-08 Thread Rolf Turner
On 9/03/2010, at 12:13 PM, casperyc wrote: > > Hi all, > > I am REALLY confused with the variance right now. You need to learn the difference (a) Between sample variance (*estimate* of population variance) and population variance. and

Re: [R] variance of discrete uniform distribution

2010-03-08 Thread casperyc
Hi Rolf Turner , God, it directed to the wrong page. I firstly find the formula in wiki, than tried to verify the answer in R, now, given that 143/12 ((n^2-1)/12 ) is the correct answer for a discrete uniform random variable, I am still not sure what R is calculating there? why it gives me 13?

Re: [R] test the goodness of it for negative binomial type 2

2010-03-08 Thread casperyc
Hi Achim Zeileis-4, That's very helpful. Thanks! -- View this message in context: http://n4.nabble.com/test-the-goodness-of-it-for-negative-binomial-type-2-tp1575892p1585357.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-

Re: [R] variance of discrete uniform distribution

2010-03-08 Thread Michael Erickson
On Mon, Mar 8, 2010 at 3:44 PM, casperyc wrote: > > Hi Rolf Turner , > > God, it directed to the wrong page. > > I firstly find the formula in wiki, than tried to verify the answer in R, > now, given that 143/12 ((n^2-1)/12 ) is the correct answer for a discrete > uniform random variable, > I am s

Re: [R] compare tables

2010-03-08 Thread jim holtman
You can just access the data from the list: result <- lapply(output, function(.data){ lettermatch(creator, .data) }) You can then take the "result" and possibly 'cbind' back into the matrix you want. On Mon, Mar 8, 2010 at 10:59 AM, Laetitia Schmid wrote: > Hi! > I need some help to finish

Re: [R] How can I understand this sentence,and express it by means of Mathematical approach?

2010-03-08 Thread Rolf Turner
On 9/03/2010, at 3:48 AM, Liaw, Andy wrote: (in response to a question on the meaning of the sentence: >> "Independent variables whose correlation with the response >> variable was not significant at 5% level were removed") > If your ultimate interest is in real scientific progress, I'd sugge

Re: [R] conditioning variable in panel.xyplot?

2010-03-08 Thread Seth W Bigelow
Ah, wonderful, thank you for the code Deepayan. To recap for posterity: I have two datafiles, d and q: each has x-y coordinates that are conditioned by site (The actual data, for me, is maps of parent trees and their seedlings). I wanted to superimpose the xy plots of d and q, by site, without

Re: [R] conditioning variable in panel.xyplot?

2010-03-08 Thread Felix Andrews
Alternatively library(latticeExtra) xyplot(y ~ x | site, d) + xyplot(y ~ x | site, q, col = "red") (which is a shortcut for:) xyplot(y ~ x | site, d) + as.layer(xyplot(y ~ x | site, q, col = "red")) On 9 March 2010 11:17, Seth W Bigelow wrote: > Ah, wonderful, thank you for the code De

[R] varComb in gls/lme

2010-03-08 Thread Yu, Xuesong
Dear R-help members, I have a question regarding how to use varComb function to specify a variance function for the "weights" in the gls. I need to fit a linear model with heteroscedasticity. The variance function is exp(c0+nu0*W +nu1*W^2) where W is a covariate. Initially I want to use va

Re: [R] A slight trap in read.table/read.csv.

2010-03-08 Thread Mike Prager
Rolf Turner wrote: > > I solved the problem by putting in a colClasses argument in my > call to read.csv(). But I really think that the read functions > are being too clever by half here. If field entries are surrounded > by quotes, shouldn't they be left as character? Even if they are > all F

Re: [R] A slight trap in read.table/read.csv.

2010-03-08 Thread Rolf Turner
On 9/03/2010, at 11:17 AM, Mike Prager wrote: > Rolf Turner wrote: >> >> I solved the problem by putting in a colClasses argument in my >> call to read.csv(). But I really think that the read functions >> are being too clever by half here. If field entries are surrounded >> by quotes, shouldn

Re: [R] why this function does not run correctly?

2010-03-08 Thread Peter Ehlers
On 2010-03-08 14:45, Marco Bressan wrote: Hi, my name is Marco Bressan i'm working to improve ADati package. I study psicology ad Padua University (Italy). I have this problem: why bartlett.test function running good and my anova.welch function no? Ciao, il mio nome � Marco Bressan e sto lavor

Re: [R] A slight trap in read.table/read.csv.

2010-03-08 Thread Peter Ehlers
Ditching T/F for TRUE/FALSE would get my vote, too. -Peter Ehlers On 2010-03-08 17:44, Rolf Turner wrote: On 9/03/2010, at 11:17 AM, Mike Prager wrote: Rolf Turner wrote: I solved the problem by putting in a colClasses argument in my call to read.csv(). But I really think that the read

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread David Freedman
try as.numeric(read_data$DEC) this should turn it into a numeric variable that you can work with hth David Freedman CDC, Atlanta Guy Green wrote: > > Hi Peter & others, > > Thanks (Peter) - that gets me really close to what I was hoping for. > > The one problem I have is that the "cut" app

Re: [R] RGtk2:::gdkColorToString throws an error

2010-03-08 Thread Wincent
Dear Michael, thanks. I have installed gtk+ 2-12.9 revision 2 from http://gladewin32.sourceforge.net/, it still doesn't work. I tried gtk2-runtime-2.16.6-2010-02-24-ash.exe from http://gtk-win.sourceforge.net/home/index.php/en/Downloads, it did not solve the issue neither. Could you please give me

[R] ctree - party package multivariate response variables

2010-03-08 Thread valeriano . parravicini
Hi, I have a problem with ctree of party package. I have data on distribution of more than one species (about 50 species) and I would like identify the relation of this multivariate object (species distribution) with a number of explanatory variables. rs is the name of my dataframe containing the

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Guy Green
Hi Peter & others, Thanks (Peter) - that gets me really close to what I was hoping for. The one problem I have is that the "cut" approach breaks the data into intervals based on the absolute value of the "Target" data, rather than their frequency. In other words, if the data ranged from 0 to 50

Re: [R] Making FTP operations with R

2010-03-08 Thread Duncan Temple Lang
R does provide support for basic FTP requests. Not for DELETE requests. And not for communication on the same connection. I think your best approach is to use the RCurl package (http://www.omegahat.org/RCurl). D. Orvalho Augusto wrote: > Dears I need to make some very basic FTP operations wit

Re: [R] Help with Hmisc, cut2, split and quantile

2010-03-08 Thread Peter Ehlers
On 2010-03-08 18:00, Guy Green wrote: Hi Peter& others, Thanks (Peter) - that gets me really close to what I was hoping for. The one problem I have is that the "cut" approach breaks the data into intervals based on the absolute value of the "Target" data, rather than their frequency. In othe

Re: [R] Help! I turned my data into junk!

2010-03-08 Thread Ravi Kulkarni
It's probably binary data - which implies that you can only "read" it with the application that created it. What is the filename extension? Ravi -- View this message in context: http://n4.nabble.com/Help-I-turned-my-data-into-junk-tp1585481p1585585.html Sent from the R help mailing list archive

[R] Odp: how to convert character variables into numeric variables directly

2010-03-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.03.2010 18:55:10: > Here is the example. > > > age=18:29 > > height=c(76.1,77,78.1,78.2,78.8,79.7,79.9,81.1,81.2,81.8,82.8,83.5) > > type=c("A", "B", "C", "D","A", "B", "C", "D","A", "B", "C", "D") > > typec=c("0","4","2","9","0","7","2","3","0","1",

  1   2   >