Re: [R] lubridate inserting unwelcome 9:21

2017-03-28 Thread Troels Ring
Thanks a lot - I got interested to make it work since just formatting in lubricate as a time automatically puts the same complete date, which was OK for me - and also provided a utility for adding days - which apparently then needs tweaking - Best wishes Troels Den 28-03-2017 kl. 20:38

Re: [R] A question on modeling brain growth using GAM

2017-03-28 Thread David Winsemius
> On Mar 28, 2017, at 9:32 AM, Leon Lee wrote: > > Hi, R experts > > I am new to R & GAM toolbox and would like to get inputs from you all on my > models. The question I have is as follows: > I have 30 subjects with each subject being scanned from one to three times > in

Re: [R] lubridate inserting unwelcome 9:21

2017-03-28 Thread Jeff Newmiller
Analyzing time data as POSIXct without dates is IMO unwise (likely to give you trouble). My approach is to always keep the date and time together or to use numeric hours-after-midnight. Others have invented packages like chron to deal with such data. -- Sent from my phone. Please excuse my

Re: [R] Splitting on metacharacters

2017-03-28 Thread Nordlund, Dan (DSHS/RDA)
What you are seeing when printing depends on how you do it (and it can be confusing). Try this, type the following lines exactly (or copy and paste) and carefully study the results. In particular, compare the results of cat(s,'\n') with the results of strsplit(s, '"') . s <-

Re: [R] How to apply calculations in "formula" to "data frame"

2017-03-28 Thread Sören Vogel
`model.matrix` was what I was looking for. Thanks, Sören > On 28.03.2017, at 16:57, peter dalgaard wrote: > > >> On 28 Mar 2017, at 16:14 , Sören Vogel wrote: >> >> Hello >> >> Ho can I apply a formula to a data frame? > > > That would depend on

Re: [R] Splitting on metacharacters

2017-03-28 Thread Boris Steipe
You haven't actually _defined_ what the expected range of variations of your string are, but if I speculate wildly, I can come up with the following two solutions that may get you started. s <- '*"{\"Q0\":\"37\",\"Q1\":\"f\"}"*' regmatches(s, gregexpr("([0-9]{2,}|[a-z]+)", s))[[1]] strsplit(s,

[R] Splitting on metacharacters

2017-03-28 Thread Patzelt, Edward
Hi R-help, I would like to: Extract the "26" and "f" from the following string (i.e. age and gender). I've tried a bunch of strsplit, grep, etc. Please help! *"{\"Q0\":\"37\",\"Q1\":\"f\"}"* Thanks, Edward -- Edward H Patzelt | Clinical Science PhD Student Psychology | Harvard University

[R] A question on modeling brain growth using GAM

2017-03-28 Thread Leon Lee
Hi, R experts I am new to R & GAM toolbox and would like to get inputs from you all on my models. The question I have is as follows: I have 30 subjects with each subject being scanned from one to three times in the first year of life. The brain volume from each scan was measured. The scan time

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread David L Carlson
You have multiple problems. You do not seem to understand read.csv() or as.Date() so you really need to read the manual pages: ?read.csv ?as.Date > Data <- read.csv("Container.csv") > str(Data) 'data.frame': 362 obs. of 1 variable: $ TransitDate.Transits: Factor w/ 362 levels

Re: [R-es] Alternativa a RStudio

2017-03-28 Thread rubenfcasal
Hola a todos, La lista de mensajes es muy grande pero creo que no se comentaron algunos que uso/usé: TinnR: (para Windows) Un editor de código que interacciona con la consola de R [https://sourceforge.net/projects/tinn-r] Notepad++ con NppToR: (para Windows) similar al anterior

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Paul Bernal
Dear friend David, Thank you for your valuable suggestion. So here is the file in .txt format. Best of regards, Paul 2017-03-28 9:35 GMT-05:00 David L Carlson : > We did not get the file on the list. You need to rename your file to > "Container.txt" or the mailing list will

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Ng Bo Lin
Hi Paul, Using the example provided by Ulrik, where > exdf1 <- data.frame(Date = c("1985-10-01", "1985-11-01", "1985-12-01”, > "1986-01-01"), Transits = c(NA, NA, NA, NA)) > exdf2 <- data.frame(Date = c("1985-10-01", "1986-01-01"), Transits = > c(15,20)), You could also try the following

Re: [R] Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-03-28 Thread Ulrik Stervbo
Hi Georg, you were on the right path - it is all about scale_fill* The 'problem' as you've discovered is that value is continuous, but applying scale_fill_manual or others (except scale_fill_gradient) expects discrete values. The solution is simply to set the fill with that by using factor():

[R] ANOVA for one subject

2017-03-28 Thread Uri Eduardo Ramírez Pasos
Dear everyone, I have a 2x3 design (medication x stimulus type) but very few subjects (6) and I would like to perform intra-subject stats using r's aov (I've already run the group analysis). Is there a conceptual problem with this, as long as I don't interpret the results as representative of

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Ng Bo Lin
Hi Paul, The date format that you have supplied to R isn’t exactly right. Instead of supplying the format “%Y-%m-%d”, it appears that the format of your data adheres to the “%e-%B-%y” format. In this case, %e refers to Day, and takes an integer between (0 - 31), %B refers to the 3 letter

Re: [R] Way to Plot Multiple Variables and Change Color

2017-03-28 Thread Richard M. Heiberger
The colors can be specified with the standard lattice "col=" argument. likert(t(BB), ReferenceZero=0, horizontal=FALSE, col=RColorBrewer::brewer.pal(4, "Blues")) Most other customizations you might need are also possible. Many examples are in the examples section of ?likert and in the

[R] Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi Ulrik, your answer is very valuable to me. If you do not know what I do, others don't either. So I should definitely adapt my code. The result of your code and my code is the same. Thus, I use your code cause it is better readable. My other question was how I can change the color palette

[R] Antwort: Re: Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi Richard, many thanks for your reply. Your solution is not exactly what I was looking for. I would like to know how I can change the colors of the stacked bars in my plot and not use the default values. How can this be done? Kind regards Georg Von:"Richard M. Heiberger"

Re: [R] Way to Plot Multiple Variables and Change Color

2017-03-28 Thread Richard M. Heiberger
I think you are looking for the likert function in the HH package. >From ?likert Diverging stacked barcharts for Likert, semantic differential, rating scale data, and population pyramids. This will get you started. Much more fine control is available. See the examples and demo. ##

[R] lubridate inserting unwelcome 9:21

2017-03-28 Thread Troels Ring
Dear friends - I have a series of times on successive days and would like to convert them into a successive common time for each person (ID) . Using lubridate and adding days(1) does as expected apart from changing time zone to LMT from UTC and suddenly adding 9:21 (H:M) to all times.

Re: [R] How to apply calculations in "formula" to "data frame"

2017-03-28 Thread peter dalgaard
> On 28 Mar 2017, at 16:14 , Sören Vogel wrote: > > Hello > > Ho can I apply a formula to a data frame? That would depend on whether the formula has any special interpretation. If if is just an elementary expression, then it would be like eval(For1[[3]], Data,

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread David L Carlson
We did not get the file on the list. You need to rename your file to "Container.txt" or the mailing list will strip it from your message. The read.csv() function returns a data frame so Data is already a data frame. The command DataFrame<-data.frame(Data) just makes a copy of Data. Without

Re: [R] Way to Plot Multiple Variables and Change Color

2017-03-28 Thread Ulrik Stervbo
Hi Georg, I am a little unsure of what you want to do, but maybe this: mdf <- melt(dfr) d_result <- mdf %>% dplyr::group_by(variable, value) %>% summarise(n = n()) ggplot( d_result, aes(variable, y = n, fill = value)) + geom_bar(stat = "identity") HTH Ulrik On Tue, 28 Mar 2017 at

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Paul Bernal
Dear Bo Lin, I tried doing Containerdata$TransitDate<-as.Date(Containerdata$TransitDate, "%e-%B-%y") but I keep getting NAs. I also tried a solution that I saw in stackoverflow doing: > lct<-Sys.getlocale("LC_TIME"); Sys.setlocale("LC_TIME", "C") [1] "C" > > Sys.setlocale("LC_TIME", lct) [1]

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Paul Bernal
Dear friends Ng Bo Lin, Mark and Ulrik, thank you all for your kind and valuable replies, I am trying to reformat a date as follows: Data<-read.csv("Container.csv") DataFrame<-data.frame(Data) DataFrame$TransitDate<-as.Date(DataFrame$TransitDate, "%Y-%m-%d") #trying to put it in -MM-DD

[R] How to apply calculations in "formula" to "data frame"

2017-03-28 Thread Sören Vogel
Hello Ho can I apply a formula to a data frame? library("formula.tools") Data <- data.frame("v1" = rnorm(31), "v2" = runif(31), "v3" = sample(1:7, 31, repl=T), "v4" = rlnorm(31)) For1 <- as.formula(v1 ~ .^3) Lhs <- Data[, formula.tools::lhs.vars(formula)] Rhs <-

Re: [R] How to load fonts in text3d?

2017-03-28 Thread olsen
Following these pointers given by Duncan Murdoch is the key to success, at least on my system. Many thanks! olsen On 28/03/17 13:49, Duncan Murdoch wrote: > On 28/03/2017 6:39 AM, olsen wrote: >> I think I found the fly in the ointment, running the same text3d() lines >> with

Re: [R] finding out if a method exists

2017-03-28 Thread Duncan Murdoch
On 28/03/2017 8:53 AM, Therneau, Terry M., Ph.D. wrote: I'm thinking of adding a new "cmatrix" function/method to the survival package but before I do I'd like to find out if any other packages already use this function name. The obvious method is to look at the NAMESPACE file for each

[R] Way to Plot Multiple Variables and Change Color

2017-03-28 Thread G . Maubach
Hi All, in my current project I have to plot a whole bunch of related variables (item batteries, e.g. How do you rate ... a) Accelaration, b) Horse Power, c) Color Palette, etc.) which are all rated on a scale from 1 .. 4. I need to present the results as stacked bar charts where the variables

[R] finding out if a method exists

2017-03-28 Thread Therneau, Terry M., Ph.D.
I'm thinking of adding a new "cmatrix" function/method to the survival package but before I do I'd like to find out if any other packages already use this function name. The obvious method is to look at the NAMESPACE file for each package in CRAN and read the export list. This is the kind

Re: [R] How to load fonts in text3d?

2017-03-28 Thread Duncan Murdoch
On 28/03/2017 6:39 AM, olsen wrote: I think I found the fly in the ointment, running the same text3d() lines with 'useFreeType=TRUE' returns: "FreeType not supported in this build" You need to install FreeType and FTGL. I think this is how to do it on Trusty. Don't know if it will work on

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Ulrik Stervbo
Hi Paul, does this do what you want? exdf1 <- data.frame(Date = c("1985-10-01", "1985-11-01", "1985-12-01", "1986-01-01"), Transits = c(NA, NA, NA, NA)) exdf2 <- data.frame(Date = c("1985-10-01", "1986-01-01"), Transits = c(15, 20)) tmpdf <- subset(exdf1, !Date %in% exdf2$Date) rbind(exdf2,

Re: [R] How to load fonts in text3d?

2017-03-28 Thread olsen
I think I found the fly in the ointment, running the same text3d() lines with 'useFreeType=TRUE' returns: "FreeType not supported in this build" On 28/03/17 11:05, olsen wrote: > thanks, the fonts seem to be on: >> rglFonts() > $serif > [1] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf" > [2]

Re: [R] How to load fonts in text3d?

2017-03-28 Thread olsen
thanks, the fonts seem to be on: > rglFonts() $serif [1] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf" [2] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf" [3] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf" [4] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf" $sans [1]

Re: [R] My installed R cannot run the X11 server

2017-03-28 Thread peter dalgaard
Did you follow XQuartz's advice of logging out and back in after the install? -pd > On 27 Mar 2017, at 22:44 , WILLIAM J HAYNES wrote: > > HI, > > I installed R on a Mac Book Pro running 10.10.5 and for some reason my > X11.app is in a place that the R installation cannot

Re: [R] R glm function ignores some predictor variables

2017-03-28 Thread peter dalgaard
> On 27 Mar 2017, at 17:23 , Gabrielle Perron > wrote: > > Hi, > > > This is my first time using this mailing list. I have looked at the posting > guide, but please do let me know if I should be doing something differently. Avoid sending in HTML. It's not

Re: [R] R glm function ignores some predictor variables

2017-03-28 Thread Jim Lemon
Hi Gabrielle, With that number of binary predictors it would be no surprise if some were linear combinations of others. Jim On Tue, Mar 28, 2017 at 2:23 AM, Gabrielle Perron wrote: > Hi, > > > This is my first time using this mailing list. I have looked at the

Re: [R] plot empty when drawing from custom function

2017-03-28 Thread Bert Gunter
FAQ 7.16 Bert On Mar 28, 2017 1:20 AM, "Luigi Marongiu" wrote: Dear all, I have set a function to draw some data using lattice; the drawing works when I use lattice on its own, but if I put it into my custom function, the final plot is empty, yet the terminal

Re: [R] plot empty when drawing from custom function

2017-03-28 Thread Gerrit Eichner
Hi, Luigi, you are probably missing a call to print() around the call to the latticeExtra plotting function useOuterStrips() you use inside your function printer(). Hth -- Gerrit - Dr. Gerrit Eichner

Re: [R] Arguments imply differing number of rows: 1, 0

2017-03-28 Thread Gerrit Eichner
Hi, John, see inline. Am 27.03.2017 um 20:47 schrieb John Murtagh: Hi All, I am trying to generate a cdf plot by using ggplot and have looked at some examples online. However when I try to replicate it I get the following error: "arguments imply differing number of rows: 1, 0" I made a

Re: [R] Managing axis labels

2017-03-28 Thread Ivan Calandra
Hi Jamil, You first need to specify 'xaxt' and 'yaxt' in your plot() call, and then you can set the size of the labels with cex.axis: plot(x, y, xlab=expression(vartheta), ylab="Concentration", xaxt="n", yaxt="n")axis(1, cex.axis=3) axis(2, cex.axis=2) HTH, Ivan -- Ivan Calandra, PhD

[R] My installed R cannot run the X11 server

2017-03-28 Thread WILLIAM J HAYNES
HI, I installed R on a Mac Book Pro running 10.10.5 and for some reason my X11.app is in a place that the R installation cannot find. How can I set the environmental variables so the X11 server will run. I also have Xquartx.app but R does not seem to find that either. Best Regards, William

Re: [R] Looping Through DataFrames with Differing Lenghts

2017-03-28 Thread Paul Bernal
Dear friend Mark, Great suggestion! Thank you for replying. I have two dataframes, dataframe1 and dataframe2. dataframe1 has two columns, one with the dates in -MM-DD format and the other colum with number of transits (all of which were set to NA values). dataframe1 starts in 1985-10-01

[R] Arguments imply differing number of rows: 1, 0

2017-03-28 Thread John Murtagh
Hi All, I am trying to generate a cdf plot by using ggplot and have looked at some examples online. However when I try to replicate it I get the following error: "arguments imply differing number of rows: 1, 0" I made a search and it seems from what I gather the nrows!=ncol and that doesn't

[R] ! in expression(!abc) that produces !(abc).

2017-03-28 Thread Jinsong Zhao
Hi there, I happened to find the expression(!abc) produces !(abc) when I used plotmath in a text annotation. Here is the mini-example. > plot(1, type = "n") > text(1,1, expression(!abc)) I don't find "!" in plotmath document. By the way, how to reduce the space between two adjacent strings,

[R] R glm function ignores some predictor variables

2017-03-28 Thread Gabrielle Perron
Hi, This is my first time using this mailing list. I have looked at the posting guide, but please do let me know if I should be doing something differently. Here is my question, I apologize in advance for not being able to provide example data, I am using very large tables, and what I am

[R] Managing axis labels

2017-03-28 Thread Naser Jamil
Dear R-users, I would like to ask probably a silly thing. For some reason, I need x-axis and y-axis labels to be of different size. Here is a little example where I want "ϑ" to appear bigger than "Concentration". I have tried in the following way, but it is not working. ​ x<-seq(1,10,1)

[R] plot empty when drawing from custom function

2017-03-28 Thread Luigi Marongiu
Dear all, I have set a function to draw some data using lattice; the drawing works when I use lattice on its own, but if I put it into my custom function, the final plot is empty, yet the terminal reports RStudioGD 1 as normal. What am I missing? regards, Luigi >>> cluster <- c(rep("A",

[R] Remove dependency of Image's physical location while sending email.

2017-03-28 Thread Archit Soni
Hello All, I am using below code to send alerts from R. However, while testing the emails to other users The image which is used as inline in email configuration is not showing up as it is referencing to my temp folder. Any ideas to resolve this ? I need to have embedded image irrespective of

Re: [R] How to source a local R file to a remote session.

2017-03-28 Thread Jeff Newmiller
Use the "parallel" package? -- Sent from my phone. Please excuse my brevity. On March 27, 2017 10:28:54 PM PDT, Jeremie Juste wrote: > >Hello, > >I don't know exactly where to turn to. >I'm using Emacs speak statistics and I can execute a codes on my local >computer to