Re: [R] unanticipated axis labels

2021-03-16 Thread Deepayan Sarkar
On Tue, Mar 16, 2021 at 11:35 PM Richard M. Heiberger wrote: > > library(lattice) > library(latticeExtra) > > barchart(matrix(c(1:6, 5:6)), main="unanticipated left axis labels", > ylab="unanticipated inside labels") + > latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8)) S

Re: [R] Problem with the str_replace function

2021-03-16 Thread Hervé Pagès
Hi, stringr::str_replace() treats the 2nd argument ('pattern') as a regular expression and some characters have a special meaning when they are used in a regular expression. For example the dot plays the role of a wildcard (i.e. it means "any character"): > str_replace("aaXcc", "a.c", "ZZ"

Re: [R] Problem with the str_replace function

2021-03-16 Thread Bert Gunter
I prefer using regular expressions directly, so this may not satisfy you: > a <-"Women's footwear (excluding athletic)" > b <- gsub("(.*) \\(.*$","\\1",a) > b [1] "Women's footwear" There are, of course other ways to do this with regex's or even substring() Bert Gunter "The trouble with having

Re: [R] How to plot dates

2021-03-16 Thread Avi Gross via R-help
Not sure what you mean by a horizontal line, Greg. I change one of my plots to add a path between corresponding values of the sequence variable but obviously those lines are mostly not horizontal. Look at geom_path and similar geoms like geom_line to connect endpoints grouped whatever way you spec

[R] Problem with the str_replace function

2021-03-16 Thread phil
I have a problem with the str_replace() function in the stringr package. Please refer to my reprex below. I start with a vector of strings, called x. Some of the strings contain apostrophes and brackets. I make a simple replacement as with x1, and there is no problem. I make another simple rep

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Thank you very much. In addition to what your did, for event 1, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Then, for event 2, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Similarly for events 3, and 4. Is th

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Dan, Thank you for this guidance. Unfortunately, I do not have the library lubridate, and I do not at this moment know where to go to get this library for an Apple MacBook. > library(lubridate) Error in library(lubridate) : there is no package called ‘lubridate’ Greg Coats Reston, Virginia USA

Re: [R] How to plot dates

2021-03-16 Thread Avi Gross via R-help
It sounds to me like you want to take your data and extract one column for JUST the date and another column for just some measure of the time, such as the number of seconds since midnight or hours in a decimal format where 12:45 PM might be 12.75. You now can graph date along the X axis and time a

Re: [R] How to plot dates

2021-03-16 Thread Daniel Nordlund
On 3/16/2021 3:32 PM, Gregory Coats via R-help wrote: Thank you. Let me redefine the situation. Each time an event starts, I record the date and time. Each day there are 4 new events. Time is the only variable. I would like to graphically show how the time for events 1, 2, 3, and 4 for the curre

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Thank you. Let me redefine the situation. Each time an event starts, I record the date and time. Each day there are 4 new events. Time is the only variable. I would like to graphically show how the time for events 1, 2, 3, and 4 for the current day compare to the times for events 1, 2, 3, and 4 fo

Re: [R] How to plot dates

2021-03-16 Thread Jim Lemon
Hi Greg, This example may give you a start: myDat<-read.table(text= "2021-03-11 10:00:00 2021-03-11 14:17:00 2021-03-12 05:16:46 2021-03-12 09:17:02 2021-03-12 13:31:43 2021-03-12 22:00:32 2021-03-13 09:21:43", sep=",", stringsAsFactors=FALSE) myDat$datetime<-strptime(myDat$X,for

Re: [R] R

2021-03-16 Thread Rui Barradas
Hello, Yes, you can ask R-Help questions on R code, that's what it is intended for. But please read the posting guide, it's link is at the bottom of this and of any R-Help mail. Good luck, enjoy R! Rui Barradas Às 18:19 de 16/03/21, Jonathan Lim escreveu: Hi I found your email on a websit

Re: [R] R

2021-03-16 Thread Bert Gunter
https://www.r-project.org/mail.html 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, Mar 16, 2021 at 12:51 PM Jonathan Lim wrote: > Hi > > I found your em

Re: [R] How to plot dates

2021-03-16 Thread Rui Barradas
Hello, I don't really understand what is to be plotted, just the time of the event? But what event? Anyway, with the data read with Sarah's code, maybe library(ggplot2) ggplot(myDat, aes(x = datetime, y = 1)) + geom_linerange(aes(ymin = 0, ymax = 1), linetype = "dotted") + geom_point()

[R] R

2021-03-16 Thread Jonathan Lim
Hi I found your email on a website Can I ask some questions about R please Many thanks Jonathan [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r

Re: [R] How to plot dates

2021-03-16 Thread John Fox
Dear Greg, Coordinate plots typically have a horizontal (x) and vertical (y) axis. The command ggplot(myDat, aes(x=datetime, y = datetime)) + geom_point() works, but I doubt that it produces what you want. You have only one variable in your data set -- datetime -- so it's not obviou

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
I need a plot that shows the date and time that each event started. This ggplot command was publicly given to me via this R Help Mailing LIst. But the result of issuing the ggplot command is an Error in FUN message. ggplot(myDat, aes(x=datetime, y = Y_Var)) + geom_point() Error in FUN(X[[i]], ...)

Re: [R] How to plot dates

2021-03-16 Thread Jeff Newmiller
So what do you want quantity on the y-axis to be? On March 16, 2021 11:45:32 AM PDT, Gregory Coats wrote: >I want to plot the date and time of the event, as reflected in data. >2021-03-11 10:00:00 >Greg Coats > >> On Mar 16, 2021, at 2:23 PM, Jeff Newmiller > wrote: >> >> You don't seem to have

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
I want to plot the date and time of the event, as reflected in data. 2021-03-11 10:00:00 Greg Coats > On Mar 16, 2021, at 2:23 PM, Jeff Newmiller wrote: > > You don't seem to have a Y_Var in your data. What is it that you want to plot? > > On March 16, 2021 9:21:05 AM PDT, Gregory Coats via R-h

Re: [R] How to plot dates

2021-03-16 Thread Jeff Newmiller
You don't seem to have a Y_Var in your data. What is it that you want to plot? On March 16, 2021 9:21:05 AM PDT, Gregory Coats via R-help wrote: >Sarah, Thank you. Yes, now as.POSIXct works. >But the ggplot command I was told to use yields an Error message, and >there is no output plot. >Please

Re: [R] How to plot dates

2021-03-16 Thread John Fox
Dear Greg, There is no variable named Y_Var in your data set. I suspect that it's intended to be a generic specification in the recipe you were apparently given. In fact, there appears to be only one variable in myDat and that's datetime. What is it that you're trying to do? A more general c

Re: [R] help

2021-03-16 Thread Bill Dunlap
The length of the mean vector must match the number of rows and columns of the sigma matrix. Once you give 3 entries in the mean vector you will run into the problem that the sigma you are using is not positive (semi-)definite - a variance must be the product of a matrix and its transpose. -Bill

Re: [R] help

2021-03-16 Thread Bert Gunter
A 2 dim distribution must have a 2 x 2 covariance matrix. Your mean in b) specifies 2 dim, but your covariance matrix is 3x3. If you haven't just made a typo and you don't know what this means, then either consult statistics references or find someone to help you. Cheers, Bert Gunter "The troub

[R] unanticipated axis labels

2021-03-16 Thread Richard M. Heiberger
library(lattice) library(latticeExtra) barchart(matrix(c(1:6, 5:6)), main="unanticipated left axis labels", ylab="unanticipated inside labels") + latticeExtra::layer(panel.axis("left", half=FALSE, labels=1:8)) barchart(matrix(c(1:6, 5:6)), main="ok 1", ylab="anticipated") + latticeEx

[R] help

2021-03-16 Thread hatice gürdil
Code a is working. But code b is given error like given below. How can I write code b? > a<-rmvnorm(750, mean=c(0, 0), +sigma=matrix(c(1, .3, .3, 1), ncol=2)) > head(a) [,1][,2] [1,] -0.97622921 -0.87129405 [2,] 0.54763494 0.16080131 [3,] -1.16627647

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
Sarah, Thank you. Yes, now as.POSIXct works. But the ggplot command I was told to use yields an Error message, and there is no output plot. Please help me. Greg > library(ggplot2) > myDat <- read.table(text = + "datetime + 2021-03-11 10:00:00 + 2021-03-11 14:17:00 + 2021-03-12 05:16:46 + 2021-03-1

Re: [R] Error: ignoring SIGPIPE signal

2021-03-16 Thread Rasmus Liland
Hello there, This error happens if you did not finish reading from the pipe. E.g. I have this function in my local zshrc, to read tsv files with less in terminal width ... readdelim() { Rscript -e "options(width=$COLUMNS); read.delim('$1', check.names=FALSE, na='N/A')" | less } ..

[R] Error: ignoring SIGPIPE signal

2021-03-16 Thread Farid Cheraghi
Hi, ```R > sessionInfo() R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Debian GNU/Linux bullseye/sid Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.1

Re: [R] How to plot dates

2021-03-16 Thread Sarah Goslee
Hi, It doesn't have anything to do with having a Mac - you have POSIX. It's because something is wrong with your data import. Looking at the head() output you provided, it looks like your data file does NOT have a header, because there's no datetime column, and the column name is actually X2021.0

Re: [R] How to plot dates

2021-03-16 Thread Gregory Coats via R-help
My computer is an Apple MacBook. I do not have POSIX. The command myDat$datetime <- as.POSIXct(myDat$datetime, tz = "", format = "%Y-%M-%d %H:%M:%OS") yields the error Error in `$<-.data.frame`(`*tmp*`, datetime, value = numeric(0)) : replacement has 0 rows, data has 13 Please advise, How to p

Re: [R] Failure in predicting parameters

2021-03-16 Thread Luigi Marongiu
Just an update: I tried with desmos and the fitting looks good. Desmos calculated the parameters as: Fmax = 11839.8 Chalf = 27.1102 (with matches with my estimate of 27 cycles) k = 2.76798 Fb = -138.864 I forced R to accept the right parameters using a single named list and re-written the formula (