Re: [R-es] resolución de ecuación

2015-10-23 Thread Javier Rubén Marcuzzi
Estimados Posiblemente algo de lo expuesto en https://cran.r-project.org/web/views/Optimization.html pueda ser útil, aunque esa ecuación escapa a mi experiencia. Javier Rubén Marcuzzi Técnico en Industrias Lácteas Veterinario De: Carlos Ortega Enviado: viernes, 23 de octubre de 2015 8:52

[R] creating a list based on various mean values

2015-10-23 Thread Erin Hodgess
Hello! I would like to create a list of random values, based on various means. Here are the potential mean values: > k1 [1] 0.005 0.200 0.300 0.400 0.500 0.600 0.700 0.800 0.900 1.000 1.100 1.200 1.300 1.400 [15] 1.500 1.600 1.700 1.800 1.900 2.000 5.000 10.000 There are

Re: [R] creating a list based on various mean values

2015-10-23 Thread Michael Hannon
Does the following not do what you want? k1 <- c(0.005, 0.200, 0.300, 0.400, 0.500, 0.600, 0.700, 0.800, 0.900, 1.000, 1.100, 1.200, 1.300, 1.400, 1.500, 1.600, 1.700, 1.800, 1.900, 2.000, 5.000, 10.000) k1 xr <- lapply(k1, rnorm, n=20) xr On Fri, Oct 23, 2015 at 1:51 AM, Erin

[R-es] Resolución de ecuación

2015-10-23 Thread jmcontreras
Hola a todos Tengo una duda existencial, como siempre, jejeje Quiero resolver una ecuación (F=0) que depende de un parámetro z, pero este viene en función de una suma que depende de un vector de tiempos ti (1:25) y unos valores de un vector x Lo he intentado resolver mediante una función

Re: [R-es] resolución de ecuación

2015-10-23 Thread Carlos Ortega
Hola, Otra alternativia que tienes, por la complejidad de la ecuación que la tienes expresada como un sumatorio (sin desarrollar) es utilizar "R" unido al paquete de matemática simbólica "Yacas", mediante "RYacas": https://cran.r-project.org/web/packages/Ryacas/index.html Saludos, Carlos Ortega

Re: [R] Error in Opening Project on R Studio

2015-10-23 Thread John Kane
There was no attachment so we cannot tell if your problem is an R problem that is appropriate for the R-help list or if it is a RStudio issue that should go to their help forum. The R-help list is very fussy about what kinds of attachments that it well accept. It usually is best to just copy

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread Hadley Wickham
You have two problems: * geom_line() always draws from right-to-left * you're defining colour outside of the plot in a very non-ggplot2 way. Here's how I'd do it: library(ggplot2) data <- data.frame( x = rep(1:4, each = 25), y = rep(1:25, times = 4), g = rep(1:4, each = 25) ) data$x <-

Re: [R] Environment question

2015-10-23 Thread Duncan Murdoch
On 23/10/2015 11:08 AM, ALBERTO VIEIRA FERREIRA MONTEIRO wrote: > From the code below: > > y <- 1 > > f1 <- function() { > cat("y =", y, "\n") > } > > f2 <- function() { > y <- 2 > f1() > } > > f3 <- function() { > y <- 3 > f <- f1 > f() > } > > f4 <- function() { > y <- 4 >

Re: [R] Environment question

2015-10-23 Thread Bert Gunter
I do not understand exactly what you're looking for: "Any way to rewrite the code.." is pretty vague. Here is _an_ answer, which may completely miss what you mean, followed by some comments. y <- 1 f1 <- function(x=y) { cat("y =", x, "\n") } f2 <- function() { y <- 2 f1() } f3 <-

[R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Hi, Next adventure into my journey from lattice to ggplot: I would like to create a custom generic function that combines multiple existing geom's in order to reproduce what the lattice panel.xyplot function does based on the type argument (ie, plotting points only for type='p', plotting

Re: [R-es] resolución de ecuación

2015-10-23 Thread Olivier Nuñez
José, varios comentarios: 1) exp(1)^a =exp(a) 2) solve es para ecuaciones lineales. La tuya es nolineal 3) ¿cuales el rango de valores posibles de z? 4) Prueba la función uniroot.all del paquete "rootSolve". Un saludo. Olivier - Mensaje original - De: "José Miguel Contreras

[R-es] resolución de ecuación

2015-10-23 Thread José Miguel Contreras García
Hola a todos Tengo una duda existencial, como siempre, jejeje Quiero resolver una ecuación (F=0) que depende de un parámetro z, pero este viene en función de una suma que depende de un vector de tiempos ti (1:25) y unos valores de un vector x Lo he intentado resolver mediante una función para

[R-es] resolución de ecuación

2015-10-23 Thread José Miguel Contreras García
Hola a todosTengo una duda existencial, como siempre, jejejeQuiero resolver una ecuación (F=0) que depende de un parámetro z, pero este viene en función de una suma que depende de un vector de tiempos ti (1:25) y unos valores de un vector xLo he intentado resolver mediante una función para luego

Re: [R] virus/trojan in contributed package: 'svs'

2015-10-23 Thread peter dalgaard
Virus scanners generate a fair amount of false positives. Does it persist if you unpack the zip file or the source tarball? If so, what file has the issue? -pd On 23 Oct 2015, at 09:38 , Bijoy Joseph wrote: > Hello, > > I came across the following when I was installing

[R] annotating faceted ggplot

2015-10-23 Thread efisio solazzo
Dear, I have been reading several posts but still cannot work out how to annotate a faceted boxplot created from existing statistics using ggplot. the dataframe is smthing like: dep_stat specie.sp. models min max q25q50 q75 1NO2 mod1 0 225.0 0.1 0.40

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread Erich Neuwirth
I often look for examples in http://www.cookbook-r.com/Graphs/ > On 23 Oct 2015, at 18:27, Jeff Newmiller wrote: > > Have you looked at the qplot function in the ggplot2 package? >

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread sbihorel
Hi, I want to thank Jeff, Dennis, c06n, and Hadley for their replies and explanations. As you probably guessed, I am fairly new to ggplot am trying to loose my lattice reflex while transitioning to ggplot. Thank for the link to the ggplot external documentation. Sebastien On 10/23/2015

[R] elementwise matrix multiplication with a special structure

2015-10-23 Thread eugen pircalabelu via R-help
Hello R users, I have the following annoying matrix multiplication and I do not know how to avoid the nested loops, so maybe someone can help me with some ideas. I have searched the forum for past posts but nothing came up.Here it is:  aa=matrix(1:9,3,3) bb=matrix(seq(10,90,by=10),3,3) 

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread Jeff Newmiller
Have you looked at the qplot function in the ggplot2 package? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] virus/trojan in contributed package: 'svs'

2015-10-23 Thread Bijoy Joseph
See output below: $ clamscan -ri svs/ ./svs/extdata/InvT_Eng.txt: BAT.CMDFlood FOUND In the tarball, the file is "./inst/extdata/InvT_Eng.txt", and clamscan gives the same output. $ file svs/extdata/InvT_Eng.txt ./svs/extdata/InvT_Eng.txt: ASCII text, with CRLF line terminators I managed to

Re: [R] Control of x-axis variable ordering in ggplot

2015-10-23 Thread c06n
Hi, are you trying to do the same thing with ggplot as with lattice? In this case, your solution looks probably like this: ggplot(data, aes(x, y, group = g)) + geom_path(aes(colour = g)) If you haven’t done so yet, I strongly recommend reading through the ggplot2 documentation:

Re: [R] JSONlite import problem

2015-10-23 Thread K. Elo
Hi! You can download the example file with this link: https://www.dropbox.com/s/tlf1gkym6d83log/example.json?dl=0 BTW, I have used a JSON validator and the problem seems to related to wrong/missing EOF. --- snip --- Error: Parse error on line 1: ...:"1436705823768"} {"created_at":"Sun J

[R] How to correct documentation?

2015-10-23 Thread Ming-Lun Ho
Hi, I used "?mtcars" to read the documentation for the dataset. I found a mistake in how unit is listed, namely, that for the variable "wt," the unit should be listed as "1000 lb," not "lb/1000." However, I don't know whom to contact exactly for the correction. Please point me to the right

Re: [R] elementwise matrix multiplication with a special structure

2015-10-23 Thread David L Carlson
Don't use html formatted emails. The r-help server strips the html formatting leaving us the the mess you see below. You don't need any loops: > aa <- matrix(1:9, 3, 3) > bb <- aa * 10 > cc <- bb * 10 > x <- as.matrix(expand.grid(k=1:3, j=1:3, c=1:3, r=1:3)) > str(x) int [1:81, 1:4] 1 2 3 1 2

[R] JSONlite import problem

2015-10-23 Thread K. Elo
Hi! I have collected 500.000+ tweets with a Python script using 'tweepy', which stored the data in JSON format. I would like to use R for data analysis, but have encountered problems when trying to import the data file with 'jsonlite'. Here what I have tried: >

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Hi Thanks for the suggestion. Unfortunately, the qplot function would work nicely if only I did not need to combine its output with other geom called before... A simple example using the data previously described: ggplot(data, aes(x,y,group=g)) + geom_blank() +

Re: [R] ggplot: combining geom's in function

2015-10-23 Thread sbihorel
Following up on my previous reply, this following would work but would not behave like a geom function: geom_xyplot <- function (gplot, mapping = NULL, data = NULL, stat = "identity", position = "identity", na.rm = FALSE, type = 'p', ...) { if (any(type=='p')){

Re: [R] string split problem

2015-10-23 Thread Jun Shen
Hi Marc/Bill Thanks for reply. That's exactly what I am looking for. Jun On Fri, Oct 23, 2015 at 3:53 PM, William Dunlap wrote: > > test <- c('aaa.bb.cc','aaa.dd', 'aaa', 'aaa.', '.eee', '') > > sub("([^.]*)(.*)", "\\1", test) > [1] "aaa" "aaa" "aaa" "aaa" """" > >

[R] string split problem

2015-10-23 Thread Jun Shen
Dear list, Say I have a vector that has two different types of string test <- c('aaa.bb.cc','aaa.dd') I want to extract the first part of the string (aaa) as a name and save the rest of the string as another name. I was thinking something like sub('(.*)\\.(.*)','\\1',test) but doesn't give me

Re: [R] string split problem

2015-10-23 Thread William Dunlap
> test <- c('aaa.bb.cc','aaa.dd', 'aaa', 'aaa.', '.eee', '') > sub("([^.]*)(.*)", "\\1", test) [1] "aaa" "aaa" "aaa" "aaa" """" > sub("([^.]*)(.*)", "\\2", test) [1] ".bb.cc" ".dd""" "." ".eee" "" Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Oct 23, 2015 at 12:17 PM,

Re: [R] JSONlite import problem

2015-10-23 Thread Duncan Murdoch
On 23/10/2015 3:44 PM, K. Elo wrote: Hi! I have collected 500.000+ tweets with a Python script using 'tweepy', which stored the data in JSON format. I would like to use R for data analysis, but have encountered problems when trying to import the data file with 'jsonlite'. Here what I have

Re: [R] string split problem

2015-10-23 Thread Marc Schwartz
> On Oct 23, 2015, at 2:17 PM, Jun Shen wrote: > > Dear list, > > Say I have a vector that has two different types of string > > test <- c('aaa.bb.cc','aaa.dd') > > I want to extract the first part of the string (aaa) as a name and save the > rest of the string as

[R] Environment question

2015-10-23 Thread ALBERTO VIEIRA FERREIRA MONTEIRO
>From the code below: y <- 1 f1 <- function() { cat("y =", y, "\n") } f2 <- function() { y <- 2 f1() } f3 <- function() { y <- 3 f <- f1 f() } f4 <- function() { y <- 4 f <- function() { cat("y =", y, "\n") } f() } f1() f2() f3() f4() Clearly, f1(), f2() and f4() will

[R] Applying ME in spdep to phylogenetic autocorrelation

2015-10-23 Thread Megan Bartlett
Hi all, I want to fit a model with the form: trait 1 ~ trait 2 + environmental variable while controlling for the phylogenetic relatedness in my study species. I would use phylogenetic least squares regression, but I want to apply an independent effects analysis to partition the effects of

[R] virus/trojan in contributed package: 'svs'

2015-10-23 Thread Bijoy Joseph
Hello, I came across the following when I was installing the 'svs' package: $ clamscan svs_1.0.3.zip svs_1.0.3.zip: BAT.CMDFlood FOUND --- SCAN SUMMARY --- Known viruses: 4035827 Engine version: 0.98.7 Scanned directories: 0 Scanned files: 1 Infected files: 1 clamscan finds