[R] Interactive ggvis plot - question

2016-04-24 Thread Lars Bishop
Hello, I'm trying to plot a histogram (or alternatively the density) of a variable, with a slider that displays a vertical line with the corresponding quantile of the distribution of the variable. That is, I what to interactivity pick for example, the median, and have the vertical line move to the

Re: [R] Java memory error when reading a small xlsx file

2016-04-24 Thread jim holtman
Try using the openxlsx package; it does not require Java. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Sat, Apr 23, 2016 at 3:43 PM, jpm miao wrote: > Hi, > >I tried to read a (small) xlsx file by

Re: [R] CRAN package check results tabulated ... wasRe: Number of package in Ubuntu

2016-04-24 Thread boB Rudis
Or grab https://cran.r-project.org/web/checks/check_results.rds and read it w/o the need for scraping. On Sat, Apr 23, 2016 at 10:43 AM, David Winsemius wrote: > >> On Apr 23, 2016, at 6:56 AM, David Winsemius wrote: >> >> >>> On Apr 22, 2016, at 11:51 AM, mylistt...@gmail.com wrote: >>> >>> Dea

[R] Inserting a blank row to every other row

2016-04-24 Thread Saba Sehrish via R-help
Hi I need to insert a blank row after every row in R data frame. I have achieved it through: df[rep(1:nrow(df),1,each=2),] But it inserts a row with name of previous row, while i want a complete blank row without any name/title. Please guide me Regards Saba

Re: [R] Inserting a blank row to every other row

2016-04-24 Thread Ulrik Stervbo
Hi Saba, I don't know how to do what you want and I also cannot see why. If you describe what you hope to achieve there might be a different solution. Best wishes Ulrik Saba Sehrish via R-help schrieb am So., 24. Apr. 2016 14:04: > Hi > > I need to insert a blank row after every row in R data

Re: [R] Dividing rows in groups

2016-04-24 Thread jim holtman
You can use 'dplyr': > library(dplyr) > df1 <- read.table(text = "ID A B + 1 1 2 + 1 0 3 + 25 NA + 2 1 3 + 3 1 4 + 4 NA NA + 4 0 1 + 4

Re: [R] Inserting a blank row to every other row

2016-04-24 Thread Bert Gunter
Well, something like this would work (there may be slicker solutions): > z <- data.frame(a=1:3,b = letters[1:3]) > i <- seq_len(nrow(z)) *2 > z <-rbind(z,z) > z[i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z)) > z ab 1 1a 2 NA 3 3c 4 NA 5 2b 6 NA But I agree with you that there

Re: [R] assign color to subsets

2016-04-24 Thread jim holtman
You never did provide a reproducible example or say how you wanted to plot. Here is a way to get a subset of t1 or t2, and you can then use it as input to ggplot: library(dplyr) your_subset <- df %>% mutate(key = grep(".*(t1|t2).*", "\\1", Command, value = TRUE)) %>% filter(!(

Re: [R] Inserting a blank row to every other row

2016-04-24 Thread Bert Gunter
Oh, sorry, I just realized that I messed up the indicing. Here is the correct way: > z <- data.frame(a=1:3,b = letters[1:3]) > i <- seq_len(nrow(z)) > z<-z[rep(i,e=2),] > z[2*i, ] <- matrix(NA, nr=nrow(z),nc=ncol(z)) > z Still doubt that this is a good idea, though. -- Bert Bert Gunter "T

Re: [R] Dividing rows in groups

2016-04-24 Thread jim holtman
This will handle all the columns; it assumes the ones you want to start with are in column 2 through the end: > library(dplyr) > df1 <- read.table(text = "ID A B + 1 1 2 + 1 0 3 + 25 NA + 2 1 3 + 3

Re: [R] Inserting a blank row to every other row

2016-04-24 Thread Giorgio Garziano
Starting from this data frame: my.df <- data.frame(num = 1:5, let = letters[1:5]) > my.df num let 1 1 a 2 2 b 3 3 c 4 4 d 5 5 e > and inserting a blank row (NAs row) for each one of my.df rows. na.df <- data.frame(num = NA, let = NA) my.df <- do.call(rbind, apply(my.df, 1

Re: [R] multiplication by groups

2016-04-24 Thread Giorgio Garziano
df1 <- data.frame(ID = c(1,1,2,2,3,3,4,4,5,5), A = c(1,0,5,1,1,NA,0,3,2,7), B = c(2,3,NA,3,4,NA,1,0,5,NA)) df2 <- data.frame(ID = c(1,2,3,4,5), A = c(1,6,1,3,9), B = c(5,3,4,1,5)) m <- match(df1$ID, df2$ID) sel <- c("A",

Re: [R] assign color to subsets

2016-04-24 Thread ch.elahe via R-help
my problem is that in Command I have 2229 levels and I want to do subsets based on the names I have in Command. for example if the name has t1 or t2 in it or if it has both of them.and then I need to plot in a way that colors are names with t1,names with t2 and names with both. But now even t

Re: [R] assign color to subsets

2016-04-24 Thread jim holtman
'grepl' returns a logical vector; you have to use this to get your subset. You can use: df_tq <- subset(df, grepl("t1", Command)) df_t2 <- subset(df, grepl("t2", Command)) # if you want to also get a subset that has both, use df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command))

[R] Using read.csv() to import data

2016-04-24 Thread Jason Hernandez via R-help
I am just beginning to learn R, using _R for Dummies_ by Andrie de Vries and Joris Meys. I am using Windows 7, and RGui (64-bit) version 3.0.2. I have reached the chapter on "Getting Data Into and Out of R." But the code they use for importing data doesn't seem to be working for me. Their examp

[R] How to take a multidimensional data set to higher dimensions using R?

2016-04-24 Thread Devesh Raj Singh
Hi, I have a multidimensional data-set( multiple 'x' variables with a target variable). I want to take it to a higher dimensional space so that I can apply classification technique with ease . Is there a package in R which would allow me to take these data points from lower dimensional space to hi

[R] Fwd: Re: Using read.csv() to import data

2016-04-24 Thread WRAY NICHOLAS
You probably have not reset the directory -- go to the session tab on the R window, click and go to “set working directory” as C Nick Original Message -- From: WRAY NICHOLAS To: Jason Hernandez Date: 24 April 2016 at 21:44 Subject: Re: [R] Using read.csv() to import data You

Re: [R] Using read.csv() to import data

2016-04-24 Thread Duncan Murdoch
On 24/04/2016 4:30 PM, Jason Hernandez via R-help wrote: I am just beginning to learn R, using _R for Dummies_ by Andrie de Vries and Joris Meys. I am using Windows 7, and RGui (64-bit) version 3.0.2. I have reached the chapter on "Getting Data Into and Out of R." But the code they use for impo

Re: [R] How to take a multidimensional data set to higher dimensions using R?

2016-04-24 Thread Bert Gunter
Many: https://cran.r-project.org/web/views/MachineLearning.html -- 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 Sun, Apr 24, 2016 at 10:39 AM, Devesh

Re: [R] assign color to subsets

2016-04-24 Thread ch.elahe via R-help
now after this: df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command)) I use factor to apply the subset to df but then the Command level becomes 0 df_both$Command=factor(df_both$Command) str(df_both) $ Protocol : Factor w/ 0 levels: Do you know what is the r

Re: [R] How to take a multidimensional data set to higher dimensions using R?

2016-04-24 Thread Jeff Newmiller
Isn't the normal way to do this to collect additional independent variables as part of your test protocol? -- Sent from my phone. Please excuse my brevity. On April 24, 2016 10:39:06 AM PDT, Devesh Raj Singh wrote: >Hi, > >I have a multidimensional data-set( multiple 'x' variables with a >tar

Re: [R] assign color to subsets

2016-04-24 Thread jim holtman
Check the size of df_both. It would be that there are no Command fields that contain both a 't1' and 't2'. You can so do: sum(grepl("t1", df$Command) & grepl("t2", df$Command)) to see how many Command fields contain both. Jim Holtman Data Munger Guru What is the problem that you are trying t

[R] R: use switch or function in connecting different cases.

2016-04-24 Thread tan sj
HI, I am trying to use switch () function to connect the three distribution (normal ,gamma with equal skewness and gamma with unequal skewness. But i am losing my ideas since i have sample sizes-(10,10),(10,25),(25,25),(25,50),(25,100),50,25),(50,100), (100,25),(100,100) standard deviation rat

Re: [R] Plotting a large time series

2016-04-24 Thread Jim Lemon
Hi Adrian, This is probably taking a long time. I first tried with 7x10^6 times and values and it took several minutes. The following code does what I expected: amdat<-data.frame(time=1:70,value=rnorm(70,-4)) amdat$value[amdat$value<0]<-0 sum(amdat$value) [1] 5.07101 plot(amdat$time,amdat$

[R] Please assist -- Unable to remove '-' character from char vector--

2016-04-24 Thread Sunny Singha
Hi, I have a char vector with year values. Some cells have single year value '2001-' and some have range like 1996-2007. I need to remove hyphen character '-' from all the values within the character vector named as 'end'. After removing the hyphen I need to get the last number from the cells where

Re: [R] Splitting Numerical Vector Into Chunks

2016-04-24 Thread PIKAL Petr
Hi Is this http://stackoverflow.com/questions/2150138/how-to-parse-milliseconds-in-r what do you want? Cheers Petr > -Original Message- > From: Sidoti, Salvatore A. [mailto:sidoti...@buckeyemail.osu.edu] > Sent: Sunday, April 24, 2016 1:48 AM > To: PIKAL Petr ; William Dunlap > ; Ista