Re: [R] Warning when running R - can't install packages either

2016-05-13 Thread Martin Morgan
Hi Jakub, This is really a separate question. It is not really end-user related, and should be asked on the R-devel mailing list. Nonetheless, some answers below. On 05/13/2016 03:55 PM, Jakub Jirutka wrote: Hi, I’m maintainer of the R package in Alpine Linux. I read on multiple places

Re: [R] Warning when running R - can't install packages either

2016-05-13 Thread Jakub Jirutka
Hi, I’m maintainer of the R package in Alpine Linux. I read on multiple places that some packages needs R_HOME variable set to the location where is R installed, so I’ve added it to the system-wide profile. Is this correct, or a misinformation? What system dependencies does R need to compile

Re: [R] apply formula over columns by subset of rows in a dataframe (to get a new dataframe)

2016-05-13 Thread William Dunlap via R-help
ave() encapsulates the split/lapply/unsplit stuff so transform(mydf, v1.mod = ave(v1, blocks, FUN=mynorm)) also gives what you got above. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, May 13, 2016 at 7:44 AM, Massimo Bressan < massimo.bres...@arpa.veneto.it> wrote: > yes, thanks > >

Re: [R] apply formula over columns by subset of rows in a dataframe (to get a new dataframe)

2016-05-13 Thread Massimo Bressan
yes, thanks you pointed me in the right direction: split/unplist was the trick I completely left behind that possibility! here the final version mynorm <- function(x) {(x - min(x, na.rm=TRUE))/(max(x, na.rm=TRUE) - min(x, na.rm=TRUE))}

Re: [R] building a spatial matrix

2016-05-13 Thread A M Lavezzi
*PLEASE IGNORE THE PREVIOUS EMAIL, IT WAS SENT BY MISTAKE* Hello Sarah thanks a lot for your advice. I followed your suggestions unitil the creation of "result" The allocation of the values of result$distance to the matrix result.m, however ,does not seem to work: it produces a matrix with

Re: [R] building a spatial matrix

2016-05-13 Thread Sarah Goslee
Sorry, you're right. The result line should be: result.m[cbind(factor(result$fcell), factor(result$cellneigh))] <- result$distance idcell <- data.frame( id = seq_len(5), fcell = sample(1:100, 5)) censDist <- expand.grid(fcell=seq_len(100), cellneigh=seq_len(100)) censDist$distance <-

Re: [R] building a spatial matrix

2016-05-13 Thread A M Lavezzi
Hello Sarah thanks a lot for your advice. I followed your suggestions unitl the creation of "result" The allocation of the values of result$distance to the matrix result.m, however ,does not seem to work: it produces a matrix with identical columns corresponding to the last values of

Re: [R] anonymizing subject identifiers for survival analysis

2016-05-13 Thread William Dunlap via R-help
You can also use match(code, unique(code)), as in transform(dd.2, codex2 = paste0("Person", match(code, unique(code It is not guaranteed that x!=y implies digest(x)!=digest(y), but it is extremely unlikely to fail. This match idiom guarantees that. Bill Dunlap TIBCO Software wdunlap

Re: [R] Equation with double quotes from R to Excel?

2016-05-13 Thread Liao, Hongsheng
Sarah, Thank you very much. The following codes you sent to me work perfectly. "IF(A2=\"\",\"\",1)" in R becomes "IF(A2="","",1)" in Excel. Wonderful! Hank Hongsheng (Hank) Liao, PhD. Lab Manager Center for Quantitative Fisheries Ecology Old Dominion University 757-683-4571 >

Re: [R] What is the easiest way to turn a dataframe into a barplot?

2016-05-13 Thread David L Carlson
If you want to stay with vertical bars, the barp() function in package plotrix lets you stagger or rotate the labels: > set.seed(42) > Name=c("One","Two", "Three","Four", "Five", "Six", "Seven", + "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", + "Fourteen", "Fifteen") >

Re: [R] apply formula over columns by subset of rows in a dataframe (to get a new dataframe)

2016-05-13 Thread David L Carlson
You can do this with split/unsplit: > mydf.split <- split(mydf, mydf$blocks) > str(mydf.split) List of 3 $ a:'data.frame': 5 obs. of 3 variables: ..$ blocks: Factor w/ 3 levels "a","b","c": 1 1 1 1 1 ..$ v1: num [1:5] 19 15 17 22 16 ..$ v2: num [1:5] 35 31 35 31 39 $

Re: [R] Equation with double quotes from R to Excel?

2016-05-13 Thread Sarah Goslee
This doesn't answer your actual question, but isn't it better practice to use ISBLANK instead of ""? As for your actual question, a check of the parts of your command at the R prompt would probably reveal something interesting: > paste("IF(A2=", dQuote(""), ",", dQuote(""), ",1)", sep="") [1]

[R-es] Fwd: Función auto.arima

2016-05-13 Thread Elkin Tabares
-- Mensaje reenviado -- De: Elkin Tabares Fecha: 12 de mayo de 2016, 7:04 Asunto: Función auto.arima Para: R-help-es@r-project.org Hola a todos, Estoy estimando un modelo arimax con la función auto.arima del paquete forecast. Mi pregunta es de cómo

[R] Equation with double quotes from R to Excel?

2016-05-13 Thread Liao, Hongsheng
I am trying to add an equation with “” from R to an Excel workbook. However, I have found that the Function “setCellFormula” doesn’t take the “” well while a “” in Excel equation stands for a blank cell. I have tried NA(), EMPTY(), etc, and none of them are what I want. Does anyone have

[R] apply formula over columns by subset of rows in a dataframe (to get a new dataframe)

2016-05-13 Thread Massimo Bressan
hi I need to apply a user defined formula over some selected columns of a dataframe by subsetting group of rows (blocks) and get back a new dataframe I’ve been managed to get the the calculations right but I’m not satisfied at all by the form of the results please refer to my reproducible

Re: [R] What is the easiest way to turn a dataframe into a barplot?

2016-05-13 Thread Christopher W. Ryan
Here is one way: dd <- data.frame(var1=c("string1", "string2", "string3"), var2=c(3,7,4)) dd with(dd, barplot(var2, names.arg=var1)) --Chris Ryan Binghamton, NY yoursurrogate...@gmail.com wrote: > Hello, I can't post my code since it's on a work computer. > > But basically, I have a dataframe

[R] anonymizing subject identifiers for survival analysis

2016-05-13 Thread Christopher W Ryan
I would like to conduct a survival analysis, examining a subject's time to *next* appearance in a database, after their first appearance. It is a database of dated events. I need to obfuscate or anonymize or mask the subject identifiers (a combination of name and birthdate). And obviously any

Re: [R] changing factor to numbers without getting NAs

2016-05-13 Thread ch.elahe via R-help
Thanks Duncan, This type.convert works fine for me and gives me TSTMean with decimal, but I want to add this result as a new column to my df as int or num, how can I do this? Thanks, Elahe On Friday, May 13, 2016 2:15 PM, Duncan Murdoch wrote: On 13/05/2016 7:56

Re: [R] changing factor to numbers without getting NAs

2016-05-13 Thread Marc Schwartz
> On May 13, 2016, at 6:56 AM, ch.elahe via R-help wrote: > > Hi all, > I have a df which a part of this is: > > TSTMax :int 213 228 227 281 > TSTMin :int 149 167 158 176 > TSTMean:Factor w/94 levels "100,2" , "104,3" , ... > I want to change the

Re: [R] changing factor to numbers without getting NAs

2016-05-13 Thread Duncan Murdoch
On 13/05/2016 7:56 AM, ch.elahe via R-help wrote: Hi all, I have a df which a part of this is: TSTMax :int 213 228 227 281 TSTMin :int 149 167 158 176 TSTMean:Factor w/94 levels "100,2" , "104,3" , ... I want to change the TSTMean into numeric but by using

[R] changing factor to numbers without getting NAs

2016-05-13 Thread ch.elahe via R-help
Hi all, I have a df which a part of this is: TSTMax :int 213 228 227 281 TSTMin :int 149 167 158 176 TSTMean:Factor w/94 levels "100,2" , "104,3" , ... I want to change the TSTMean into numeric but by using as.numeric(as.character(df$TSTMean)) I get too many NAs. Is there

[R] How to program friction model(kind of cencored regression )

2016-05-13 Thread Amatoallah Ouchen
Hi, I am going to program (what is called) the “friction model” in economics and statistics. This model can be used for analysing the government intervention. It looks like tobit but different. I can not deal with this model by any R library. This model assume that government intervenes in the

Re: [R-es] Libro: Efficient R programming

2016-05-13 Thread Jesús Para Fernández
Yo aporto esta web con manuale sde todo tipo pra R http://www.ub.edu/stat/docencia/Cursos-R/Radvanced/ > Date: Fri, 13 May 2016 11:38:05 +0200 > From: c...@qualityexcellence.es > To: miguel.angel.rodriguez.mui...@sergas.es > CC: r-help-es@r-project.org > Subject: Re: [R-es] Libro: Efficient R

Re: [R] physical constraint with gam

2016-05-13 Thread Simon Wood
On 11/05/16 17:11, Dominik Schneider wrote: > Hi Simon, Thanks for this explanation. > To make sure I understand, another way of explaining the y axis in my > original example is that it is the contribution to snowdepth relative > to the other variables (the example only had fsca, but my actual

Re: [R] break string at specified possitions

2016-05-13 Thread Hervé Pagès
Hi, Here is the Biostrings solution in case you need to chop a long string into hundreds or thousands of fragments (a situation where base::substring() is very inefficient): library(Biostrings) ## Call as.character() on the result if you want it back as ## a character vector.

Re: [R-es] Libro: Efficient R programming

2016-05-13 Thread Carlos Ortega
Gracias Miguel por compartir... Y añado otro: http://www.joyce-robbins.com/wp-content/uploads/2016/04/effectivegraphsmro1.pdf 2016-05-13 11:04 GMT+02:00 : > Por si os interesa > https://csgillespie.github.io/efficientR/ > > Un saludo, > Miguel. > > >

Re: [R] Warning when running R - can't install packages either

2016-05-13 Thread Martin Morgan
On 05/12/2016 10:25 PM, Alba Pompeo wrote: Martin Morgan, I tried an HTTP mirror and it worked. What could be the problem and how to fix? Also, should I ignore the warning about ignoring environment value of R_HOME? It depends on why you set the value in your environment in the first place;

Re: [R-es] Division entre el numero de ocurrencias parciales y totalesdentro de un DataFrame de manera eficiente

2016-05-13 Thread Carlos Ortega
Hola, Con data.table, para que ya no tengas problema de escalado... # library(data.table) DT <- as.data.table(df) DT[, ab := paste(DT$a, DT$b, sep ="_")] DT[, fr_a := .N, by='a'] DT[, fr_ab := .N, by='ab'] DT[, res := (DT$fr_ab / DT$fr_a)] DT[ ,c("ab", "fr_a", "fr_ab") := NULL] #

Re: [R] Warning when running R - can't install packages either

2016-05-13 Thread Martin Morgan
On 05/12/2016 10:25 PM, Alba Pompeo wrote: Martin Morgan, I tried an HTTP mirror and it worked. What could be the problem and how to fix? The problem is in the warning message 1: In download.file(url, destfile = f, quiet = TRUE) : URL 'https://cran.r-project.org/CRAN_mirrors.csv': status

[R-es] Libro: Efficient R programming

2016-05-13 Thread miguel.angel.rodriguez.muinos
Por si os interesa https://csgillespie.github.io/efficientR/ Un saludo, Miguel. Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é

Re: [R-es] Division entre el numero de ocurrencias parciales y totalesdentro de un DataFrame de manera eficiente

2016-05-13 Thread Toni Massó Jou
Hola: Aplicaré lo que dices de usar data.table. Sobre hacer for, etc. Ya lo he hecho, pero pensaba que usar dplyr haría la tarea más rápida por estar este implementado en C (si no me equivoco). Siempre que puedo utilizo estas funciones, porque codificas menos y van más rápido. En este caso el

[R-es] Trabajo Prácticas en BMind

2016-05-13 Thread VICTORIA LOPEZ
Buenos días, Por si alguien está interesado, aquí os envío la última oferta que nos ha llegado a la comunidad. Podéis contactar conmigo directamente o con emp...@r-es.org Saludos, Victoria Junior Data Analyst.docx Description: MS-Word 2007 document

Re: [R] Packages problems

2016-05-13 Thread Jeff Newmiller
Try a different mirror. -- Sent from my phone. Please excuse my brevity. On May 12, 2016 9:45:02 PM PDT, Mikko Hurme wrote: >Hi! > >I also have problems when I try to install packages. I use R (v. 3.3.0) >on >iMac (v. 10.11.4). >For instance: > >>

[R] Packages problems

2016-05-13 Thread Mikko Hurme
Hi! I also have problems when I try to install packages. I use R (v. 3.3.0) on iMac (v. 10.11.4). For instance: > install.packages("doBy") Warning: unable to access index for repository http://ftp.sunet.se/pub/lang/CRAN/src/contrib: cannot open URL