Thanks for providing direction. By redefining time using as.yearmon(), I got
acf() working.
Sent from my iPhone
On Jan 14, 2025, at 6:51 PM, CALUM POLWART wrote:
acf wants a time series, so tries to make one:
as.ts(myts)
Time Series:
Start = 19357
End = 20027
Frequency = 1
[1] 24957
acf wants a time series, so tries to make one:
as.ts(myts)
Time Series:
Start = 19357
End = 20027
Frequency = 1
[1] 24957 NA NA NA NA NA NA NA NA NA
[11] NA NA NA NA NA NA NA NA NA NA
[21] NA NA NA NA
HI Rui:
First and foremost thanks for taking the time to do this. That was a typo,
it was httr and is not needed, I was careless. That request works fine on a
Mac and a Linux box. We needed to check if there was something about iour
internal network settings, our Windows setup or somethi
Às 23:47 de 31/01/2024, Roy Mendelssohn - NOAA Federal via R-help escreveu:
HI All:
We are trying to figure out a problem that is occurring with a package, and we
need a non-NOAA person with a Windows computer with the latest R to test for us
what is failing (but works on Macs and Linux from
Hmm, I can't replicate (i.e., it works fine for me). What are the
results of your sessionInfo() (from a *clean* R session)?
==
R Under development (unstable) (2023-10-25 r85410)
Platform: x86_64-pc-linux-gnu
Running under: Pop!_OS 22.04 LTS
Matrix products: default
BLAS: /usr/local/lib/R/l
On Wed, 7 Jun 2023 19:14:58 -0700
Dennis Fisher wrote:
> UNICODE: If I can generate "≥" via unicode, the problem is solved:
> mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY))
It should be possible to just copy & paste "≥" in the R source code
nowadays. If for some reason the script
Hi David,
No, read.table converts a text representation of data into a data frame object.
Jim
On Sat, Sep 24, 2022 at 2:29 AM DFP wrote:
>
> Do I need that read.table if the tst dataframe already exists in my
> system? If so, why?
>
> --
>
> Hello
Do I need that read.table if the tst dataframe already exists in my
system? If so, why?
--
Hello,
You have to load the packages involved:
library(dplyr)
library(tidyr)
library(ggplot2)
then run the full sequence. Though this is not important,
That worked, and helped my understanding. Thank you.
Hello,
You have to load the packages involved:
library(dplyr)
library(tidyr)
library(ggplot2)
then run the full sequence. Though this is not important, if you are
pivotting columnns named y1 and y2
No you don't! I do!
I don't have tst on my system.
Rui Barradas
Às 22:11 de 22/09/2022, DFP escreveu:
Do I need that read.table if the tst dataframe already exists in my
system? If so, why?
--
Hello,
You have to load the packages involved:
Hello,
You have to load the packages involved:
library(dplyr)
library(tidyr)
library(ggplot2)
then run the full sequence. Though this is not important, if you are
pivotting columnns named y1 and y2, why not name the result just y?
pivot_longer(-time, names_to = "y")
And here is complete
I'm trying to do as you suggest, but I'm not understanding what I need
to do. I asked what the line pivot_longer(-time, names_to = "y1") would
do if applied to this df:
> tst
time y1 y2
1 18:55 30 19
2 18:56 30 19
3 18:57 29 19
4 18:58 31 19
5 18:59 28 19
6 19:00 28 19
7 19:01 28 19
Hello,
This type of problems generally has to do with reshaping the data. The
format should be the long format and the data is in wide format.
Inline.
Às 23:35 de 21/09/2022, DFP escreveu:
As I said, the lines below that you provided worked well for me. Can you
explain what this line does?:
p On Behalf Of DFP
Sent: Wednesday, September 21, 2022 6:35 PM
To: Rui Barradas ; r-help@r-project.org
Subject: Re: [R] Need help plotting
[External Email]
As I said, the lines below that you provided worked well for me. Can you
explain what this line does?:
# reshape to long format
pivot_l
As I said, the lines below that you provided worked well for me. Can you
explain what this line does?:
# reshape to long format
pivot_longer(-Dtime, names_to = "NO2") %>%
-
library(ggplot2)
library(dplyr)
library(tidyr)
b %>%
mutate(Dtime
rg
Subject: Re: [R] Need help plotting
[External Email]
"Also, IU's tech support told me yesterday that if I responded to a message
that came as plain text, my response would go out as plain text. Is that true
for this response, or is it in HTML?"
Nope, HTML. You need to set you
esterday that if I responded to a message
> that came as plain text, my response would go out as plain text. Is that
> true for this response, or is it in HTML?
>
> From: Rui Barradas
> Date: Tuesday, September 20, 2022 at 4:52 AM
> To: Jim Lemon , Parkhurst, David <
> parkh...
go out as plain text. Is that true for
this response, or is it in HTML?
From: Rui Barradas
Date: Tuesday, September 20, 2022 at 4:52 AM
To: Jim Lemon , Parkhurst, David ,
r-help mailing list
Subject: Re: [R] Need help plotting
Hello,
Now with data, here are base R and ggplot2 plots.
Hello,
Now with data, here are base R and ggplot2 plots.
b <- read.table(text=
"Dtime DNO2 DVOC Dpm10Dpm2.5 Dpm1 Mtime MNO2
MVOCMpm10 Mpm2.5 Mpm1
18:00 28 164 81.34773 24.695435 14 18:00 19 151 3.00
21
18:01 27 163 74.44034 23.751198 14 18
Hi David,
I'm back home again. Try this:
b<-read.table(text=
"Dtime DNO2 DVOC Dpm10Dpm2.5 Dpm1 Mtime MNO2 MVOCMpm10 Mpm2.5 Mpm1
18:00 28 164 81.34773 24.695435 14 18:00 19 151 3.00 21
18:01 27 163 74.44034 23.751198 14 18:01 20 148 3.00 21
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
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<-
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
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
Dear All,
Thank you very much for all of your help. If anyone feels unhappy with my
words then I apologize.
Actually, I am not an expert user as a result my coding seems to be wrong
on some points. Now, it is working.
I am thankful to all of you for your kind support. Take care.
Hossain
On F
Another exceedingly polite questioner. Cultural differences!
I think we can skip discussing if we are doing well, and get to the point.
To start with, I got thrown by these two lines:
a=rnorm(1000, 110, 5)
s = length(a)
This does not relate to the difficulty, but is a sort of sloppy use as a
I get 111.5303 which is much closer to the right answer.
Entering values for ff, I can work out the answer to slightly more
than 111.53030196.
Regards,
Tim
-Original Message-
From: Ebert,Timothy Aaron
Sent: Thursday, August 4, 2022 10:28 AM
To: Ebert,Timothy Aaron ; Md. Moyazzem Hossa
Dear Rui Barradas
Thank you very much for your prompt reply.
It works. I am grateful for your help.
Take care and best wishes.
Hossain
On Tue, Jun 28, 2022 at 5:45 PM Rui Barradas wrote:
> Hello,
>
> scale_*_manual expects a discrete vector as values, you are passing it a
> continuous one.
Hello,
scale_*_manual expects a discrete vector as values, you are passing it a
continuous one. The natural way of having a continuous variable set the
color and fill values is with a gradient scale.
I have changed geom_bar to geom_col.
Map prob to the fill aesthetic. Then, in scale_fill_cont
Hi David,
As suggested earlier, providing the link of a folder contains all files.
https://drive.google.com/drive/folders/1dNmGTI8_c9PK1QqmfIjnpbyzuiCXgxFC?msclkid=4816425dd04111ec912cf8b4175aa93c
Thanks,
Ranjeet
On Wed, May 11, 2022 at 9:35 PM David Winsemius
wrote:
>
> On 5/9/22 10:01, Ranj
Dear Bert,
Thank you. Will do the same
Regards, Roopa
On Sat 16 Apr, 2022, 2:22 AM Bert Gunter While you *may* get a useful reply here, there is an
> r-sig-meta-analysis list to which this would be better posted:
> https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
>
>
> Bert Gunter
>
>
While you *may* get a useful reply here, there is an
r-sig-meta-analysis list to which this would be better posted:
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (
Hello,
With no loops:
cbind(
row = c(t(row(mat_1))),
col = c(t(col(mat_1))),
mat_1 = as.numeric(t(mat_1))
)
If the matrix entries are not numeric, use cbind.data.frame. This will
keep the row and column numbers as numbers, the default cbind method
would coerce them to the class of mat
mat_1= matrix( c('1','2','3','4','5','6','7','8','9'), nrow = 3, ncol =
3,byrow = TRUE)
mat_1
# Loop over my_matrix
for(row in 1:nrow(mat_1)) {
for(col in 1:ncol(mat_1)) {
cat(row,col,mat_1[row,col],"\n")
}
}
On Thu, Oct 28, 2021 at 8:01 PM Anas Jamshed wrote:
>
> where should I p
where should I place cat(row,col,mat_1[row,col],"\n")?
On Thu, Oct 28, 2021 at 1:58 PM Jim Lemon wrote:
> Hi Anas,
> How about:
>
> cat(row,col,mat_1[row,col],"\n")
>
> Jim
>
> On Thu, Oct 28, 2021 at 7:19 PM Anas Jamshed
> wrote:
> >
> > I create a matrix of size 3x3 called mat_1 and then I w
Hi Anas,
How about:
cat(row,col,mat_1[row,col],"\n")
Jim
On Thu, Oct 28, 2021 at 7:19 PM Anas Jamshed wrote:
>
> I create a matrix of size 3x3 called mat_1 and then I want to iterate over
> all the values one by one and print the element as well as the position in
> the matrix:
>
> My code is :
Bert,
> findprm <- function(n){
>nn <- seq.int(2, n)
>i <- 2
>while(i <= floor(sqrt( n))){
> nn <- nn[(nn <= i) | (nn %% i > 0)]
> i <- nn[nn > i][1]
>}
>nn
> }
+1 -- thanks!
__
R-help@r-project.org mailing list -- To UN
try to guess and certainly won't supply a valid solution here!
-Original Message-
From: R-help On Behalf Of Anas Jamshed
Sent: Tuesday, October 26, 2021 4:39 PM
To: Rolf Turner
Cc: R-help Mailing List
Subject: Re: [R] Need help in R
Its not homework . Basically i want to get easy so
Well, OK. I'll provide you an alternative and explanation.
The way you are going about it would work, but it is usually not the best
approach in R. Typically, the key in R is to whenever possible use whole
object manipulation rather than iteration. This hides the iteration details
and often pushes
Its not homework . Basically i want to get easy solution:
I am trying this for ist problem:
n= seq(1,100)
for (j in n:100) {
f = 1
i = 2
n = j
while (i <= n / 2) {
if (n %% i == 0) {
f = 0
break
}
i = i + 1
}
if (f ==
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
One of the items mentioned in the Posting Guide is that homework questions are
not okay... we don't know what your instructor is looking for, and the
On Wed, 27 Oct 2021 01:09:50 +0500
Anas Jamshed wrote:
> I need help to these questions
>
> ### Question 1
> Create a variable containing a sequence of numbers from 1 to 100:
>
> Iterate over the variables and print those numbers which are prime.
>
>
> ### Question 2
> Create a matrix of si
This looks suspiciously like homework and this list does have a no homework
policy. If it is not homework, please forgive the assumption.
> On Oct 26, 2021, at 4:09 PM, Anas Jamshed wrote:
>
> I need help to these questions
>
> ### Question 1
> Create a variable containing a sequence of numbe
Hello,
Are you looking for what follows Andrew's code below to download and
untar the files?
read_one_gz_file <- function(x, path){
fl <- file.path(path, x)
tryCatch({
read.table(zz <- gzfile(fl))
},
warning = function(w) w,
error = function(e) e
)
}
URL <-
"https://ftp.ncb
but the point is that where should I start from now
On Tue, Aug 24, 2021 at 7:43 AM Andrew Simmons wrote:
> Hello,
>
>
> I see what you're saying that the .tar archive contains many more
> compressed files, but that's not necessarily a problem. R can read directly
> from a compressed file withou
Hello,
I see what you're saying that the .tar archive contains many more
compressed files, but that's not necessarily a problem. R can read directly
from a compressed file without having to decompress it beforehand. I
modified my code to look a little more like yours:
# need to do 'path.expand'
sir after that I want to run:
#get the list of sample names
GSMnames <- t(list.files("~/Desktop/GSE162562_RAW", full.names = F))
#remove .txt from file/sample names
GSMnames <- gsub(pattern = ".txt", replacement = "", GSMnames)
#make a vector of the list of files to aggregate
files <- list.files(
There are some differences in R, between Windows and Linux.
You could try the 'shell' command instead.
#On Windows
?shell
On Tue, Aug 24, 2021 at 4:53 AM Anas Jamshed wrote:
>
> I have the file GSE162562_RAW. First I untar them
> by untar("GSE162562_RAW.tar")
> then I am running like:
> system(
Hello,
I tried downloading that file using 'utils::download.file' (which worked),
but then continued to complain about "damaged archive" when trying to use
'utils::untar'. However, it seemed to work when I downloaded the archive
manually. Finally, the solution I found is that you have to specify
I am trying this URL: "
https://ftp.ncbi.nlm.nih.gov/geo/series/GSE162nnn/GSE162562/suppl/GSE162562_RAW.tar
"
but it is not giving me any file
On Mon, Aug 23, 2021 at 11:42 PM Andrew Simmons wrote:
> Hello,
>
>
> I don't think you need to use a system command directly, I think
> 'utils::untar'
Hello,
I don't think you need to use a system command directly, I think
'utils::untar' is all you need. I tried the same thing myself, something
like:
URL <- "https://exiftool.org/Image-ExifTool-12.30.tar.gz";
FILE <- file.path(tempdir(), basename(URL))
utils::download.file(URL, FILE)
utils::
On 6/9/21 5:06 AM, Biplab Nayak wrote:
Hi Greg,
Please find the objective of the code(bold) and code mentioned below. I was
trying to do to achieve the below objective but somehow it's not working.
The phrase "somehow not working" is not a useful description of an outcome.
1.Order assess
You seem to need to educate yourself as to what "plain text" means, and to read
the Posting Guide for this mailing list. Word documents are very definitely NOT
plain text. Stop attempting to communicate via formatted text on this mailing
list.
For security reasons this mailing list removes most
Hi Greg,
Please find the objective of the code(bold) and code mentioned below. I was
trying to do to achieve the below objective but somehow it's not working.
1.Order assessment based on the latest due date so select input
automatically shows the order of assessment name.
2.Filter based on the o
Hi Greg,
Please find the objective of the code(bold) and code mentioned below. I was
trying to do to achieve the below objective but somehow it's not working.
1.Order assessment based on the latest due date so select input automatically
shows the order of assessment name.
2.Filter based on the o
Hi Greg,
Please find the R Code in the word file attached here. Its plain text format
Thanks & Regards
Biplab Nayak
On Wed, Jun 9, 2021 at 12:15 AM Greg Minshall wrote:
> Biplab,
>
> i'm not sure how to help you here, but this list pretty much runs on
> plain ASCII (or, these days, utf-8) e-ma
Biplab,
i'm not sure how to help you here, but this list pretty much runs on
plain ASCII (or, these days, utf-8) e-mail. for the most part, without
attachments. so, simply-formatted text, including code, with some
mechanism in the code to initialize any data structures (data frames,
matrices, et
Hi Bert,
I have attached the word file with the R code.
Thanks & Regards
Biplab Nayak
On Tue, Jun 8, 2021 at 1:07 PM Bert Gunter wrote:
> I do not wish to be involved in this thread other than to note that you
> were, I believe, asked not to post in HTML. And because you did, you will
> find t
I do not wish to be involved in this thread other than to note that you
were, I believe, asked not to post in HTML. And because you did, you will
find that "Bold" highlighting does not exist in your text below. I have no
idea whether that matters for your query or not, but there it is.
Bert Gunte
Hi Rui,
Please find the code(bold) below I was trying to do to achieve the
achieve:But somehow its not working.
1.Order assessment based on the latest due date so select input
automatically show the order of assessment name.
2.Filter based on the one name or multiple names in the select input
li
Hello,
Please cc the list.
R-Help is not a code writing service, it's a mailing list for doubts on
R code. I'm sorry but without answers to the below questions I am not
going to answer.
What have you tried? What went wrong?
Hope this helps,
Rui Barradas
Às 04:01 de 08/06/21, Biplab Nayak
Hi Rui,
Please find the data file attached here.
Thanks & Regards
Biplab Nayak
On Mon, Jun 7, 2021 at 4:21 PM Rui Barradas wrote:
> Hello,
>
> This is not reproducible, we don't have access to ttclasses.csv.
> Can you post sample data? Please post the output of
>
> dput(ttclasses)
>
> Or, if i
Hello,
Thanks for the data.
There were some, not many, bugs that I have corrected below.
library(tidyverse)
#library(stringr)# attached with tidyverse
#library(readr)
library(shiny)
ttclasses <- read_csv("~/tmp/ttclasses.csv")
#Filter data
ttclasses <-ttclasses %>%
filter(str_detect(as
Hello,
This is not reproducible, we don't have access to ttclasses.csv.
Can you post sample data? Please post the output of
dput(ttclasses)
Or, if it is too big, the output of
dput(head(ttclasses, 20))
Hope this helps,
Rui Barradas
Às 18:03 de 07/06/21, Biplab Nayak escreveu:
Hi All,
I N
Thanks. What editor do you use? I'm working in a Mac, if that makes a
difference.
From: Gerrit Draisma
Date: Tuesday, February 9, 2021 at 5:10 PM
To: Parkhurst, David F.
Cc: r-help@r-project.org
Subject: Re: [R] Need help using lattice
Ha David,
I do not know.
It must be that your Apr
=factor(3:12, levels=1:12,
labels=AprToDec, ordered=TRUE))
I get + signs in front of monames and labels, again as expected, but then it
gives me another + sign. And if I try to add another ), it keeps giving me +
signs. What is happening here?
From: Gerrit Draisma
Date: Tuesday, Febr
labels=AprToDec, ordered=TRUE))
I get + signs in front of monames and labels, again as expected, but then it
gives me another + sign. And if I try to add another ), it keeps giving me +
signs. What is happening here?
From: Gerrit Draisma
Date: Tuesday, February 9, 2021 at 6:14 AM
To: Park
Thank you.
From: Gerrit Draisma
Date: Tuesday, February 9, 2021 at 6:14 AM
To: Parkhurst, David F.
Cc: r-help@r-project.org
Subject: Re: [R] Need help using lattice
Ha David,
Thanks for your reply.
For your last question, you have to change month into an ordered factor
variable:
library
Ha David,
Thanks for your reply.
For your last question, you have to change month into an ordered factor
variable:
library(lattice)
df <- expand.grid(site=c("een","twee","drie","vier","vijf"),
month=factor(3:12,levels=1:12,
labels=month.abb, ordere
http://adv-r.had.co.nz/Reproducibility.html
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
On Mon, 8 Feb 2021 at 03:11, PIKAL Petr wrote:
> Hi
>
> Please do not use HTML formating.
> Please provide some toy data if you want to get reasonable help.
>
> You
Hallo again
Your attachment is discarded by listserv so we did not get it. Do not use
attachments.
Cheers
Petr
From: Ablaye Ngalaba
Sent: Monday, February 8, 2021 3:04 PM
To: PIKAL Petr
Subject: Re: [R] need help to create a 3-dimensional list
Sorry, I thought I would make
Hi
No attachments allowed (usually).
What do you mean by 3 dimensional list? List itself can contain objects
which could also be lists.
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Ablaye Ngalaba
> Sent: Monday, February 8, 2021 1:33 PM
> To: r-help@r-project.org
> Subj
Hi
Please do not use HTML formating.
Please provide some toy data if you want to get reasonable help.
You could also look at ggplot package, e.g.
https://ggplot2.tidyverse.org/reference/facet_grid.html
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of Parkhurst, David
> F.
Hello,
Please cc the list, R-Help is threaded and your doubt and answers might
be of interest to others.
With a vector Y, you want 0 in all Y != l and 1 in all Y == l?
n_l <- function(Y, l) as.integer(Y == l)
Hope this helps,
Rui Barradas
Às 11:26 de 30/01/21, Ablaye Ngalaba escreveu:
H
Hello,
Maybe this?
n_l <- function(Y, l, na.rm = FALSE) sum(Y == l, na.rm = na.rm)
set.seed(2020)
q <- 6
y <- sample(q, 10, TRUE)
l <- 4
n_l(y, l)
#[1] 3
Hope this helps,
Rui Barradas
Às 14:27 de 29/01/21, Ablaye Ngalaba escreveu:
Hello,
please, I need to calculate the indicator function
Perhaps (in R):
n_i <- cumsum( Y==l )
You should read further regarding R's logical class, and operators that
work on it, and how it is coerced.
--
David
On 1/29/21 6:27 AM, Ablaye Ngalaba wrote:
> Hello,
> please, I need to calculate the indicator function as I underlined in my
> attached
Is this a homework problem? The posting guide linked below explicitly says:
"*Basic statistics and classroom homework:* R-help is not intended for
these."
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Brea
This list has a no-homework policy. Referring to the posting guide linked
below:
"*Basic statistics and classroom homework:* R-help is not intended for
these."
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley B
You have already asked this and people gave you a variety of answers.
Just asking again without clarifying why those answers did not help you
is not going to solve your problem.
Tell us what you tried and why it failed might help.
Michael
On 29/10/2020 07:50, Ablaye Ngalaba wrote:
Hello,
I n
I do not understand your question.
Are you talking about "functional data analysis", the statistical
analysis of data where some of the covariates are (samples from)
continuous functions? There are books and tutorials about doing
that in R.
Are you talking about "functional data structures", as
Hello,
You have asked several times about functional data, I really do not
understand what you mean but if you want to learn about writing R
functions, take a look at
doc/manual/R-intro.pdf, that comes with any installation of R, chap. 10
Writing your own functions.
And at any of Hadley Wi
Hello
On 08/06/2020 19:52, Loïc Valéry wrote:
Dear all,
First of all, this is my first message on the list. Therefore, please be
indulgent if my message is not perfectly formatted as it should be.
I am currently encountering a difficulty with GRASS 7.8 within R when using the
'v.generalize'
Hi
I does not use Deducer so I do not know if it has some features for such task
In plain R instead
file.names <- dir(pattern = "*.txt")
use
file.names <- list.files(pattern = "*.txt")
for(i in 1:length(file.names)){file <-
> read.table(file.names[i],header=TRUE) #
Here you want to change zero
t; sim2"," the2"),
>
> values = c(1:4))
>
>
>
> Mayooran
>
>
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for
> Windows 10
>
>
>
> From: Richard O'Keefe<mailto:rao...@gmail.com
f Newmiller<mailto:jdnew...@dcn.davis.ca.us>
Cc: R-help mailing list<mailto:r-help@r-project.org>; peter
dalgaard<mailto:pda...@gmail.com>
Subject: Re: [R] need help in if else condition
I didn't communicate my problem to R-Sig-Debian because I had never
previously
heard
> However, having installed "Action of the Toes" (are R releases named
> by Culture AIs, by any chance?)
Peanuts cartoons.
https://twitter.com/snoopy/status/269963551135891456
Steve E
***
This email and any attachments are confid
I didn't communicate my problem to R-Sig-Debian because I had never
previously
heard of them. Thank you for the tip.
Poking through the recent archives there I see other people
have had (different) trouble with the Bionic repository.
Fortunately, the instructions at
https://linuxize.com/post/how-
Did you ask for assistance on R-Sig-Debian? you will need to be more explicit
than below about what you actually did. FWIW I was able to do it [1]... you
might have encountered a temporary network problem.
[1] https://cran.r-project.org/bin/linux/ubuntu/README.html
On July 14, 2019 4:55:25 PM C
Four-core AMD E2-7110 running Ubuntu 18.04 LTS.
The R version is the latest in the repository:
r-base/bionic,bionic,now 3.4.4-1ubuntu1 all [installed]
Why not 3.6? Because when i followed the installation instructions, adding
deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/
to /e
One common gotcha is that ifelse() has no way to reconcile attributes between
the two alternatives so it takes the attributes for the result from those of
the condition, which is almost certainly what you don't want. In particular,
this may convert factors to their underlying integer codes.
An
Er, what version is this? I have (on a late 2010 MB Air!)
> system.time(ifelse(x < y, x, y))
user system elapsed
0.072 0.012 0.085
and even
> system.time({r<-numeric(100);ix <- x < y; r[ix]<-x[ix]; r[!ix]<-y[!ix];
> r})
user system elapsed
0.082 0.053 0.135
-pd
>
"ifelse is very slow"? Benchmark time.
> x <- runif(100)
> y <- runif(100)
> system.time(ifelse(x < y, x, y))
user system elapsed
0.403 0.044 0.448
> system.time(y + (x < y)*(x - y))
user system elapsed
0.026 0.012 0.038
This appears to be a quality-of-implementation b
On 10/07/2019 11:54 a.m., Richard O'Keefe wrote:
Expectation: ifelse will use the same "repeat vectors to match the longest"
rule that other vectorised functions do. So
a <- 1:5
b <- c(2,3)
ifelse(a < 3, 1, b)
=> ifelse(T T F F F <<5>>, 1 <<1>>, 2 3 <<2>>)
=> ifelse(T T F F F <<5>>, 1 1 1 1 1 <<
On 7/10/19 5:54 PM, Richard O'Keefe wrote:
Expectation: ifelse will use the same "repeat vectors to match the longest"
rule that other vectorised functions do. So
a <- 1:5
b <- c(2,3)
ifelse(a < 3, 1, b)
=> ifelse(T T F F F <<5>>, 1 <<1>>, 2 3 <<2>>)
=> ifelse(T T F F F <<5>>, 1 1 1 1 1 <<5>>
Sigh. I don't agree with this "avoid ifelse because you might not know the
shape of the arguments" advice. All R variables have shapes and sizes, and the
better advice is to _pay attention to shapes and sizes_, especially when using
vectorized functions like ifelse. An easy way to maintain shape
Of course the behavior of ifelse is predictable.
My point was that for newb's (I was one once) you can get burned if you
don't appreciate that ifelse is vectorized.
Especially if you have some "muscle memory" from using ifelse() in Excel.
On Wed, Jul 10, 2019 at 6:55 PM Richard O'Keefe wrote:
>
Expectation: ifelse will use the same "repeat vectors to match the longest"
rule that other vectorised functions do. So
a <- 1:5
b <- c(2,3)
ifelse(a < 3, 1, b)
=> ifelse(T T F F F <<5>>, 1 <<1>>, 2 3 <<2>>)
=> ifelse(T T F F F <<5>>, 1 1 1 1 1 <<5>>, 2 3 2 3 2 <<5>>)
=> 1 1 2 3 2
and that is inde
The answer here is that in "ifelse(a < 3, ..)" you ALWAYS expect "a" to
be
a vector because there would be no point in using ifelse if it weren't.
If you believe that "a" is or ought to be a single number, you write
x <- if (a < 3) 1 else 2
The whole point of ifelse is to vectorise.
On Thu,
1 - 100 of 561 matches
Mail list logo