Re: [R] Finding the Summation of Monthly Amount

2014-10-13 Thread peter dalgaard
Looks like a job for aggregate() -pd On 13 Oct 2014, at 04:25 , dila radi wrote: > Hi all, > > Could someone help me on this? I have this kind of data set > > structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L, > 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, > 1

Re: [R] Is xyz point inside 3d convex hull?

2014-10-13 Thread Keith Jewell
Back in 2009 I posted some code to this list, see: I submitted the function 'inhull' to the geometry package maintainer, but I don't think it was ever included. HTH Keith J On 12/10/2014 21:24, Don McKenzie wrote: Check the R-news a

Re: [R] Q-Q Plot for loglogistic, lognormal and 2 parameter exponential distributions

2014-10-13 Thread peter dalgaard
A basic approach is x <- rchisq(1000, 4) qqplot(qchisq(ppoints(x), 4), x) abline(0,1) Substitute whatever distribution and parameters that might apply. Notice that if you don't have a location-scale family of distributions, you need to compare to the identity line, not just look for linearity.

[R] How to sum some columns based on their names

2014-10-13 Thread Kuma Raj
I want to sum columns based on their names. As an exampel how could I sum columns which contain 6574, 7584 and 85 as column names? In addition, how could I sum those which contain 6574, 7584 and 85 in ther names and have a prefix "f". My data contains several variables with I want to sum columns

Re: [R] How to sum some columns based on their names

2014-10-13 Thread Charles Determan Jr
You can use grep with some basic regex, index your dataframe, and colSums colSums(df[,grep("*6574*|*7584*|*85*", colnames(df))]) colSums(df[,grep("f6574*|f7584*|f85*", colnames(df))]) Regards, Dr. Charles Determan On Mon, Oct 13, 2014 at 7:57 AM, Kuma Raj wrote: > I want to sum columns based

Re: [R] How to sum some columns based on their names

2014-10-13 Thread Jeff Newmiller
Learn regular expressions.. there are many websites and books that describe how they work. R has a number of functions that use them... ?regexp ?grep For example... grep("^[^0-9]*(6574|85|7584)[^0-9]*$",names(dta)) where dta is your data frame. You can read that regular expression as zero or

Re: [R] How to sum some columns based on their names

2014-10-13 Thread Jeff Newmiller
Your regular expressions are invalid, Charles. You seem to be thinking of file name globbing as at the command line. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] seqinr ?: Splitting a factor name into several columns. Dealing with metabarcoding data.

2014-10-13 Thread Ista Zahn
Hi Anna, On Sun, Oct 12, 2014 at 3:24 AM, Anna Zakrisson Braeunlich wrote: > Hi, > > I have a question how to split a factor name into different columns. I have > metabarcoding data and need to merge the FASTA-file with the taxonomy- and > counttable files (dataframes). To be able to do this m

[R] Loading a rda file for predicton

2014-10-13 Thread TJUN KIAT TEO
I tried this fit<-glm(Pred~Pressure+MissingStep, data = Test, family="binomial") save(fit,file="pred.rda") pred<-load("pred.rda") predict(pred,Testsamp,type="response") ---

[R] User authentication

2014-10-13 Thread Baranowski, Bartosz
Hi all, I am envisioning the user logging into a shiny app, or RStudio server, and then, based on that authentication, obtaining the necessary credentials to access other remote systems. Is there maybe any working solution for this kind of problem? All the help would be greatly appreciated. Kind

Re: [R] seqinr ?: Splitting a factor name into several columns. Dealing with metabarcoding data.

2014-10-13 Thread David.Kaethner
I'm not sure I understood your problem, maybe like this: # split identifiers into columns df1 <- data.frame(cbind(X = 1:10, Y = rnorm(10)), Z.identifierA.B1298712 = factor(rep(LETTERS[1:2], each = 5))) id <- names(df1)[3] x <- do.call(rbind, str_split(id, "\\.")) y <- sapply(x,

Re: [R] Loading a rda file for predicton

2014-10-13 Thread Peter Langfelder
see help(load) and pay particular attention to what the function returns: the names of the loaded objects, not the object(s) themselves. You have to use predict(fit,Testsamp,type="response") since the load() created a variable 'fit' (same name as the one saved). HTH Peter On Mon, Oct 13, 20

[R] Help with a function [along columns]

2014-10-13 Thread Kate Ignatius
Hi all, I need help with a function. I'm trying to write a function to apply to varying number of columns in a lot of files - hence the function... but I'm getting stuck. Here it is: gt<- function(x) { alleles <- sapply(x, function(.) strsplit(as.character(.), "/")) gt <- apply(x, funct

Re: [R] Help with a function [along columns]

2014-10-13 Thread Kate Ignatius
Just an update to this: gtal <- function(d) { alleles <- sapply(d, function(.) strsplit(as.character(.), "/")) gt <- unlist(lapply(alleles, function(x) ifelse(identical(x[[1]], vcf[,3]) & identical(x[[2]], vcf[,3]), 'RR', ifelse(identical(x[[1]], vcf[,4]) & identical(

[R] Reading text file with fortran format

2014-10-13 Thread Steven Yen
Hello Any idea how to read a text file with fortran format, WITH MULTIPLE RECORDS? My fortran format is as follows, and I do know I need to change F7.4 to F7.0, and 2F2.0 to 2I2, etc. I just have no idea how to handle the "slash" (/) which dictates a jump to the next record in fortran. Thank yo

[R] How to Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread madhvi
Hi, Can anyone tell me the steps to install R 3.1.0 and rstudio on ubuntu 12.0.4. Thanks Madhvi __ 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] How to Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread Pascal Oettli
Hi, http://cran.r-project.org/bin/linux/ubuntu/ http://www.rstudio.com/products/rstudio/download/ Enjoy, Pascal On Tue, Oct 14, 2014 at 3:17 PM, madhvi wrote: > Hi, > Can anyone tell me the steps to install R 3.1.0 and rstudio on ubuntu > 12.0.4. > > Thanks > Madhvi > >

Re: [R] How to Install R 3.1.0 on ubuntu 12.0.4

2014-10-13 Thread Pascal Oettli
Please reply to the list, not only to me. RStudio is for Ubuntu 10.04+ (please note the "+"). About R 3.1.0, you probably will have to compile from the source. Regards, Pascal On Tue, Oct 14, 2014 at 3:31 PM, madhvi wrote: > Hi, > I have followed these links but it is giving R version 3.1.1 a

[R] Legend (guides) for point and two line graph

2014-10-13 Thread David Bourne
I’m trying to generate a plot with a series of data points and best fit lines from two stat models. I’m generating the best-fits with another program. I have the data in a csv file as: Time,Observed,Calculated,Model 0.000,0.0,13.0810,1C 0.2500,15.,12.5298,1C 0.5000,12.,12.0018,1C 1.0

[R] Storing vectors as vectors in a list without losing each individual vector

2014-10-13 Thread Patricia Seo
Hi everyone, My help request is similar to what was asked by Ken Termiso on April 18th, 2005. Link here: https://stat.ethz.ch/pipermail/r-help/2005-April/069729.html Matt Wiener answered with suggesting a vector list where you hand type each of the vectors. This is not what I want to do. What I