Thank you.
From: Rui Barradas
Date: Monday, September 19, 2022 at 1:28 PM
To: Parkhurst, David , R-help@r-project.org
Subject: Re: [R] Converting time format
Hello,
I will run the examples below with the following data:
x <- c("12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30",
Thank you. I�ll see what I can do with that.
From: Rui Barradas
Date: Monday, September 19, 2022 at 1:28 PM
To: Parkhurst, David , r-help@r-project.org
Subject: Re: [R] Converting time format
Hello,
I will run the examples below with the following data:
x <- c("12:00", "12:15", "12:30", "12
Thank you.
DFP (iPad)
> On Sep 19, 2022, at 8:15 AM, Ebert,Timothy Aaron wrote:
>
> My version of this email has a bunch of ? that I do not know how to
> interpret. Emails to this group need to be in plain text. HTML content is
> deleted or converted and impossible or at least difficult to i
Hi David,
All I got was the rather cryptic "DFP (iPad)" below your message.
Whatever format you used for the data was blocked by the R-help mail
server. Try this command in your R session:
dput(test)
and cut and paste the output into your email. That should do it.
Jim
On Tue, Sep 20, 2022 at 7:
Hi David,
Since you used read.csv to get the data frame, the file must be i text
format. If you can include a few lines of the input (with made up NO2
values if necessary), it would be easy to respond with the required
commands and a plot.
Jim
On Mon, Sep 19, 2022 at 9:12 PM Parkhurst, David wro
Hello,
Can you post the output of
dput(head(total_name))
?
Rui Barradas
Às 18:35 de 19/09/2022, Kai Yang escreveu:
Hi Rui,I put original file names and target file names into data frame:
total_name. I can use
file.rename("out_1.pdf", "abc_title.pdf")
to rename a single file. But I hope t
Thank you for your help. I'll check this out.Kai
On Monday, September 19, 2022 at 11:47:11 AM PDT, Bert Gunter
wrote:
I haven't tracked what went before, but your syntax here is totally messed up:
for (i in seq_len(nrow(total_name)))
{
with(
total_name[i, ],
{
file.rena
I haven't tracked what went before, but your syntax here is totally messed
up:
for (i in seq_len(nrow(total_name)))
{
with(
total_name[i, ],
{
file.rename(total_name$orig, total_name$target)
}
)
}
Also, you don't need looping because file.rename is already vectorized --
you
David,
Do these work for you? (I am resending this so others can see. The original
only went to you.)
library(lubridate)
a<-c(4, 5, 6)
b<-c("18:00", "18:01", "18:02")
c<-as.data.frame(cbind(a,b))
c$d<-hm(c$b)
c$d$minute[2]
I could do it manually like this (where FrHour is fractional hour)
a<-
Hi Rui,I put original file names and target file names into data frame:
total_name. I can use
file.rename("out_1.pdf", "abc_title.pdf")
to rename a single file. But I hope to use loop to complete the task. So I
write a code below:
for (i in seq_len(nrow(total_name)))
{
with(
total_name[i
Hello,
I will run the examples below with the following data:
x <- c("12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30",
"13:45", "14:00", "14:15", "14:30", "14:45", "15:00", "15:15",
"15:30", "15:45", "16:00", "16:15", "16:30", "16:45", "17:00",
"17:15", "17:30"
David,
As others have said, there are many possible answers for a vague enough
question.
For one-time data it is often easiest to simply change the data source as you
say you did in EXCEL.
Deleting the 18th row can easily be done in R and might make sense if you get
daily data and decided the
See ?date-time and/or ?strptime for how to convert what I presume is
character data in your datetime column to a POSIXct object. (you may first
need to convert from a factor to character with as.character() ). Then
follow Tim's prescription for ggplot or see ?axis.Date (especially the
examples) for
Sorry, My bad.
A vector must be of a single class. When you declare c("in", "V>N",
round(runif(1, 7000, 16000), 0)) R will calculate the random number, but then
convert it to a character class to conform with the other two elements in that
vector. R then binds this to your original df and find
My version of this email has a bunch of ? that I do not know how to interpret.
Emails to this group need to be in plain text. HTML content is deleted or
converted and impossible or at least difficult to interpret.
Do not share confidential data. Please change some numbers or variable names
and
In your example code, the variable remains a class factor, and all entries are
valid. The variables will behave as expected given the factor levels in the
original dataframe.
(At least on my system R 4.2, in RStudio, in Windows) R returns a couple of
error messages warning me that I was bad.
Wh
You are misinterpreting what is going on.
The rbind command includes c(char, char, int) which produces a
character vector of length 3.
This is what you are rbind-ing which changes the type of the RT column.
If you do rbind(df, data.frame(P="in", ANSWER="V>N",
RT=round(runif(1,7000,16000),0)))
you
What is the output of
> class(b$time)
?
Also, start sending your emails in plaint text format, if possible.
On Mon, Sep 19, 2022 at 2:12 PM Parkhurst, David wrote:
>
> I have a dataframe obtained using read.csv from an excel file. Its first
> column is times, running from 18:00 to 19:30. If
Dear List members,
I have tried now for several times to find out about a side effect of treating
invalid factor levels, but did not find an answer. Various answers on
stackexchange etc. produce the stuff that irritates me without even mentioning
it.
So I am asking the list (apologies if this
I have a dataframe obtained using read.csv from an excel file. Its first
column is times, running from 18:00 to 19:30. If I want to plot other columns
against time, do I need to convert those somehow, and how would I do that?
If I run plot(b$time,b$myvar) I get a decent plot, but a friend sugg
I�ve been retired since �06 and have forgotten most of R. Now I have a use for
it, with some data from Bloomington�s Environmental Commission.
I have a dataframe (obtained from read.csv) that contains numerous columns,
including time (in Excel�s 18:00 format), and DNO2, and MNO2 from two air
q
Hi Nick,
Here's one way to do it. It is based on the heuristic that you keep
each line with the correct number of fields. The correct number of
fields is automatically determined by the number of fields in the last
line of the file.
Here's the contents of a sample csv file - "tmp3.csv" where the
Thank you for your reply. I meant from the dataframe, but that�s one of the
terms I had forgotten. I created that from read.csv, the csv file coming from
Excel. Last night I went ahead and made the change(s) using Excel.
For future reference, when I look at your solutions below, what do you m
23 matches
Mail list logo