I did a quick clean-up and deleted a couple of , I hope, library calls and
I think the OP's code should look like this
=========================================
# Load packages & set ggplot theme ----------------------------------------
library(tidyverse)
theme_set(theme_bw())
# Select dataset and assign name to "All" ???
-----------------------------------
fname <- "Buzz.txt"
All<- fname
# Function for time labels: This uses Night and Time for X-Y labels
------------------------------------------------
evening <- function(datetime) {
update(datetime
, yday = yday(datetime) - if_else(am(datetime), 1, 0)
, hour = 17
, minute = 0
, second = 0
) }
# Create labels and corresponding breaks for the time in seconds f --------
label_hours = c("17:00", "18:00", "19:00",
"20:00", "21:00", "22:00",
"23:00", "00:00", "01:00",
"02:00", "03:00", "04:00",
"05:00", "06:00")
break_hours = c(0, 1:13*3600)
# Fix data column, combine date hour/min ---------------------------------
# Calculate elapsed time from 17:00 in seconds
polished <- All %>%
mutate( Date = as.Date(Date, "%m/%d/%Y")
, datetime = as.POSIXct(paste(Date, Time, sep = "
","%Y-%m-%d
%H:%M"),
tz = "UTC")
, evening = evening(datetime)
, Night = format(as.Date(evening), "%b %d, %Y")
, Time = as.double(datetime - evening, "secs")
)*
ggplot(polished, aes(x = Night, y = Time, colour = Species)) +
geom_point() + scale_colour_hue(l=40) +
ggtitle(label = 'Feeding buzz temporal activity')+
facet_grid(. ~ Night) + facet_wrap(facets = ~Species)+
scale_y_continuous(labels = label_hours, breaks = break_hours) +
theme(axis.text.x = element_text(angle = 270))
========================================================
On Tue, 17 Dec 2024 at 11:51, Jeff Newmiller via R-help <
r-help at r-project.org> wrote:
> Posting Error. OP sent HTML email which by default includes a backup text
> version with "helpful" marks where formatting was in the
original, and the
> mailing list deleted the HTML (per policy stated in the posting guide
> linked at the bottom of every email) which effectively leaves the mailing
> list recipients guessing as to what was originally sent.
>
> Correct configuration of OPs email client (sometimes required for each and
> every email) will send plain text which doesn't support formatting but
at
> least the recipient and sender would be looking at the same text. We
don't
> know what email client they are using and it is off-topic to discuss
> specific details of email client software on this mailing list.
>
> On December 17, 2024 8:31:28 AM PST, CALUM POLWART <polc1410 at
gmail.com>
> wrote:
> >Am I being "thick" here
> >..
> >
> >mutate(data, *# text
> >
> >Is interpretated as mutate (data, *
> >
> >The star is the character...
> >
> >(Data is the line above being piped)
> >
> >Why have the comments been *'d?. Is that the source error or a
posting
> >error here?
> >
> >On Tue, 17 Dec 2024, 14:57 Ivan Krylov via R-help, <r-help at
r-project.org>
> >wrote:
> >
> >> ? Tue, 17 Dec 2024 06:44:50 -0700
> >> Neotropical bat risk assessments <neotropical.bats at
gmail.com> ?????:
> >>
> >> > fname <- "Buzz.txt"
> >>
> >> > All<- fname
> >>
> >> I think the code needs a call to read.table() or another function
to
> >> read your data here. 'All' is still a string containing
the name of the
> >> file, not its contents.
> >>
> >> > All %>%
> >> > mutate(*#convert Date from chr to Date*
> >>
> >> This call expects 'All' to contain a data.frame-like
object, not a file
> >> name.
> >>
> >> HTML-based bold text doesn't work on this mailing list, so to
make it
> >> easier for other people to copy & paste executable code from
your
> >> messages, I would recommend composing in plain text:
> >> https://stat.ethz.ch/pipermail/r-help/2024-December/480371.html
> >>
> >> --
> >> Best regards,
> >> Ivan
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more,
see
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> https://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> > [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
John Kane
Kingston ON Canada
[[alternative HTML version deleted]]