Re: [R] [FORGED] help with gradient boxplot

2016-12-06 Thread Paul Murrell
Hi 'gridSVG' might be one way to get this. For example ... library(lattice) # Draw boxplot (with a package that sits on top of 'grid') bwplot(voice.part ~ height, data=singer, xlab="Height (inches)", horizontal=FALSE) library(grid) grid.ls() # Looks like boxes are called bwplot.box.poly

Re: [R] Odd behaviour of mean() with a numeric column in a tibble

2016-12-06 Thread Ista Zahn
On Tue, Dec 6, 2016 at 5:10 PM, Chris Evans wrote: > {{SIGH}} > > You are absolutely right. > > I wonder if I am losing some cognitive capacities that are needed to be part > of the evolving R community. It seems to me that if a tibble is designed to > be an enhanced replacement for a dataframe

[R] 1: Setting LC_CTYPE failed, using "C"

2016-12-06 Thread Christian
At startup or and using R CMD .. I stumble about 1: Setting LC_CTYPE failed, using "C" 2: Setting LC_TIME failed, using "C" 3: Setting LC_MESSAGES failed, using "C" 4: Setting LC_MONETARY failed, using "C" Iam am working with R version 3.3.2 (2016-10-31) Platform: x86_64-apple-darwin13.4.0 (64-

Re: [R] Odd behaviour of mean() with a numeric column in a tibble

2016-12-06 Thread Jeff Newmiller
You really need sleep. Then you need to read ?`[[` and in particular read about the second argument to the `[[` function, since you don't seem to understand what it is for. Maybe reread the Introduction to R document that comes with R. The simplest solution is to treat `[[` as supporting one i

Re: [R] Odd behaviour of mean() with a numeric column in a tibble

2016-12-06 Thread Chris Evans
{{SIGH}} You are absolutely right. I wonder if I am losing some cognitive capacities that are needed to be part of the evolving R community. It seems to me that if a tibble is designed to be an enhanced replacement for a dataframe then it shouldn't quite so radically change things. I notic

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread Bert Gunter
Simpler I think: ?all.vars > all.vars(~A+B) [1] "A" "B" Note also: > all.vars(~log(A)) [1] "A" Cheers, Bert "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Dec

Re: [R] Odd behaviour of mean() with a numeric column in a tibble

2016-12-06 Thread Ista Zahn
Not at a computer to check right now, but I believe single bracket indexing a tibble always returns a tibble. To extract a vector use [[ On Dec 6, 2016 4:28 PM, "Chris Evans" wrote: > > I hope I am obeying the list rules here. I am using a raw R IDE for this and running 3.3.2 (2016-10-31) on x86_

Re: [R] drawing a ... barplot (?) along time

2016-12-06 Thread Jim Lemon
Hi Dagmar, Having recovered somewhat, I can refine my suggestion a bit: datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"), changepoint=as.POSIXct(strptime(c("03.01.2011","05.01.2011", "27.01.2011", "26.01.2011","28.01.2011", "28.02.2011"), "%d.%m.%Y")), knownstate =c("br

Re: [R] R for skip to the next row if condition met and then another condition to check

2016-12-06 Thread Adams, Jean
This might help. # your example data trboot3 <- structure(c(0L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, 0L, 0L, -1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, -1L, -1L, 0L, 1L, 0L, 0L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, -1L, 0L, 0L, 0L, 0

[R] Odd behaviour of mean() with a numeric column in a tibble

2016-12-06 Thread Chris Evans
I hope I am obeying the list rules here. I am using a raw R IDE for this and running 3.3.2 (2016-10-31) on x86_64-w64-mingw32/x64 (64-bit) Here is a reproducible example. Code only first require(tibble) tmpTibble <- tibble(ID=letters,num=1:26) min(tmpTibble[,2]) # fine max(tmpTibble[,2]) # fine

Re: [R] CONFUSSING WITH select[!miss] <- 1:sum(!miss)

2016-12-06 Thread Jim Lemon
Hi Greg, What is happening is easy to see: ph<-matrix(sample(1:100,40),ncol=4) colnames(ph)<-c("M1","X1","X2","X3") ph[sample(1:10,3),1]<-NA ph M1 X1 X2 X3 [1,] 34 98 3 35 [2,] 13 66 74 68 [3,] NA 22 99 79 [4,] 94 6 80 36 [5,] 18 9 16 65 [6,] NA 29 56 90 [7,] 41 23 7 5

[R] help with gradient boxplot

2016-12-06 Thread Fix Ace
Hello, there, I will like to fill the boxplot with gradient color, as exampled below: Can anyone help me figure out what package I should go with? Thank you very much for any inputs! Kind regards, Ace __ R-help@r-project.org mailing list -- To UNSUBSCRIB

[R] Polygon to raster with large data set

2016-12-06 Thread Vetter, Vanessa
Hi everyone, I have a very large shapefile with many polygons (17769 polygons, 104.4 Mb), which I want to convert to a raster file. A grid cell can be covered by either none, 1 or several polygons. I want to assign the percentage cover of polygons to the respective grid cell, just like the funct

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Patrick Casimir
Will do. From: Ista Zahn Sent: Tuesday, December 6, 2016 2:49:30 PM To: Patrick Casimir Cc: r-help@r-project.org Subject: Re: [R] Why is DocumentTermMatrix showing 0 term? On Tue, Dec 6, 2016 at 2:28 PM, Patrick Casimir wrote: > Actually, the DTM works now. Th

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Ista Zahn
On Tue, Dec 6, 2016 at 2:28 PM, Patrick Casimir wrote: > Actually, the DTM works now. This is amazing. Million thanks. Why wasn't it > working before? Do as I suggested and start adding back your tm_map's until you find the thing that breaks it. --Ista > > See below: > > >> cname <- file.path

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Patrick Casimir
Actually, the DTM works now. This is amazing. Million thanks. Why wasn't it working before? See below: > cname <- file.path("C:\\Users\\Desktop\\Text Mining\\Cases\\MyCorpus") > docs <- Corpus(DirSource(cname)) > dtm <- DocumentTermMatrix(docs) > dtm <> Non-/sparse entries: 920/2144 Sparsity

Re: [R] CONFUSSING WITH select[!miss] <- 1:sum(!miss)

2016-12-06 Thread William Dunlap via R-help
R is interactive so you can print the intermediate results: > ph <- data.frame(M1=c(1,NA,3,4,5), X1=1:5, X2=c(1,2,NA,4,5), X3=1:5, Y=c(11,12,13,14,NA), row.names=paste0("R",1:5)) > ph M1 X1 X2 X3 Y R1 1 1 1 1 11 R2 NA 2 2 2 12 R3 3 3 NA 3 13 R4 4 4 4 4 14 R5 5 5 5 5 NA > miss

Re: [R] CONFUSSING WITH select[!miss] <- 1:sum(!miss)

2016-12-06 Thread Rui Barradas
Hello, The first command line produces a logical vector with TRUE if at least one row element of ph is NA and FALSE otherwise. The second creates a vector of zeros with length equal to nrow(ph). Now the third command line. ! negates miss, so TRUE becomes FALSE and vice-versa. sum(!miss) counts

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread David Winsemius
> On Dec 6, 2016, at 7:33 AM, Rui Barradas wrote: > > Perhaps the best way is the one used by library(), where both > library(package) and library("package") work. It uses > as.charecter/substitute, not deparse/substitute, as follows. > > mydf <- > data.frame(id=c(1,2,3,4,5),sex=c("M","M","M

[R] CONFUSSING WITH select[!miss] <- 1:sum(!miss)

2016-12-06 Thread greg holly
Dear All; I am very new in R and try to understand the logic for a program has been run sucessfully. Here select[!miss] <- 1:sum(!miss) par is confussing me. I need to understandand the logic behind this commend line. Thanks in advance for your help, Greg miss <- apply(is.na(ph[,c("M1","X1","X

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread Rui Barradas
Perhaps the best way is the one used by library(), where both library(package) and library("package") work. It uses as.charecter/substitute, not deparse/substitute, as follows. mydf <- data.frame(id=c(1,2,3,4,5),sex=c("M","M","M","F","F"),age=c(20,34,43,32,21)) mydf class(mydf) str(mydf) myf

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread Rui Barradas
Ok, that's a way of seeing it. Rui Barradas Em 06-12-2016 14:28, John Sorkin escreveu: Over my almost 50 years programming, I have come to believe that if one wants a program to be useful, one should write the program to do as much work as possible and demand as little as possible from the user

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Ista Zahn
Does cname <- file.path("C:\\Users\\Desktop\\Text Mining\\Cases\\MyCorpus") docs <- Corpus(DirSource(cname)) dtm <- DocumentTermMatrix(docs) dtm work? If so, add start adding back your tm_map until you find the thing that breaks it. Best, Ista On Tue, Dec 6, 2016 at 10:25 AM, Patrick Casimir

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Bert Gunter
Fortune Nomination! Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Dec 6, 2016 at 6:09 AM, Ista Zahn wrote: > Hi Patrick, > > How could any

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread William Dunlap via R-help
Note that library has another argument, character.only=TRUE/FALSE, to control whether the main argument should be regarded as a variable or a literal. I think you need two arguments to handle this. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Dec 6, 2016 at 7:33 AM, Rui Barradas wrote:

Re: [R] memory allocation problem

2016-12-06 Thread Jeff Newmiller
Buy more memory? Do something different than you were doing before the error occurred? Use a search engine to find what other people have done when this message appeared? Follow the recommendations in the Posting Guide mentioned in the footer of this and every post on this mailing list? -- Sen

[R] memory allocation problem

2016-12-06 Thread Elham - via R-help
hi everyone, I tried to run my code in RStudio,but I received this error message,what should I do? Error: cannot allocate vector of size 12.1 Gb In addition: Warning messages: 1: In cor(coding.rpkm[grep("23.C", coding.rpkm$name), -1], ncoding.rpkm[grep("23.C", : Reached total allocation of 602

[R] (no subject)

2016-12-06 Thread Elham - via R-help
hi everyone,I tried to run my code in RStudio,but I received this error message,what should I do?Error: cannot allocate vector of size 12.1 Gb In addition: Warning messages: 1: In cor(coding.rpkm[grep("23.C", coding.rpkm$name), -1], ncoding.rpkm[grep("23.C", : Reached total allocation of 6027M

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Patrick Casimir
docs has 4 documents and inspect(docs) shows 4 plaintextdocument > summary(docs) Length Class Mode case1.txt 2 PlainTextDocument list case2.txt 2 PlainTextDocument list case3.txt 2 PlainTextDocument list case4.txt 2 PlainTextDocument list > inspect(doc

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Ista Zahn
What is in docs? What does inspect(docs) say? --Ista On Tue, Dec 6, 2016 at 9:29 AM, Patrick Casimir wrote: > Thanks Ista. See codes below. I am not sure why the DTM is showing 0 term. I > have 4 documents in the corpus. And I was able to make transformations > > to the documents inside the

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread William Dunlap via R-help
I basically agree with Rui - using substitute will cause trouble. E.g., how would the user iterate over the columns, calling your function for each? for(column in dataFrame) func(column) would fail because dataFrame$column does not exist. You need to provide an extra argument to handle this

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Patrick Casimir
Thanks Ista. See codes below. I am not sure why the DTM is showing 0 term. I have 4 documents in the corpus. And I was able to make transformations to the documents inside the corpus. > cname <- file.path("C:\\Users\\Desktop\\Text Mining\\Cases\\MyCorpus") > dir(cname) [1] "case1.txt" "case2.tx

Re: [R] Write a function that allows access to columns of a passeddataframe.

2016-12-06 Thread John Sorkin
Over my almost 50 years programming, I have come to believe that if one wants a program to be useful, one should write the program to do as much work as possible and demand as little as possible from the user of the program. In my opinion, one should not ask the person who uses my function to re

Re: [R] LaTeX errors when creating PDF version.

2016-12-06 Thread Richard M. Heiberger
The specific error message you are getting says that there are non-ASCII characters in one of your .Rd files. You can locate them with the tools::showNonASCII function. library(tools) ?showNonASCII Replace them with ASCII characters and the packaging should work. If you really need the non-ASCI

Re: [R] LaTeX errors when creating PDF version.

2016-12-06 Thread J C Nash
What operating system? It is very unlikely anyone will offer help in the darkness. JN On 16-12-06 01:20 AM, Pijush Das wrote: > Hello Sir, > > I am facing a common problem in R. I have searched a lot but nobody gives a > proper way. The problem is : when I am tying to check my package in R > cr

Re: [R] LaTeX errors when creating PDF version.

2016-12-06 Thread peter dalgaard
This is not really an R problem but a TeX one. Apparently, your input file contains Unicode characters that LaTeX doesn't know what to do with. That raises the suspicion is that the file might not be in UTF-8 encoding at all, however tan kind of issue does occasionally happen, even in UTF-8, if

Re: [R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Ista Zahn
Hi Patrick, How could anyone possibly answer this question with only the information you've provided? It's like showing me an empty cup and asking why it's empty. Maybe you didn't put anything in it. Maybe you did and then you dog drank it or your cat knocked it over or your girlfriend drank it. H

Re: [R] Forecast Modeling using R model node in SPSS Modeler

2016-12-06 Thread Ista Zahn
Hi Paul, Not everything people ask for makes sense. If you insist on trying to get R integration working in SPSS you should reach out to the SPSS company and/or community for support. Best, Ista On Dec 6, 2016 8:05 AM, "Paul Bernal" wrote: > Hi Ista, > > Your suggestion is great. There is no b

Re: [R] Using ggplot2 to plot percentages in bar chart.

2016-12-06 Thread Shawn Way
This worked well! Thank you very much. For the record, the stat_bin was used in a solution I found on stackexchange for something similar, but I was having issues adapting. Thanks again to all who responded. I appreciate it greatly. Shawn Way, PE -Original Message- From: Jeff Newmill

Re: [R] Forecast Modeling using R model node in SPSS Modeler

2016-12-06 Thread Paul Bernal
Hi Ista, Your suggestion is great. There is no better way to work with R than working with R directly, however, I have been asked to generate forecasts in SPSS Modeler using the R integration that comes with it, so unfortunately, I need to find a way around. If I find the way to do it, I will make

[R] Why is DocumentTermMatrix showing 0 term?

2016-12-06 Thread Patrick Casimir
<> Non-/sparse entries: 0/0 Sparsity : 100% Maximal term length: 0 Weighting : term frequency (tf) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.eth

[R] LaTeX errors when creating PDF version.

2016-12-06 Thread Pijush Das
Hello Sir, I am facing a common problem in R. I have searched a lot but nobody gives a proper way. The problem is : when I am tying to check my package in R created by me it shows an error given below * checking PDF version of manual ... WARNING > LaTeX errors when creating PDF version. This typi

Re: [R] (no subject)

2016-12-06 Thread John Kane via R-help
No attachment.  R-help; is very fussy about the type of file it will accept. Try a text document with .txt extention or just put the code and the sample data in the actual email. Use dput(), see ?dput for details, to provide the data. On Tuesday, December 6, 2016 6:51 AM, michael tsagris

Re: [R] create list of vectors in for loop

2016-12-06 Thread peter dalgaard
On 06 Dec 2016, at 11:17 , Jim Lemon wrote: > Hi Paul, > The easy to understand way is: > > n <- c(1:10) > # Create empty list to store vectors > list_of_vecs <- list() > > # Create n vectors of random numbers - length 10. This works ok. > for (i in n){ > list_of_vecs[[i]]<-rnorm(10,0,1) > }

Re: [R] Using ggplot2 to plot percentages in bar chart.

2016-12-06 Thread John Kane via R-help
Well personally I would not have a clue on how to approach the problem but have a look at http://stackoverflow.com/questions/6644997/showing-data-values-on-stacked-bar-chart-in-ggplot2. which seems to do what you want only using geom_text() Best of luck.   On Monday, December 5, 2

[R] (no subject)

2016-12-06 Thread michael tsagris via R-help
Hello, I have encountered a problem when running a glm with the inverse gaussian as distribution and the log as a link function. Do you think this could be a bug, or something else?Attached is a document to run the example. I have written my own functions and they seem to work fine. ___

Re: [R] create list of vectors in for loop

2016-12-06 Thread Jim Lemon
Hi Paul, The easy to understand way is: n <- c(1:10) # Create empty list to store vectors list_of_vecs <- list() # Create n vectors of random numbers - length 10. This works ok. for (i in n){ list_of_vecs[[i]]<-rnorm(10,0,1) } If you really want to use "assign": for (i in n){ vecname<-paste('v

Re: [R] drawing a ... barplot (?) along time

2016-12-06 Thread Jim Lemon
Hi Dagmar, I think you want something like a gantt.chart. I know this is wrong in some ways, but it is late and I must retire: datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"), changepoint=as.Date(c("03.01.2011","05.01.2011", "27.01.2011", "26.01.2011","28.01.2011", "28.

[R] drawing a ... barplot (?) along time

2016-12-06 Thread Dagmar
# Dear all, # I hope someone can help me with this, I am kind of desperated even though it doesn't sound to complicated at all. Let's see: # I have a data frame like this: datframe <- data.frame(Name=c("Kati","Kati","Kati","Leon","Leon","Leon"), changepoint =as.POSIXct

Re: [R] create list of vectors in for loop

2016-12-06 Thread Paul Sanfilippo
Thank you Jim. On 6 December 2016 at 9:17:21 pm, Jim Lemon (drjimle...@gmail.com) wrote: Hi Paul, The easy to understand way is: n <- c(1:10) # Create empty list to store vectors list_of_vecs <- list() # Create n vectors of random numbers - length 10. This works ok. for (i in n){

[R] create list of vectors in for loop

2016-12-06 Thread Paul Sanfilippo
Hi, As an exercise, I am trying to create a list of 10 random number vectors in a loop. I can create the vectors but am unsure how to assemble them in the list as part of the loop. Any advice? # Number of vectors to create n <- c(1:10) # Create empty list to store vectors list_of_vecs <- list

Re: [R] Write a function that allows access to columns of a passed dataframe.

2016-12-06 Thread Rui Barradas
Hello, Just to say that I wouldn't write the function as John did. I would get rid of all the deparse/substitute stuff and instinctively use a quoted argument as a column name. Something like the following. myfun <- function(frame, var){ [...] col <- frame[, var] # or frame[[