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 dilarad...@gmail.com 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,

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: http://tolstoy.newcastle.edu.au/R/e8/help/09/12/8784.html 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

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 pollar...@gmail.com wrote: I want to sum

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:jdnew...@dcn.davis.ca.us

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 anna.zakris...@su.se 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

[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,

[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,

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])

[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 you