Re: [R] help on output my own function result in ddply

2015-03-05 Thread Henrik Bengtsson
On Mar 5, 2015 8:32 PM, "Sarah Goslee" wrote: > > Hi, > > On Thursday, March 5, 2015, JS Huang wrote: > > > Hi, > > > > There is a lot of if-else statement. r syntax rejects them. Here is an > > example of if-else example. In r we can code *ifelse(x>2,y <- > > 1,ifelse(x>1,y <- 0.5, y <- 0)

Re: [R] help on output my own function result in ddply

2015-03-05 Thread Sarah Goslee
Hi, On Thursday, March 5, 2015, JS Huang wrote: > Hi, > > There is a lot of if-else statement. r syntax rejects them. Here is an > example of if-else example. In r we can code *ifelse(x>2,y <- > 1,ifelse(x>1,y <- 0.5, y <- 0))* for the following. I'm not sure what you are talking about:

Re: [R] problem with function that adds rows to dataframe based on conditional statement

2015-03-05 Thread Sarah Goslee
Why should he? seq_len() is part of base R. On Thursday, March 5, 2015, JS Huang wrote: > Hi Curtis, > > Maybe you forgot to tell us how the function seq_len is defined. > > > > - > JS Huang > -- > View this message in context: > http://r.789695.n4.nabble.com/problem-with-function-that-add

[R] Fit an Extreme Value Distribution to List of dataframes R

2015-03-05 Thread Zilefac Elvis
Hello, I have a list object with many dataframes (example provided below). Each coulmn in a dataframe represents a simluation and each dataframe represents a clmate station. I want to fit an extreme value distribution on each coulmn of a dataframe and then average the confidence intervals and es

Re: [R] help on output my own function result in ddply

2015-03-05 Thread JS Huang
Hi, There is a lot of if-else statement. r syntax rejects them. Here is an example of if-else example. In r we can code *ifelse(x>2,y <- 1,ifelse(x>1,y <- 0.5, y <- 0))* for the following. if (x > 2) { y = 1 } else { if (x > 1) { y = 0.5 } else { y = 0 } } ---

Re: [R] problem with function that adds rows to dataframe based on conditional statement

2015-03-05 Thread JS Huang
Hi Curtis, Maybe you forgot to tell us how the function seq_len is defined. - JS Huang -- View this message in context: http://r.789695.n4.nabble.com/problem-with-function-that-adds-rows-to-dataframe-based-on-conditional-statement-tp4704228p4704237.html Sent from the R help mailing list

Re: [R] Installing GO.db Package in R

2015-03-05 Thread Martin Morgan
On 03/05/2015 01:21 AM, Zaynab Mousavian wrote: Hi all, I have tried to install GO.db package in R, but the following error is please ask questions about Bioconductor packages on the Bioconductor support forum https://support.bioconductor.org. Please also review answers to your question on B

Re: [R] Dividing a map by electoral results with R?

2015-03-05 Thread David Winsemius
On Mar 5, 2015, at 10:09 AM, Evelyne1991 wrote: > Hi everyone, > > I would like to divide a map of Germany vertically by the electoral results > of 2013: > >> VoteGermany2013 >Party Result > 1 CDU/CSU 49.4 > 2 SPD 30.5 > 3 LINKE 10.2 > 4 GRUENE 10.0 > > What I'm looking for

Re: [R] Want to convert list with vectore of dis similar lengths to data frame

2015-03-05 Thread William Dunlap
That blog post refers to the authors own function, as.data.frame.list, that you would have to download from github. It makes data.frame() act quite differently than the usual way. I would not recommend it. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Mar 5, 2015 at 1:53 AM, harini_v wr

[R] problem with function that adds rows to dataframe based on conditional statement

2015-03-05 Thread Curtis Burkhalter
Hello everyone, I'm having a problem with a function that I wrote that is supposed to add a row to dataframe based upon a conditional statement. To explain I've used an example below: #create data frame animals=c("bird","dog","cat") animals=rep(animals,each=4) animals=animals[1:11] animalYears=c(

[R] error message: ReadItem: unknown type 64, perhaps written by later version of R

2015-03-05 Thread Franckx Laurent
Dear all I get the following error message when I try to load one specific RData object in R: Error: ReadItem: unknown type 64, perhaps written by later version of R The error message is odd because (a) this RData object was created just one hour berfore in a previous script (in a s

[R] Want to convert list with vectore of dis similar lengths to data frame

2015-03-05 Thread harini_v
Hi there I am Ms. Harini and I am trying to solve a problem with the function data.frame. The problem I am trying to solve is similar to the one listed under the title Example Four in this website: http://www.r-bloggers.com/converting-a-list-to-a-data-frame/ For some reason when I try to replica

Re: [R] Want to convert list with vectore of dis similar lengths to data frame

2015-03-05 Thread JS Huang
Hi, The following works by appending NA to make up the maximum length of the list. > test4 $Row1 [1] "a" "b" "c" "d" "e" $Row2 [1] "a" "b" "c" "d" "e" "f" "g" $Row3 [1] "h" "i" "j" "k" "l" "m" "n" > as.data.frame(t(sapply(1:length(test4), > function(x){c(test4[[x]],rep(NA,max(sapply(1:leng

[R] Dividing a map by electoral results with R?

2015-03-05 Thread Evelyne1991
Hi everyone, I would like to divide a map of Germany vertically by the electoral results of 2013: > VoteGermany2013 Party Result 1 CDU/CSU 49.4 2 SPD 30.5 3 LINKE 10.2 4 GRUENE 10.0 What I'm looking for is very simple: a map divided like a one-bar graph, with 49.4% of the leng

[R] Installing GO.db Package in R

2015-03-05 Thread Zaynab Mousavian
Hi all, I have tried to install GO.db package in R, but the following error is given to me: biocLite(c("GO.db")) BioC_mirror: http://bioconductor.org Using Bioconductor version 2.13 (BiocInstaller 1.12.1), R version 3.0.2. Installing package(s) 'GO.db' trying URL 'http://bioconductor.org/pac

[R] gaussian Kernel smoothing using Nadaraya-Watson estimator and confidence bands

2015-03-05 Thread IOANNA IOANNOU
Hello, I have a database and I would like to fit a Nadaraya-Watson Gaussian kernel estimator and produce the confidence bands around the mean estimate. Any ideas how to do this with R? I cannot find a way to produce the confidence bands. I will use a fixed bandwidth. Lets use this database fo

Re: [R] Second order bessel function

2015-03-05 Thread Hans W Borchers
On Wed Mar 4 21:32:30 CET 2015 Chris Vanlangenberg writes: > > I want to compute the numerical values for modified second order bessel > function given x and other parameters, currently base R has a bessel > function for 1st order and I have tried to use the relationship between 1st > and 2nd order

Re: [R] subset a data frame by largest frequencies of factors

2015-03-05 Thread David L Carlson
These two commands will compute the cell frequencies and then sort them: e <- as.data.frame(xtabs(~ctry+member, Dataset)) f <- e[order(e$Freq, decreasing=TRUE),] Then draw your subset g <- head(f, 10) or g <- f[cumsum(f$Freq)/sum(f$Freq) >.8,] Finally merge the sample with the original data a

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Bert Gunter
Well, I obviously don't use it either, as I'm just quoting the docs. I either use by(), or tapply(). -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Thu,

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Jeff Newmiller
Bert: using the sample data frame from below, try to interpret the output of this: aggregate( dat[,1:2], dat[,"g",drop=FALSE, FUN=function(x){print(x);class(x)}) The help text you quote is probably not as clear as it should be. Would the following be better? "... and FUN is applied to each col

[R] subset a data frame by largest frequencies of factors

2015-03-05 Thread Michael Friendly
A consulting client has a large data set with a binary response (negative) and two factors (ctry and member) which have many levels, but many occur with very small frequencies. It is far too sparse with a model like glm(negative ~ ctry+member, family=binomial). > str(Dataset) 'data.frame': 1

[R] deming package error message

2015-03-05 Thread Nathan Pace
I don¹t understand an error message from a thielsen function call within a dplyr do function call. by.CaseNo <- group_by(as.data.frame(MAP.dt), CaseNo) > MAP.thielsen <- by.CaseNo %>% + do(model = thielsen(noninvMAP ~ invMAP, symmetric = T, data = ., + x = T, y = T, model =

Re: [R] Help with Boxplot

2015-03-05 Thread Clint Bowman
Jim, Have you looked at: names: group labels which will be printed under each boxplot. Can be a character vector or an expression (see plotmath). You could use "" where you want a blank. I believe that "at" may work here also. Clint Clint BowmanINTERNET:

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread David Winsemius
On Mar 4, 2015, at 2:02 PM, Typhenn Brichieri-Colombi via R-help wrote: > Hello, > > I am trying to use the following custom function in an aggregatefunction, but > cannot get R to recognize my data. I’ve read the help on function()and on > aggregate() but am unable to solve my problem. How ca

[R] Help with Boxplot

2015-03-05 Thread Jim Silverton
I have the following R code for a boxplot. But I keep getting 4 1's, 4 2's and 4 3's on the x asis for which I reall want to relace the 1's by agegroup 1 the 2's by age group 2 etc. And I don't want to replce it 4 times just once. Can anyone help. boxplot(data.all ~ age.group, data = data.plots,

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Bert Gunter
That's not what ?aggregate says: "aggregate.data.frame is the data frame method. If x is not a data frame, it is coerced to one, which must have a non-zero number of rows. Then, each of the variables (columns) in x is split into subsets of cases (rows) of identical combinations of the components o

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Jeff Newmiller
I don't see your point. No matter which version of aggregate you use, FUN is applied to vectors. Those vectors may be columns in a data frame or not, but FUN is always given one vector at a time by aggregate. --- Jeff Newmill

Re: [R] help with RODBC

2015-03-05 Thread Jeff Newmiller
Using HTML email is, as usual, obscuring what you are doing on this end of the communication. The error message indicates that you have single quotes around the BOS term, but they are not visible in the code you have presented. In addition, there is a syntax error in having the word 'from' befor

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Bert Gunter
Sorry, Jeff. aggregate() is generic. >From ?aggregate: "## S3 method for class 'data.frame' aggregate(x, by, FUN, ..., simplify = TRUE)" Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainl

Re: [R] R 3.1.2 using a custom function in aggregate() function on Windows 7 OS 64bit

2015-03-05 Thread Jeff Newmiller
The aggregate function applies FUN to vectors, not data frames. For example, the default "mean" function accepts a vector such as a column in a data frame and returns a scalar (well, a vector of length 1). Aggregate then calls this function once for each piece of the column(s) you give it. Your

Re: [R] Find the name of the package with called the function

2015-03-05 Thread Jeff Newmiller
Please don't. This violates basic principles of functional design for a very minor degree of convenience. In fact, the whole concept of a function interface that accepts a caller's package name strikes me as brittle design. If your function needs to do callbacks, give it a function to call. If y

Re: [R] Fitting Legend to Matrix Plot

2015-03-05 Thread Rich Shepard
On Thu, 5 Mar 2015, Michael Friendly wrote: Why not make the legend fit on one line above or below the plot matrix? ?legend -- look at ncol=, horiz= and xpd= args Michael, That's just the pointer I was hoping to see. There's no reason not to have the legend outside the plot matrix and now I

Re: [R] Fitting Legend to Matrix Plot

2015-03-05 Thread Michael Friendly
Why not make the legend fit on one line above or below the plot matrix? ?legend -- look at ncol=, horiz= and xpd= args On 3/4/2015 4:39 PM, Rich Shepard wrote: I have a matrix plot of ternary diagrams (pdf attached) generated with these commands: opar <- par(xpd=NA,no.readonly=T) plot(Wint

[R] Find the name of the package with called the function

2015-03-05 Thread Thierry Onkelinx
Dear all, I have several pacakges which all use some generic functions stored in package. Let's call the package with generic functions 'auxiliary', a package which uses those functions 'main'. 'auxiliary' has a function that needs the name of the package it is called by. Currently I solve this b