Re: [R] How to define proper breaks in RFM analysis

2017-10-12 Thread PIKAL Petr
Hi Your statement about attaching data is problematic. We cannot do much with it. Instead use output from dput(yourdata) to show us what exactly your data look like. We also do not know how do you want to split your data. It would be nice if you can show also what should be the bins with respe

Re: [R] comparing two strings from data

2017-10-12 Thread Eric Berger
One additional comment. If you want 0 instead of NA when there is no match then the match statement should read: match_list <- match( data_2$data1, data_2$data2, nomatch=0) On Fri, Oct 13, 2017 at 7:39 AM, Eric Berger wrote: > Combining and completing the advice from Greg and Boris the comple

Re: [R] dual y-axis for ggplot

2017-10-12 Thread John
Thanks, Eric! It works well. 2017-10-12 9:13 GMT-07:00 Eric Berger : > Hi John, > You can try the following: > > override.linetype=c("twodash","solid") > p <- ggplot(obs, aes(x = Timestamp)) > p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype > ="Temperature")) > p <- p + geom

Re: [R] comparing two strings from data

2017-10-12 Thread Eric Berger
Combining and completing the advice from Greg and Boris the complete solution is two lines: data_2 <- read.csv("excel_data.csv", stringsAsFactors = FALSE) match_list <- match( data_2$data1, data_2$data2 ) The vector match_list will have the matching position when it exists and NA's otherwise. Its

Re: [R] error in installing igraph

2017-10-12 Thread Paul Burton
Jeff, Did you ever get this resolved? I m having the same problem with igraph. Paul __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project

Re: [R] [FORGED] can't print ggplot with Chinese characters to pdf files

2017-10-12 Thread Paul Murrell
Hi Instead of ... ggsave("test_plot_chinese.pdf", m2) ... try ... cairo_pdf("test_plot_chinese.pdf") print(m2) dev.off() Paul On 13/10/17 02:12, John wrote: I install the Chinese font "Kaiti TC" on my mac, but I can't print the figures to pdf file by "marrangeGrob" command, which is in the

Re: [R] comparing two strings from data

2017-10-12 Thread Boris Steipe
It's generally a very good idea to examine the structure of data after you have read it in. str(data2) would have shown you that read.csv() turned your strings into factors, and that's why the == operator no longer does what you think it does. use ... data_2 <- read.csv("excel_data.csv", strin

Re: [R] comparing two strings from data

2017-10-12 Thread Greg Snow
The error is because the read.csv function converted both columns to factors. The simplest thing to do is to set stringsAsFactors=FALSE is the call to read.csv so that they are compared as strings. You could also call as.character on each of the columns if you don't want to read the data in again

[R] comparing two strings from data

2017-10-12 Thread Yasin Gocgun
Hi, I have two columns that contain numbers along with letters (as shown below) and have different lengths. Each entry in the first column is likely to be found in the second column at most once. For each entry of the first column, if that entry is found in the second column, I would like to get

Re: [R] Recurrence plots in R using different colours

2017-10-12 Thread Jim Lemon
Hi Lisa, I'm not sure exactly what sort of plot you want, but this may help: rcol<-matrix(c(1,0,3,1,0,4,0,0,1,0,5,6),ncol=4,byrow=TRUE) # replace zeros with NAs as there is no numeric color for zero rcol[rcol==0]<-NA library(plotrix) color2D.matplot(rcol,cellcolors=rcol,yat=1:3) Jim On Fri, Oct

Re: [R] How to define proper breaks in RFM analysis

2017-10-12 Thread David Winsemius
> On Oct 12, 2017, at 1:17 AM, Hemant Sain wrote: > > Hello, > I'm working on RFM analysis and i wanted to define my own breaks but my > frequency distribution is not normally distributed so when I'm using > quartile its not giving the optimal results. > so I'm looking for a better approach wher

[R] Recurrence plots in R using different colours

2017-10-12 Thread l.handke
Hello, I am an absolutely beginner with regards to R, so forgive me for my potentially very stupid questions. I have been attempting to create recurrence plots using R. The data I am using is based on a mutually exclusive and exhaustive coding scheme with over 40 individual codes which can be ass

Re: [R] dual y-axis for ggplot

2017-10-12 Thread Eric Berger
Hi John, You can try the following: override.linetype=c("twodash","solid") p <- ggplot(obs, aes(x = Timestamp)) p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity", linetype="Humidity")) p <- p + guides(co

[R] can't print ggplot with Chinese characters to pdf files

2017-10-12 Thread John
I install the Chinese font "Kaiti TC" on my mac, but I can't print the figures to pdf file by "marrangeGrob" command, which is in the package "gridExtra". Error message after I type "ggsave(..)" (last line of the program): "Saving 7.47 x 5.15 in image Error in grid.Call.graphics(L_text, as.gra

[R] How to define proper breaks in RFM analysis

2017-10-12 Thread Hemant Sain
Hello, I'm working on RFM analysis and i wanted to define my own breaks but my frequency distribution is not normally distributed so when I'm using quartile its not giving the optimal results. so I'm looking for a better approach where i can define breaks dynamically because after visualization i c

Re: [R] dual y-axis for ggplot

2017-10-12 Thread John
Sorry let me clarify. If I modify the line p <- p + geom_line(aes(y = air_temp, colour = "Temperature")) by p <- p + geom_line(aes(y = air_temp, colour = "Temperature", linetype ="Temperature")) and p <- p + geom_line(aes(y = rel_hum/5, colour = "Humidity")) by p <- p + geom_line(aes(y = rel_hum/5

[R] dual y-axis for ggplot

2017-10-12 Thread John
Hi, To my knowledge, an excellent of ggplot with a second y-axis is https://rpubs.com/MarkusLoew/226759 In this example, the author uses two colors for the two lines, but the line shapes are the same -- both are solid. Could each line have its own color as well as its own shape? For exampl