[R] Basket Analysis in R: extract rules

2014-06-26 Thread Abhinaba Roy
Dear R-helpers, I have run a basket analysis in Rattle. I've used 'arules' package. > crs$apriori <- apriori(crs$transactions, parameter = list(support=0.100, confidence=0.100, minlen=2)) and > str(crs$apriori) Formal class 'rules' [package "arules"] with 4 slots ..@ lhs:Formal class 'ite

Re: [R] Error in foo[[1:3]] : recursive indexing failed at level 2

2014-06-26 Thread PIKAL Petr
Hi or > lapply(foo, "[",1)==1 A B C TRUE TRUE FALSE Regards Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of arun > Sent: Friday, June 27, 2014 5:16 AM > To: ce; r-help@r-project.org > Subject: Re: [R] Erro

Re: [R] Error in foo[[1:3]] : recursive indexing failed at level 2

2014-06-26 Thread arun
You could use: mapply(`==`, sapply(foo,`[`,1),1) #    A B C # TRUE  TRUE FALSE A.K. On Thursday, June 26, 2014 10:50 PM, ce wrote: Dear all, I have a list of arrays : foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) > foo $A [1] 1 3 $B [1] 1 2 $C [1] 3 1 I want to use all foo$A

Re: [R] Stringr / Regular Expressions advice

2014-06-26 Thread arun
Hi, May be you can use ?cut or ?findInterval for the range dat1 <- read.table(text="100, 100, 200 250, 300, 350 100, 350, 100 400, 250, 300 200, 450, 200 150, 501, 300 150, 250, 300",sep=",",header=F) sapply(dat1, findInterval, c(400,500))==1 #    V1    V2    V3 #[1,] FALSE FALSE FALSE #[2,]

[R] [HELP] Setting plot colors such that category/color mapping persists across plots

2014-06-26 Thread Kellyn Wolff
Hi all, I'm creating a set of stacked bar charts, where each bar is colored by a category. The problem I'm having is that a given category is being represented by different colors across plots (category A might be red in one plot and blue in another). This is because the number of categories in

Re: [R] regular expression help

2014-06-26 Thread David Winsemius
On Jun 26, 2014, at 6:11 PM, C Lin wrote: > Hi Duncan, > > Thanks for trying to help. Sorry for not being clear. > The string I'd like to get is 'AARSD1' > It can be followed or preceded by white space or // or nothing > > so, from test <- c('AARSD11','AARSD1-','AARSD1//','AARSD1 > //','//AARS

Re: [R] Error in foo[[1:3]] : recursive indexing failed at level 2

2014-06-26 Thread Bert Gunter
foo[[1:3]] asks for the 3rd member of the second component of the list that is nested within the 1st component of the top level list. You have no nested sublists, so this is clearly nonsense. You need to re-read ?"[" or consult The Introduction to R or other online tutorial to understand the seman

[R] Error in foo[[1:3]] : recursive indexing failed at level 2

2014-06-26 Thread ce
Dear all, I have a list of arrays : foo<-list(A = c(1,3), B =c(1, 2), C = c(3, 1)) > foo $A [1] 1 3 $B [1] 1 2 $C [1] 3 1 I want to use all foo$A , foo$B and foo$C in a test : > foo$A[1] == 1 [1] TRUE > foo[[1]][1] == 1 [1] TRUE > foo[[1:3]][1] == 1 Error in foo[[1:3]] : recursive indexi

Re: [R] non-interactive subset, `$`, and quotes

2014-06-26 Thread Benjamin Tyner
Duncan, How embarrassing! Thanks. -Ben On 06/26/2014 10:25 PM, Duncan Murdoch wrote: > On 27/06/2014, 4:08 AM, Benjamin Tyner wrote: >> Hi >> >> I know that subset() is not intended for use in programming. However I >> am still curious to learn why, in non-interactive mode, if I take away >> the

Re: [R] non-interactive subset, `$`, and quotes

2014-06-26 Thread Duncan Murdoch
On 27/06/2014, 4:08 AM, Benjamin Tyner wrote: > Hi > > I know that subset() is not intended for use in programming. However I > am still curious to learn why, in non-interactive mode, if I take away > the quotes around 'bar' > >Rscript -e "foo <- list(bar = iris); head(subset(foo$'bar', > Spe

[R] non-interactive subset, `$`, and quotes

2014-06-26 Thread Benjamin Tyner
Hi I know that subset() is not intended for use in programming. However I am still curious to learn why, in non-interactive mode, if I take away the quotes around 'bar' Rscript -e "foo <- list(bar = iris); head(subset(foo$'bar', Species=='setosa'))" Sepal.Length Sepal.Width Petal.Length P

Re: [R] decreasing blank space in ggplot2 geom_area

2014-06-26 Thread seth
expand works perfectly, thanks VERY much Ista! -Seth - Original Message - From: Ista Zahn To: Cc: Sent:Thu, 26 Jun 2014 14:35:19 -0400 Subject:Re: [R] decreasing blank space in ggplot2 geom_area Hi Seth, See the "expand" argument to ?discrete_scale Best, Ista On Thu, Jun 26, 2014

Re: [R] regular expression help

2014-06-26 Thread C Lin
Hi Duncan, Thanks for trying to help. Sorry for not being clear. The string I'd like to get is 'AARSD1' It can be followed or preceded by white space or // or nothing so, from test <- c('AARSD11','AARSD1-','AARSD1//','AARSD1 //','//AARSD1','AARSD1'); I want to match only 'AARSD1//','AARSD1 //',

Re: [R] regular expression help

2014-06-26 Thread Duncan Mackay
Hi You only have a vector of length 5 and I am not quite sure of the string you are testing so try this grep('[/]*\\[/]*',test) Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au -Original Message

Re: [R] graph

2014-06-26 Thread Duncan Mackay
As Greg has listed lattice Here are ways in lattice quick 1 panel library(lattice) densityplot(~ mu1+mu2+mu3+mu4) dat = data.frame(mu = c(mu1,mu2,mu3,mu4), gp = rep(1:4, sapply(list(mu1,mu2,mu3,mu4), length)) ) densityplot(~ mu|gp, data = dat) densityplot(~ mu|gp, dat, pch = "|") see ?xyplot ?

Re: [R] read a file of text with read.table

2014-06-26 Thread David Winsemius
On Jun 26, 2014, at 12:59 AM, Ron Crump wrote: > Hi Carol, >> It might be a primitive question but I have a file of text and there is no >> separator between character on each line and the strings on each line have >> the same length. The format is like the following >> >> absfjdslf >> jfdldsk

Re: [R] finite differences

2014-06-26 Thread David Winsemius
On Jun 26, 2014, at 3:03 AM, FV wrote: > Hi > > I have a 2D array and I would like to compute finite differences in each > dimension! > Is there any function on R that computes that automatically. > thanks in advance > It doesn't appear that there is a matrix method for diff but why not these:

[R] regular expression help

2014-06-26 Thread C Lin
Dear R users, I need to match a string. It can be followed or preceded by whitespace or // or nothing. How do I code it in R? For example: test <- c('AARSD11','AARSD1-','AARSD1//','AARSD1 //','//AARSD1'); grep('AARSD1(\\s*//*)',test); should return 3,4,5 and 6. Thanks in advance for your help.

Re: [R] Combining character, numeric and dates fields in one data frame

2014-06-26 Thread Jim Lemon
On Thu, 26 Jun 2014 10:42:54 AM Mangalani Peter Makananisa wrote: > Hi, > > I am try to fix the data frame and I see that we only have two fields > defined characters and numeric fields. How do I add date field on the > same data after using the as.Date & as.yearmon and be able to manipulat

Re: [R] subtracting degree minutes

2014-06-26 Thread David L Carlson
This probably doesn't count as simple, but you can convert your format, call it degrees.minutes, to decimal degrees, do the math and then convert back. The functions would be simple: dm2dd <- function(x) trunc(x) + (x - trunc(x))/60*100 dd2dm <- function(x) trunc(x) + (x - trunc(x))*60/100 So y

Re: [R] Stringr / Regular Expressions advice

2014-06-26 Thread Sarah Goslee
Hi, On Thu, Jun 26, 2014 at 12:17 PM, VINCENT DEAN BOYCE wrote: > Hello, > > Using R, I've loaded a .cvs file comprised of several hundred rows and 3 > columns of data. The data within maps the output of a triaxial > accelerometer, a sensor which measures an object's acceleration along the > x,y

Re: [R] Stringr / Regular Expressions advice

2014-06-26 Thread Adams, Jean
You could define a simple function to detect whether a value is within a given range. For example, inrange <- function(vec, range) { !is.na(vec) & vec >= range[1] & vec <= range[2] } x <- 1:30 inrange(x, c(5, 20)) If you wanted to apply this function to all three columns at once, you could use

Re: [R] [R-pkgs] Rook: software and specification for R web applications and servers

2014-06-26 Thread Peter K
Rook apps can be run using the httpd built into R (great feature!), and can be deployed using rApache server. For those who prefer to deploy the apps under FastRWeb, below is the code to do so: -- in your web.R/myrookapp.R file, we ran the Rook app instance (stored in variable app): run <- f

[R] QQ - Plot Inconsistency

2014-06-26 Thread cderasmo85
Hello, I have been using the QQ-Plot functions in R for a while now and I noticed what I believe is a major inconsistency in the way R estimates and plots the quantiles of a data set. To see this, let x be a vector of data (or just simulate some data) say 15 points. Then type qqnorm(x) By defaul

[R] Stringr / Regular Expressions advice

2014-06-26 Thread VINCENT DEAN BOYCE
Hello, Using R, I've loaded a .cvs file comprised of several hundred rows and 3 columns of data. The data within maps the output of a triaxial accelerometer, a sensor which measures an object's acceleration along the x,y and z axes. The data for each respective column sequentially oscillates, and

[R] fitdistrplus : how to get around sigma must be between 0 and 1

2014-06-26 Thread Aki Hoji
Hi all, I posted this question on Cross Validated a while ago but have never gotten an answer. I am trying to see if a discrete distribution will fit a family of zero inflated distributions. I used fitdist from fitdistrplus and several gamlss ZIP functions. Here is a descriptive stat of

[R] subtracting degree minutes

2014-06-26 Thread Trevor Davies
Is there a simple way to subtract base-60 (coordinate system) values? A trivial example: I have a Lat of 44.1 degrees and I want to subtract 0.2 degrees from it. Therefore the answer should be 43.5 degrees (base 60). I can do a change to character; stringsplit ; change back - deal with the leadi

Re: [R] graph

2014-06-26 Thread Greg Snow
Does this do what you want? d1 <- density(mu1) d2 <- density(mu2) d3 <- density(mu3) d4 <- density(mu4) matplot( cbind( d1$x, d2$x, d3$x, d4$x ), cbind( d1$y, d2$y, d3$y, d4$y ), type='l') Or in a more expandable way: mus <- mget( ls(pat='^mu') ) ds <- lapply( mus, density ) xs <- sapply( ds, `

Re: [R] graph

2014-06-26 Thread David L Carlson
You can do it, but mu1 has a much smaller variance and mu3 and mu4 are almost identical so they overplot. > xy1 <- density(mu1) > xy2 <- density(mu2) > xy3 <- density(mu3) > xy4 <- density(mu4) > Density <- cbind(xy1$y, xy2$y, xy3$y, xy4$y) > x <- cbind(xy1$x, xy2$x, xy3$x, xy4$x) > matplot(x, De

Re: [R] decreasing blank space in ggplot2 geom_area

2014-06-26 Thread Ista Zahn
Hi Seth, See the "expand" argument to ?discrete_scale Best, Ista On Thu, Jun 26, 2014 at 7:01 AM, wrote: > I wish to shrink the automatically inserted blank space at either end > of the x axis of my area plot, so that the colorful graphic in the > center takes up more of the available space. W

Re: [R] Simple permutation question

2014-06-26 Thread Greg Snow
For your 2nd question (which also answers your first question) I use the permn function in the combinat package, this function is nice that in addition to generating all the permutations it will also, optionally, run a function on each permutation for you: > t(simplify2array( permn( c("A","B","C")

Re: [R] Erro atualização java

2014-06-26 Thread Prof Brian Ripley
On 26/06/2014 16:57, Greg Snow wrote: Ailan, Most of the readers of this list speak English and you may have an easier time getting an answer if you translate to English (though there may be some native Portuguese speakers on the list that can help you directly). This is a text only list so ple

[R] decreasing blank space in ggplot2 geom_area

2014-06-26 Thread seth
I wish to shrink the automatically inserted blank space at either end of the x axis of my area plot, so that the colorful graphic in the center takes up more of the available space. When I use the scale_x_discrete(limits...) command to expand the displayed area, the graphic shrinks away from the x-

[R] Combining character, numeric and dates fields in one data frame

2014-06-26 Thread Mangalani Peter Makananisa
Hi, I am try to fix the data frame and I see that we only have two fields defined characters and numeric fields. How do I add date field on the same data after using the as.Date & as.yearmon and be able to manipulate the data on the date field(s)? Please advise Kind regards peter Ple

[R] Erro atualização java

2014-06-26 Thread Ailan Gonçalves
Bom dia! Estou tentando rodar o pacote rjava do R e não funciona. Muito do que li na internet sugeriu atualização do Java. Entretanto, não estou conseguindo executar o processo, sempre é interrompido. Segue abaixo o erro que aparece no R. Error : .onLoad falhou em loadNamespace() para 'rJava'

Re: [R] Erro atualização java

2014-06-26 Thread Greg Snow
Ailan, Most of the readers of this list speak English and you may have an easier time getting an answer if you translate to English (though there may be some native Portuguese speakers on the list that can help you directly). This is a text only list so please in the future post in plain text, no

[R] finite differences

2014-06-26 Thread FV
Hi I have a 2D array and I would like to compute finite differences in each dimension! Is there any function on R that computes that automatically. thanks in advance Filipa [[alternative HTML version deleted]] __ R-help@r-project.org mailing l

Re: [R] read a file of text with read.table

2014-06-26 Thread Ron Crump
Hi Carol, It might be a primitive question but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The format is like the following absfjdslf jfdldskjff jfsldfjslk When I read the file with read.table("myfile",colCl

[R] AICc in MuMIn package

2014-06-26 Thread Carlos Bautista León
Hello, I am modelling in glmmADMB count data (I´m using a negative binomial distribution to avoid possitive overdispersion) with four fixed and one random effect. I´m also using MuMIn package to calculate the AICc and also to model averaging using the function dredge. What I do not understand is

[R] graph

2014-06-26 Thread IZHAK shabsogh
kindly guide me on how i can plot the following data on the same graph using the kernel density. i will like to use as to compare performance mu1<-c(500.0035, 501.2213, 500.7532, 500.2622, 500.3391, 500.1618, 499.9511, 500.1843, 499.8945, 499.8467) mu2<-c(498.9623, 504.7938, 506.8957, 495.6634,

[R] Marginal Effects for Hurdle (Two-part) models in R

2014-06-26 Thread Ashutosh Arun
I am very new to R. I am using R package "pscl" for hurdle regression (Binary with "cloglog" link and Poisson with "log" link). My problem is to model road crash frequencies at given locations as a function of road geometry and surface condition. All of my dependent variable are covariates. I wa

Re: [R] Simple permutation question

2014-06-26 Thread Robert Latest
On Wed, 25 Jun 2014 14:16:08 -0700 (PDT) Jeff Newmiller wrote: > The brokenness of your perm.broken function arises from the attempted > use of sapply to bind matrices together, which is not something > sapply does. > > perm.fixed <- function( x ) { >if ( length( x ) == 1 ) return( matrix( x

[R] Réponse automatique

2014-06-26 Thread j . boutet
Bonjour, Je suis absent jusqu'au 4 août prochain. En cas d'urgence, merci de contacter Francis Meunier, directeur-adjoint : f.meunier - at - conservatoirepicardie.org J. Boutet > From: r-help-requ...@r-project.org > Subject: R-help Digest, Vol 136, Issue 26 > Date: Thu, 26 Jun 2014 12:0

Re: [R] read a file of text with read.table

2014-06-26 Thread Rolf Turner
On 26/06/14 21:21, carol white wrote: Hi, with read.fwf, it works. But I still don't understand why it doesn't work with read.table since the sep by default is "", which is the case and in one trial, I used read.table("myfile",colClasses = "character", stringsAsFactors=FALSE, and stil didn't

Re: [R] read a file of text with read.table

2014-06-26 Thread Göran Broström
Carol, while sep="" is the default, it really means 'whitespace', see the documentation of 'sep'. Göran Broström On 2014-06-26 11:21, carol white wrote: Hi, with read.fwf, it works. But I still don't understand why it doesn't work with read.table since the sep by default is "", which is t

Re: [R] read a file of text with read.table

2014-06-26 Thread Rolf Turner
On 26/06/14 20:47, Frede Aakmann Tøgersen wrote: Hi Actually I had to read the man before answering Carol. Here it goes: stringsAsFactors: logical: should character vectors be converted to factors? Note that this is overridden by 'as.is' and 'colClasses', both of which al

Re: [R] read a file of text with read.table

2014-06-26 Thread carol white
Hi, with read.fwf, it works. But I still don't understand why it doesn't work with read.table since the sep by default is "", which is the case and in one trial, I used  read.table("myfile",colClasses = "character", stringsAsFactors=FALSE, and stil didn't work but it should have. Regards,

Re: [R] read a file of text with read.table

2014-06-26 Thread Frede Aakmann Tøgersen
Hi Actually I had to read the man before answering Carol. Here it goes: stringsAsFactors: logical: should character vectors be converted to factors? Note that this is overridden by 'as.is' and 'colClasses', both of which allow finer control. So setting colClasses should work

Re: [R] read a file of text with read.table

2014-06-26 Thread Rui Barradas
Hello, Try using option stringsAsFactors = FALSE. Hope this helps, Rui Barradas On 26/06/2014 09:32, carol white wrote: It might be a primitive question but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The

Re: [R] read a file of text with read.table

2014-06-26 Thread Rolf Turner
On 26/06/14 19:32, carol white wrote: It might be a primitive question All questions are primitive; some questions are more primitive than others. but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The format

Re: [R] read a file of text with read.table

2014-06-26 Thread Frede Aakmann Tøgersen
Hi Carol I cannot reproduce what you're seeing. > tmp <- read.table(text = "absfjdslf + jfdldskjff + jfsldfjslk") > str(tmp) 'data.frame': 3 obs. of 1 variable: $ V1: Factor w/ 3 levels "absfjdslf","jfdldskjff",..: 1 2 3 > tmp <- read.table(text = "absfjdslf + jfdldskjff + jfsldfjslk", + co

[R] read a file of text with read.table

2014-06-26 Thread carol white
It might be a primitive question but I have a file of text and there is no separator between character on each line and the strings on each line have the same length. The format is like the following absfjdslf jfdldskjff jfsldfjslk When I read the file with read.table("myfile",colClasses = "cha