[R] Rscript silent failures with unmatched brackets

2015-02-26 Thread Luke Moryl
Hi all, I’ve noticed that a script with unmatched brackets of any sort will fail silently in Rscript—neither logging nor any output in the shell indicates that anything went wrong. Example file to run in Rscript: sink('/tmp/exampleoutfile') a - 0 { print(a) Replacing the ‘{‘ with any other

Re: [R] integrate with vector arguments

2015-02-26 Thread JS Huang
Hi, The following works. f2 function(z) { f1 - function(t) { z*t + z*t^2 } return(f1) } sapply(1:5,function(x)integrate(f2(x),0,1)$value) [1] 0.83 1.67 2.50 3.33 4.17 -- View this message in context:

[R] lmerTest - difflsmeans: LS means for Post-hoc analysis

2015-02-26 Thread Grigorios Georgolopoulos
Dear fellow R users, I am trying to calculate the difference of the least square means from a lmer model which has a pretty much standard form of Y ~ A*B + (1|C/D) I am using the difflsmeans command from the lmerTest package but it returns the following error line: Error in

[R] mle

2015-02-26 Thread pari hesabi
Hello, I am going to estimate the parameter of the count model: pr(N=n)= integration{B(x, alpha)-C(x,alpha)} by maximum likelihood estimation.  n-c(0,1,2,3)   and   F- (0,3,4,5) are the vectors of values and observed frequency respectively. The function C(x,alpha) is not defined for n=0, but

Re: [R] Saving Mean Relative Difference from all.equal()

2015-02-26 Thread David Winsemius
On Feb 26, 2015, at 2:02 PM, Scott Colwell scolw...@uoguelph.ca wrote: I think I have one solution. Not very pretty though. Relies on the text not changing at all. as.numeric(gsub(Mean relative difference: , , all.equal(cov2cor(ITEMCOV),cor(item.data))[2])) Is there a better way?

Re: [R] Schedule R function/Code to run at specific time

2015-02-26 Thread macfire
I have a problem with statistics, I think this forum is not the right option, but I'm running out resolution to my problem, so I thought I expose you here so someone could help me. Realized a certain amount of tests in different groups, this assessment had different weights, and the groups were

Re: [R] integrate with vector arguments

2015-02-26 Thread David Winsemius
On Feb 26, 2015, at 1:49 PM, marKo mton...@ffri.hr wrote: v1-c(1:5) v2-c(1:5) f1-function (x) {v1*x+v2*x^2} The problem is that integrate(f1, 0, 1) does not work. I does not, even if a pas the arguments (v1, v2) f1-function (x, v1, v2) {v1*x+v2*x^2} or if i try to vectorize the

Re: [R] Summing certain values within columns that satisfy a certain condition

2015-02-26 Thread Don McKenzie
Kate — here is a transparent solution (tested but without NA treatment). Doubtless there are cleverer faster ones, which later posters will present. HTH # example with four columns and 20 rows nrows - 20 A - sample(c(1:100), nrows, replace=T) B - sample(c(1:100), nrows, replace=T) C -

Re: [R] Best Mac for R

2015-02-26 Thread Thomas Adams
Dan, FWIW, I have basically the system you describe, except a larger HD — I'm quite happy, but I'm a biased Mac user, although I love my Ubuntu Linux machine as well… One can bring any machine to its knees, so there is the element of expectations. A MacBook Pro stacks up as well or better

Re: [R] aggregating variables (sum within groups)

2015-02-26 Thread William Dunlap
Even though I was looking in several r-books I could not find a suitable function to this problem Which R books did you look through? Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Feb 26, 2015 at 4:02 AM, David Studer stude...@gmail.com wrote: Hello everybody! I have a (probabely

[R] extract file name from a path string

2015-02-26 Thread Luigi Marongiu
Dear all, what code should I write in order to extract the file name from a give path? Let's say that I want to get the file my file.xls which is in the directory/folder My documents; since I work both with Windows and Linux, the paths I am looking at are in the format:

Re: [R] Dummy variable in ARIMA

2015-02-26 Thread Mikael Olai Milhøj
Hi. First of all, thx. But when using in arima(...xreg=fact,...) then fact should be a vector and not a factor variable? Maybe I should have been more clear in my first mail, sorry. Or else I have to dig deeper into factors. /Mikael On Thu, Feb 26, 2015 at 5:17 PM, Bert Gunter

Re: [R] Dummy variable in ARIMA

2015-02-26 Thread Bert Gunter
Inline. Cheers, 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, Feb 26, 2015 at 8:02 AM, Mikael Olai Milhøj mikaelmil...@gmail.com wrote: Hi all I have

[R] Dummy variable in ARIMA

2015-02-26 Thread Mikael Olai Milhøj
Hi all I have been searching on the web in vain. I want to include a dummy variable in my ARIMA model. Let's say that I want to make an AR(1) model for X including a dummy variable which should be 1 for observation 4,5,6 and zero otherwise (let's say that there is 50 observations in total). How

Re: [R] aggregating variables (sum within groups)

2015-02-26 Thread Jeff Newmiller
For the record, the ave function in R can apply any function you specify, not just mean. The primary feature of ave is that it does not collapse the rows like aggregate does. Choose among them according to how you want the output to be organized.

Re: [R] Save a list of list and search for values

2015-02-26 Thread jim holtman
You store it as a list of lists and can then use the lapply function to navigate for values. result - lapply(1:1, function(x){ mix(param[x]) # whatever your call to 'mix' is with some data }) Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me

Re: [R] covert entire dataset to numeric while persuing percentage values

2015-02-26 Thread JS Huang
The following data.frame x as one column named Percent. x Percent 1 10% 2 20% 3 30% as.numeric(substr(x$Percent,1,nchar(x$Percent)-1)) [1] 10 20 30 -- View this message in context:

Re: [R] covert entire dataset to numeric while persuing percentage values

2015-02-26 Thread Jeff Newmiller
I think you are getting ahead of yourself. You use the term dataset, which is colloquial and not precise. The read.csv function returns a data.frame, in which each column can have its own storage mode (type). Most data.frames do not have all columns of the same type... if they were you might

Re: [R] format selected columns in dataframe as character

2015-02-26 Thread MacQueen, Don
Of course you could have created them as character vectors in the first place: dfx - data.frame( group = c(rep('A', 8), rep('B', 15), rep('C', 6)), sex = sample(c(M, F), size = 29, replace = TRUE), age = runif(n = 29, min = 18, max = 54), stringsAsFactors=FALSE ) But if that is not

Re: [R] library(multcomp) does not work for loading Tukey

2015-02-26 Thread Michael Dewey
Dear Xavier See below for comments On 26/02/2015 11:20, CHIRIBOGA Xavier wrote: Dear colleagues, For Tukey, I tried to load the function with library(multcomp) but again a message says: Error in library(multcomp) : any package called ‘multcomp’ has been found I suspect you

Re: [R] Processing key_column, begin_date, end_date in R

2015-02-26 Thread Jeff Newmiller
Here is another way. Have not tested for large scale efficiency, but if you convert dta to a data.table that might improve things. library(dplyr) dta - read.csv( text= key_column,begin_date,end_date 123456,2013-01-01,2014-01-01 123456,2013-07-01,2014-07-01 789102,2012-03-01,2014-03-01

[R] retrieving protein for swissport

2015-02-26 Thread Ron Flatau
It's possible to retrieve protein for swissport by protein name?? I try using seqinr and query but i didnt find a way to get all protein that named Delta 9 acyl CoA desaturase. If some one have an idea i be glad :P thank you all ᐧ [[alternative HTML version deleted]]

Re: [R] Save a list of list and search for values

2015-02-26 Thread Duncan Murdoch
On 26/02/2015 9:27 AM, Alaios via R-help wrote: Dear all,in my code I am using the mix() function that returns results in a list. The result looks like List of 10 $ parameters :'data.frame': 2 obs. of 3 variables: ..$ pi : num [1:2] 0.77 0.23 ..$ mu : num [1:2] -7034 162783

Re: [R] format selected columns in dataframe as character

2015-02-26 Thread JS Huang
Try as.character like the following shows. dfx - data.frame( + group = c(rep('A', 8), rep('B', 15), rep('C', 6)), + sex = sample(c(M, F), size = 29, replace = TRUE), + age = runif(n = 29, min = 18, max = 54)) dfx group sex age 1 A M 41.35554346 2 A F

Re: [R-es] DUDA LLENAR MATRIZ CREADA

2015-02-26 Thread rubenfcasal
Hola David, Puedes hacer como ya comentaron en las otras respuestas. Pero por si sirve de utilidad, pego al final parte de un código que empleo para ilustrar la repetición de contrastes en simulación. Está con un bucle y guardando en vectores, si se quisiera modificar para obtener

Re: [R] Help with nonlinear least squares regression curve fitting

2015-02-26 Thread Prof J C Nash (U30A)
Andrew's suggestion for Year is a help, but package nlmrt shows the problem you are trying to solve is truly one where there is a Jacobian singularity. (nlmrt produces the Jacobian singular values -- but read the output carefully because these are placed for compact output as if they correspond to

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread JS Huang
Hi, Some modification to work for both positive and negative number: nchar(format(*abs*(a),scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1) -1. -- View this message in context:

Re: [R] covert entire dataset to numeric while persuing percentage values

2015-02-26 Thread jim holtman
It would help a lot if you posted a subset of your data using 'dput' so that we know what it actually looks like. You have character data mixed with numerics, so you will be NAs in some cases. Conversion of percent to numeric is accomplished with something like this: x - c('12%', '6%',

[R] twitteR

2015-02-26 Thread José Luis Aguilar
Hello, i need help, I'm trying to get oauth authorization to get rcredentials .RData the code that i use is: library(twitteR) library(tm) library(wordcloud) library(RColorBrewer) library(RCurl) library(ROAuth) options(RCurlOptions = list(cainfo = system.file(CurlSSL, cacert.pem, package =

[R] Save a list of list and search for values

2015-02-26 Thread Alaios via R-help
Dear all,in my code I am using the mix() function that returns results in a list. The result looks like List of 10  $ parameters  :'data.frame':   2 obs. of  3 variables:   ..$ pi   : num [1:2] 0.77 0.23   ..$ mu   : num [1:2] -7034 162783   ..$ sigma: num [1:2] 20235 95261  $ se 

Re: [R] Dummy variable in ARIMA

2015-02-26 Thread peter dalgaard
On 26 Feb 2015, at 17:29 , Mikael Olai Milhøj mikaelmil...@gmail.com wrote: Hi. First of all, thx. But when using in arima(...xreg=fact,...) then fact should be a vector and not a factor variable? Maybe I should have been more clear in my first mail, sorry. Or else I have to dig deeper

Re: [R] extract file name from a path string

2015-02-26 Thread John McKown
Look at dirname() and basename(). The first would be what you call the path. The second is the file.name without the path. On Thu, Feb 26, 2015 at 10:58 AM, Luigi Marongiu marongiu.lu...@gmail.com wrote: Dear all, what code should I write in order to extract the file name from a give path?

Re: [R] Dummy variable in ARIMA

2015-02-26 Thread Bert Gunter
Dig deeper. -- 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, Feb 26, 2015 at 8:29 AM, Mikael Olai Milhøj mikaelmil...@gmail.com wrote: Hi. First of

Re: [R] Processing key_column, begin_date, end_date in R

2015-02-26 Thread jim holtman
here is yet another way: dta - read.csv( text= + key_column,begin_date,end_date + 123456,2013-01-01,2014-01-01 + 123456,2013-07-01,2014-07-01 + 789102,2012-03-01,2014-03-01 + 789102,2015-02-01,2016-02-01 + 789102,2015-02-06,2016-02-06 + 789102,2015-02-28,2015-03-31 +

Re: [R] Saving Mean Relative Difference from all.equal()

2015-02-26 Thread Scott Colwell
I think I have one solution. Not very pretty though. Relies on the text not changing at all. as.numeric(gsub(Mean relative difference: , , all.equal(cov2cor(ITEMCOV),cor(item.data))[2])) Is there a better way? -- View this message in context:

Re: [R] Schedule R function/Code to run at specific time

2015-02-26 Thread MacQueen, Don
Everything Duncan said, plus: A construction like this might do the job run.at - as.POSIXct('2015-02-26 13:05') while(TRUE) { if ( trunc(Sys.time(),'min') == run.at) source('whatever-it-is.r') Sys.sleep(60) } but I wouldn't count on it to be as reliable as cron (or Windows equivalent). --

[R] Saving Mean Relative Difference from all.equal()

2015-02-26 Thread Scott Colwell
Hello, Does anyone know how to save the numeric value of the mean relative difference when using the all.equal() command? For example this: all.equal(cov2cor(ITEMCOV),cor(item.data)) Gives: [1] Attributes: Length mismatch: comparison on first 1 components [2] Mean relative difference:

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-26 Thread Scott Colwell
Thanks everyone -- View this message in context: http://r.789695.n4.nabble.com/Extracting-Factor-Pattern-Matrix-Similar-to-Proc-Factor-tp4703704p4703904.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] Schedule R function/Code to run at specific time

2015-02-26 Thread Duncan Murdoch
On 26/02/2015 2:08 PM, Doran, Harold wrote: Is there functionality within R proper, without having to revert to the OS, allowing a function or a portion of an R script to be run at a defined time? My google searches haven't provided much other than one at the link below which relies on an OS.

[R] integrate with vector arguments

2015-02-26 Thread marKo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm a bit stuck. I have to integrate a series of polynomial functions with vector arguments. v1-c(1:5) v2-c(1:5) f1-function (x) {v1*x+v2*x^2} The problem is that integrate(f1, 0, 1) does not work. I does not, even if a pas the arguments (v1, v2)

[R] Schedule R function/Code to run at specific time

2015-02-26 Thread Doran, Harold
Is there functionality within R proper, without having to revert to the OS, allowing a function or a portion of an R script to be run at a defined time? My google searches haven't provided much other than one at the link below which relies on an OS. Thanks, Harold

Re: [R-es] como eliminar los nombres de las series en el grafico

2015-02-26 Thread eric
Funciono perfecto !! tan facil que era, jajaja ... el que sabe sabe, como dicen. Muchas gracias Jorge, Eric. On 26/02/15 03:02, Jorge I Velez wrote: Eric, Creo que necesitas Hmisc:::xYplot(..., label.curves = FALSE) Saludos, Jorge.- 2015-02-26 11:15 GMT+11:00 eric

[R] Summing certain values within columns that satisfy a certain condition

2015-02-26 Thread Kate Ignatius
Hi, Supposed I had a data frame like so: A B C D 0 1 0 7 0 2 0 7 0 3 0 7 0 4 0 7 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 5 1 5 0 4 1 5 0 8 4 7 0 0 3 0 0 0 3 4 0 0 3 4 0 0 0 5 0 2 0 6 0 0 4 0 0 0 4 0 0 0 4 0 For each row, I want to count how many max column values appear to adventurely get the

Re: [R] PEA and APE Tobit

2015-02-26 Thread Arne Henningsen
Dear Annelies On 26 February 2015 at 09:12, hnlki annelies.hoebe...@ugent.be wrote: I estimated a tobit model tobit.fit-tobit(y~x,left=0, right=Inf) (library AER) or tobit2.fit-censReg(y~x, left=0, right=Inf) (librarycensReg) I' have estimated the partial effect at the average as:

Re: [R] Schedule R function/Code to run at specific time

2015-02-26 Thread peter dalgaard
On 26 Feb 2015, at 20:20 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 26/02/2015 2:08 PM, Doran, Harold wrote: Is there functionality within R proper, without having to revert to the OS, allowing a function or a portion of an R script to be run at a defined time? My google

Re: [R] Summing certain values within columns that satisfy a certain condition

2015-02-26 Thread Jeff Newmiller
I guess the answer to your question is yes. dta - read.table( text= A B C D 0 1 0 7 0 2 0 7 0 3 0 7 0 4 0 7 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 5 0 5 1 5 0 4 1 5 0 8 4 7 0 0 3 0 0 0 3 4 0 0 3 4 0 0 0 5 0 2 0 6 0 0 4 0 0 0 4 0 0 0 4 0 , header=TRUE ) dtacmax - sapply( dta, max ) followed by

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread JS Huang
Hi, I assume you want to know the digit count to the left of decimal point. If this is the case, then you may use trunc(log10(max(1,trunc(abs(a)+1 for a numerical variable a. Count 0.12 as having one digit to the left of decimal point. trunc(log10(max(1,trunc(abs(-10.99)+1 [1]

Re: [R] Processing key_column, begin_date, end_date in R

2015-02-26 Thread JS Huang
Hi, Here is an implemenation: date key_column begin_dateend_date 1 123456 2013-01-01 2014-01-01 2 123456 2013-07-01 2014-07-01 3 789102 2012-03-01 2014-03-01 4 789102 2015-02-01 2016-02-01 5 789102 2015-02-06 2016-02-06 y -

[R] Solved: Re: text miner error: Error in UseMethod(meta, x)

2015-02-26 Thread Sun Shine
Hi list Closing this one off myself, this is what I did: The error seems to concern the update of tm to version 0.6: the conversion to lower case text should now be: docs - tm_map(docs, content_transformer(tolower)) Everything else seems to work fine thereafter. The issue in the tutorial

[R] covert entire dataset to numeric while persuing percentage values

2015-02-26 Thread Methekar, Pushpa (GE Transportation, Non-GE)
Hi , I am little confused about how to covert entire dataset to numeric . As I read data like.. Xelements =read.csv(file. Choose(),header = T, stringsAsFactors=FALSE) str(xelements ) str(xelements) 'data.frame': 731 obs. of 4 variables: $ Engine.Speed : chr rpm ES rpm 1049 ... $

[R] format selected columns in dataframe as character

2015-02-26 Thread Alain D.
Dear R-List, #I have a df with the first two cols formatted as factor. dfx - data.frame( group = c(rep('A', 8), rep('B', 15), rep('C', 6)), sex = sample(c(M, F), size = 29, replace = TRUE), age = runif(n = 29, min = 18, max = 54)) # now I want to format both factor VARs as character # I

[R] Rgraphviz and NA indices error

2015-02-26 Thread Sun Shine
Hi list Can someone help me debug the following please: Having downloaded and installed the bioconductor packages and Rgraphviz, I am attempting to plot a network graph showing the relation among chosen words in the corpus of text data. I first did this: plot(dtm, terms=findFreqTerms(dtm,

[R] HELP Tukey

2015-02-26 Thread CHIRIBOGA Xavier
Dear all , I am trying to do a Tukey comparison, but a message appears: tuk-glht(mod0,linfct=mcp(Soil=Tukey));summary(tuk) Error: could not find function glht Anyone knows how to fix it? Thanks a lot! Xavier __ R-help@r-project.org

Re: [R] HELP Tukey

2015-02-26 Thread Thierry Onkelinx
??glht would tell you that glht is a function from the multcomp package. You need to load a package before you can use its functions. library(multcomp) ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team

[R-es] nueva en R

2015-02-26 Thread Gloria Perez Fuentes
hola!soy nueva aqui, estoy haciendo un trabajo sobre R y toda la informacion que encuentro esta en ingles. me gustaria saber algun libro sobre R o donde podria conseguir buena informacion sobre el programa en español, ya sea de su funcionamiento, finalidad del programa, caracteristicas etc. Nunca

[R] library(multcomp) does not work for loading Tukey

2015-02-26 Thread CHIRIBOGA Xavier
Dear colleagues, For Tukey, I tried to load the function with library(multcomp) but again a message says: Error in library(multcomp) : any package called ‘multcomp’ has been found Thanks for ur help, Xavier __ R-help@r-project.org

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread ce
yes this is exactly what I want and it works. thanks. -Original Message- From: JS Huang [js.hu...@protective.com] Date: 02/26/2015 03:22 AM To: r-help@r-project.org Subject: Re: [R] How many digits are there in left of dot of 0.0001 ? Hi, To get the number of digits to the right of

Re: [R] Replace the value with 1 and 0

2015-02-26 Thread Göran Broström
On 2015-02-26 00:33, JS Huang wrote: Hi, Here is an implementation. More data are added. An extra column hasRain is added instead of replacing column Amount. rain Year Month Day Amount 1 1950 1 10.0 2 1950 1 2 35.5 3 1950 1 3 17.8 4 1950 1 4

Re: [R] Processing key_column, begin_date, end_date in R

2015-02-26 Thread JS Huang
Hi, It's not as easy as I originally thought. Here is a revision with the function beginEnd to get it done. date key_column begin_dateend_date 1 123456 2013-01-01 2014-01-01 2 123456 2013-07-01 2014-07-01 3 789102 2012-03-01 2014-03-01 4 789102 2015-02-01 2016-02-01

[R] PEA and APE Tobit

2015-02-26 Thread hnlki
Hi, I estimated a tobit model tobit.fit-tobit(y~x,left=0, right=Inf) (library AER) or tobit2.fit-censReg(y~x, left=0, right=Inf) (librarycensReg) I' have estimated the partial effect at the average as: pea-(pnorm((colMeans(x)%*%tobit.fit$coef[-1])/tobit.fit$scale))%*%tobit.fitt$coef[-1] and the

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread JS Huang
Hi, To get the number of digits to the right of decimal point: nchar(format(a,scientific=FALSE))-(trunc(log10(max(1,trunc(abs(a)+1) -1. The part (trunc(log10(max(1,trunc(abs(a)+1) is the number of digits to the left of decimal. At the end, subtract 1 for the decimal point.

Re: [R] Best Mac for R

2015-02-26 Thread peter dalgaard
On 26 Feb 2015, at 06:26 , Dan Murphy chiefmur...@gmail.com wrote: Quick responses as usual. Can always count on R-Help! Bert's point that it depends is key, of course. Mark and Karim reminded me that R does not use all cores natively. Putting those together, an expensive quad core machine

Re: [R-es] nueva en R

2015-02-26 Thread Jorge I Velez
Hola, Gloria. Bienvenida! Hay algunos manuales en la parte inferior de http://cran.r-project.org/other-docs.html Saludos cordiales, Jorge.- 2015-02-26 22:36 GMT+11:00 Gloria Perez Fuentes fuper...@gmail.com: hola!soy nueva aqui, estoy haciendo un trabajo sobre R y toda la informacion que

[R] aggregating variables (sum within groups)

2015-02-26 Thread David Studer
Hello everybody! I have a (probabely very easy) problem. Even though I was looking in several r-books I could not find a suitable function to this problem, that's why I hope that someone here could help me: # Sample data: group-c(A,A,A,B,B,C,C,C) var1-c(1,0,0,1,1,0,NA,1) var2-c(0,1,NA,0,1,1,0,0)

Re: [R] aggregating variables (sum within groups)

2015-02-26 Thread Ivan Calandra
Hi David, You have your answer in the question: aggregate() aggregate(cbind(var1,var2)~group, data=testdata, FUN=sum) Although I am not sure what you intended to do with testdata$x- as the result cannot have the same number of rows than testdata HTH, Ivan -- Ivan Calandra, ATER University

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread Duncan Murdoch
On 25/02/2015 8:55 PM, ce wrote: Dear all, I would like to count how many digits are there on the left of a the dot of a numeric variable a=0.0001 This will depend on the formatting used. If default formatting used by as.character() is fine, then nchar(sub(^[[:digit:]]*[.], , a))

Re: [R] aggregating variables (sum within groups)

2015-02-26 Thread Brandstätter Christian
Dear David, your email is quite confusing. Do you want to get the sum for each group (A,B,C) or each variable as would be indicated by your result? sum by group: aggregate(data=testdata,var1~group,sum) count by group: aggregate(data=testdata,var1~group,length) sum by variable:

Re: [R] PEA and APE Tobit

2015-02-26 Thread hnlki
Dear Mr Henningsen, I have read the posting guide but apparently not well enough. I didn't find how to include R code in my post. I'll read it again and I'll try to give a clearer example. Sorry for the inconvenience. Kind regards, Annelies Op 26-feb.-2015 om 21:59 heeft Arne Henningsen-3

[R] get_map in ggplot doesn't allow the exact specification of my box's corners?

2015-02-26 Thread Dimitri Liakhovitski
Hello! get_map help says: location: an address, longitude/latitude pair (in that order), or left/bottom/right/top bounding box My code: library(ggmap) library(mapproj) lat_bottom = 52.33 # bottom latitude of Berlin lat_top= 52.5 # top latitude of Berlin lon_left = 13.0 # left

Re: [R] integrate with vector arguments

2015-02-26 Thread Hans W Borchers
marKo mtoncic at ffri.hr writes: I'm a bit stuck. I have to integrate a series of polynomial functions with vector arguments. v1-c(1:5) v2-c(1:5) f1-function (x) {v1*x+v2*x^2} The problem is that integrate(f1, 0, 1) does not work. The point is not that there are vector arguments, but