Re: [R] Need help plotting

2022-09-19 Thread Jim Lemon
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

Re: [R] Need help plotting

2022-09-19 Thread Jim Lemon
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

Re: [R] rename files in R

2022-09-19 Thread Rui Barradas
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

Re: [R] rename files in R

2022-09-19 Thread Kai Yang via R-help
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, ],      {      

Re: [R] rename files in R

2022-09-19 Thread Bert Gunter
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

Re: [R] Need help plotting

2022-09-19 Thread Ebert,Timothy Aaron
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)

Re: [R] rename files in R

2022-09-19 Thread Kai Yang via R-help
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(    

Re: [R] Converting time format

2022-09-19 Thread Rui Barradas
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",

Re: [R] Remove line from data file

2022-09-19 Thread avi.e.gross
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

Re: [R] Need help plotting

2022-09-19 Thread Bert Gunter
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)

Re: [R] Question concerning side effects of treating invalid factor levels

2022-09-19 Thread Ebert,Timothy Aaron
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

Re: [R] Need help plotting

2022-09-19 Thread Ebert,Timothy Aaron
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

Re: [R] Question concerning side effects of treating invalid factor levels

2022-09-19 Thread Ebert,Timothy Aaron
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.

Re: [R] Question concerning side effects of treating invalid factor levels

2022-09-19 Thread Eric Berger
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

Re: [R] Converting time format

2022-09-19 Thread Eric Berger
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.

[R] Question concerning side effects of treating invalid factor levels

2022-09-19 Thread Tibor Kiss via R-help
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

[R] Converting time format

2022-09-19 Thread Parkhurst, David
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

[R] Need help plotting

2022-09-19 Thread Parkhurst, David
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

Re: [ESS] Can't find documentation for function

2022-09-19 Thread Lionel Henry via ESS-help
Hi Haris, That is because ESS intercepts `?` calls instead of evaluating them. As a workaround you can call the devtools implementation of `?` manually: ``` pkgload:::shim_help(foo) ``` I'd like to do better as it would improve my day-to-day but this hasn't been a priority. Best, Lionel On

Re: [ESS] Can't find documentation for function

2022-09-19 Thread Haris Fawad via ESS-help
Hi Marc, Yes, I load the package via devtools::load_all() before typing ?foo. When I do the same in the R GUI-app I get the expected behaviour: the documentation gets rendered and shown as an html file in the browser. Best, Haris On Sun, Sep 18, 2022 at 7:29 PM Marc Schwartz wrote: > Hi, > >

Re: [R] removing non-table lines

2022-09-19 Thread Eric Berger
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

Re: [R] Remove line from data file

2022-09-19 Thread Parkhurst, David
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

Re: [R] Issues when trying to fit a curve when generating random deviates

2022-09-19 Thread Daniel Nordlund
On 9/18/2022 9:44 PM, Rui Barradas wrote: Hello, I cannot reproduce the error. Anyway, if the data is discrete a bar plot might be more appropriate. barplot(table(x),     col = "green",     main = "Bar plot of Binomial Distribution B(20,0.4)") Or, to have proportions,