Re: [R] with replace na with 0?

2021-06-11 Thread Rolf Turner


On Fri, 11 Jun 2021 16:15:06 +0200
Enrico Gabrielli  wrote:

> Hello
> I almost got through the problem in post "aggregation of irregular
> interval time-series"
> I just don't understand how to fix that when I try
> ''
> with(datatable,ifelse(is.na(x),y,x))
> ''
> if y is na
> replaces me with 0
> and not with na
> 
> Thank you

Works fine for me.  There's something going on that you're not
telling us or have messed up.

Example:

x <- 1:10
x[c(1,3,5)] <- NA
y <- (1:10)/10
y[c(3,5,7)] <- NA
mung <- data.frame(x=x,y=y)
gorp <- with(mung,ifelse(is.na(x),y,x))
cbind(mung,result=gorp)

No spurious zeroes.

Note however that this is yet another example of the unnecessary use of
ifelse().  Much better is:

gorp2 <- x
i <- is.na(x)
gorp2[i] <- y[i]

Check:

all.equal(gorp,gorp2) # TRUE

As has been pointed out, you should include a minimal reproducible
example in questions such as this.  Creating such an example almost
always reveals the source of the problem so that you can solve it
yourself.

cheers,

Rolf Turner

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Bert Gunter
First, if Rui's solution works for you, I recommend that you stop reading
and discard this email. Why  bother wasting time with stuff you don't need?!

If it doesn't work or if you would like another approach -- perhaps as a
check -- then read on.

Warning: I am a dinosaur and just use base R functionality , including
regular expressions, for these sorts of relatively simple tasks. I also
eschew pipes. So my code for your example is simply:

matchpat <- paste("\\b",coreWords, "\\b", sep = "",collapse = "|")
out <- gsub(matchpat,"",Utterance)
Core <- nchar(out) != nchar(Utterance)
Fringe <-  nchar(gsub(" +","",out)) > 0

Note that I have given the results as logical TRUE or FALSE. If you insist
on 1's and 0's, just instead do:
Core <- (nchar(out) != nchar(Utterance)) + 0
Fringe <- sign(nchar(gsub(" +","",out)))


Now for an explanation. My approach was simply to create a regular
expression (regex) match pattern that would match any of your words or
phrases. The matchpat assignment does this just by logically "or"ing (with
the"|" symbol) together all your words and phrases, each of which is
surrounded by the edge of word symbol, "\\b" (so only whole words or
phrases are matched). This is standard regex stuff, and I could do it
rather handily with r's paste() function. One word of caution, though: R's
?regex says:
"Long regular expression patterns may or may not be accepted: the POSIX
standard only requires up to 256 bytes." So what works for your reprex
might not work for your full list of coreWords. It is possible to work
around this by repeatedly applying subsets of your coreWords **provided**
you make sure that you order these subsets by the number of words in each
coreWord phrase. That is, bigger phrases must be applied first before
applying smaller phrases/words to the results. This is not hard to do, but
adds complexity, and may not be necessary. See below for an explanation.

What the second line of code does is to use the gsub() function to remove
all matches to matchpat -- which, via the "|" construction -- is anything
in your coreWord list. So this means that if you have any matches in an
utterance, what remains after gsubbing will be shorter -- fewer characters
-- than the original utterance. The Core assignment checks for this using
the nchar() function and returns TRUE or FALSE as appropriate. If all the
words in the utterance matched code words, you would be left with nothing
or a bunch of spaces. The Fringe assignment just first removes all spaces
via the gsub() and then returns TRUE if there's nothing (0 characters) left
or FALSE if there still are some left.

Finally, why do you have to start with longer phrases first if you have to
do this sequentially? Suppose you have the phrases "good night" in your
phrase list, and also the word "night". If you have to do things
sequentially instead of as one swell foop, if you applied the gsub() with a
bunch including only "night" first, then "night" will be removed and "good"
will be left. Then when the bunch containing "good night" is gsubbed after,
it won't see the whole phrase any more and "good" will be left in, which is
*not* what you said you wanted.

Finally,it is of course possible to do these things by sequentially
applying one word/phrase at a time in a loop (again, longest phrases first
for the same reason as above), but I believe this might take quite a while
with a big list of coreWords (and Utterances). The above approach using "|"
vectorizes things and takes advantage of the power of the regex engine, so
I think it will be more efficient **if it's accepted.**  But if you run
into the problem of pattern length limitations, then sequentially, one at a
time, might be simpler. My judgments of computational efficiency are often
wrong anyway.

Note: I think my approach works, but I would appreciate an on-list response
if I have erred. Also, even if correct, alternative cleverer approaches are
always welcome.

Cheers,
Bert


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 Fri, Jun 11, 2021 at 11:54 AM Debbie Hahs-Vaughn  wrote:

> Thank you for noting this. The utterance has to match the exact phrase
> (e.g., "all done") for it to constitute a match in the utterance.
>
>
> --
> *From:* Bert Gunter 
> *Sent:* Friday, June 11, 2021 2:42 PM
> *To:* Debbie Hahs-Vaughn 
> *Cc:* r-help@R-project.org 
> *Subject:* Re: [R] Identifying words from a list and code as 0 or 1 and
> words NOT on the list code as 1
>
> Note that your specification is ambiguous. "all done" is not a single word
> -- it's a phrase. So what do you want to do if:
>
> 1) "all"  and/or "done"  are also among your core words?
> 2) "I'm all done" is another of your core phrases.
>
> The existence of phrases in your core list allows such conflicts to arise.
> Do you claim that phrases would be chosen so that this can 

Re: [R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Debbie Hahs-Vaughn
Yes, wonderful! This seems to work beautifully.  Thank you so much!



From: Rui Barradas 
Sent: Friday, June 11, 2021 2:03 PM
To: Debbie Hahs-Vaughn ; r-help@R-project.org 

Subject: Re: [R] Identifying words from a list and code as 0 or 1 and words NOT 
on the list code as 1

Hello,

For what I understood of the problem, this might be what you want.


library(dplyr)
library(stringr)

coreWordsPat <- paste0("\\b", coreWords, "\\b")
coreWordsPat <- paste(coreWordsPat, collapse = "|")

left_join(
   df %>%
 mutate(Core = +str_detect(Utterance, coreWordsPat)) %>%
 select(ID, Utterance, Core),
   df %>%
 mutate(Fringe = str_remove_all(Utterance, coreWordsPat),
Fringe = +(nchar(trimws(Fringe)) > 0)) %>%
 select(ID, Fringe),
   by = "ID"
)


Hope this helps,

Rui Barradas

Às 18:02 de 11/06/21, Debbie Hahs-Vaughn escreveu:
> I am working with utterances, statements spoken by children.  From each 
> utterance, if one or more words in the statement match a predefined list of 
> multiple 'core' words (probably 300 words), then I want to input '1' into 
> 'Core' (and if none, then input '0' into 'Core').
>
> If there are one or more words in the statement that are NOT core words, then 
> I want to input '1' into 'Fringe' (and if there are only core words and 
> nothing extra, then input '0' into 'Fringe').  I will not have a list of 
> Fringe words.
>
> Basically, right now I have a child ID and only the utterances.  Here is a 
> snippet of my data.
>
> ID  Utterance
> 1   a baby
> 2   small
> 3   yes
> 4   where's his bed
> 5   there's his bed
> 6   where's his pillow
> 7   what is that on his head
> 8   hey he has his arm stuck here
> 9   there there's it
> 10  now you're gonna go night-night
> 11  and that's the thing you can turn on
> 12  yeah where's the music box
> 13  what is this
> 14  small
> 15  there you go baby
>
>
> The following code runs but isn't doing exactly what I need--which is:  1) 
> the ability to detect words from the list and define as core; 2) the ability 
> to search the utterance and if there are any words in the utterance that are 
> NOT core, to identify those as �1� as I will not have a list of fringe words.
>
> ```
>
> library(dplyr)
> library(stringr)
> library(tidyr)
>
> coreWords <-c("I", "no", "yes", "my", "the", "want", "is", "it", "that", "a", 
> "go", "mine", "you", "what", "on", "in", "here", "more", "out", "off", 
> "some", "help", "all done", "finished")
>
> str_detect(df,)
>
> dfplus <- df %>%
>mutate(id = row_number()) %>%
>separate_rows(Utterance, sep = ' ') %>%
>mutate(Core = + str_detect(Utterance, str_c(coreWords, collapse = '|')),
>   Fringe = + !Core) %>%
>group_by(id) %>%
>mutate(Core = + (sum(Core) > 0),
>   Fringe = + (sum(Fringe) > 0)) %>%
>slice(1) %>%
>select(-Utterance) %>%
>left_join(df) %>%
>ungroup() %>%
>select(Utterance, Core, Fringe, ID)
>
> ```
>
> The dput() code is:
>
> structure(list(Utterance = c("a baby", "small", "yes", "where's his bed",
> "there's his bed", "where's his pillow", "what is that on his head",
> "hey he has his arm stuck here", "there there's it", "now you're gonna go 
> night-night",
> "and that's the thing you can turn on", "yeah where's the music box",
> "what is this", "small", "there you go baby ", "what is this for ",
> "a ", "and the go goodnight here ", "and what is this ", " what's that sound 
> ",
> "what does she say ", "what she say", "should I turn the on so Laura doesn't 
> cry ",
> "what is this ", "what is that ", "where's clothes ", " where's the baby's 
> bedroom ",
> "that might be in dad's bed+room ", "yes ", "there you go baby ",
> "you're welcome "), Core = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L), Fringe = c(0L, 0L, 0L, 1L, 1L, 1L,
> 0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = 1:31), row.names = c(NA,
> -31L), class = c("tbl_df", "tbl", "data.frame"))
>
> ```
>
> The first 10 rows of output looks like this:
>
> Utterance   CoreFringe  ID
> 1   a baby  1   0   1
> 2   small   1   0   2
> 3   yes 1   0   3
> 4   where's his bed 1   1   4
> 5   there's his bed 1   1   5
> 6   where's his pillow  1   1   6
> 7   what is that on his head1   0   7
> 8   hey he has his arm stuck here   1   1   8
> 9   there there's it1   0   9
> 10  now you're gonna go night-night 1   1   10
>
> For example, in line 1 of the output, �a� is a core word so �1� for core is 
> correct.  However, �baby� should be picked up as fringe so there should be 
> �1�, not �0�, for fringe. Lines 7 and 9 also have words that should be 
> identified as fringe but are not.

Re: [R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Debbie Hahs-Vaughn
Thank you for noting this. The utterance has to match the exact phrase (e.g., 
"all done") for it to constitute a match in the utterance.



From: Bert Gunter 
Sent: Friday, June 11, 2021 2:42 PM
To: Debbie Hahs-Vaughn 
Cc: r-help@R-project.org 
Subject: Re: [R] Identifying words from a list and code as 0 or 1 and words NOT 
on the list code as 1

Note that your specification is ambiguous. "all done" is not a single word -- 
it's a phrase. So what do you want to do if:

1) "all"  and/or "done"  are also among your core words?
2) "I'm all done" is another of your core phrases.

The existence of phrases in your core list allows such conflicts to arise. Do 
you claim that phrases would be chosen so that this can never happen? -- or 
what is your specification if they can (what constitutes a match and in what 
priority)?

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 Fri, Jun 11, 2021 at 10:06 AM Debbie Hahs-Vaughn 
mailto:deb...@ucf.edu>> wrote:
I am working with utterances, statements spoken by children.  From each 
utterance, if one or more words in the statement match a predefined list of 
multiple 'core' words (probably 300 words), then I want to input '1' into 
'Core' (and if none, then input '0' into 'Core').

If there are one or more words in the statement that are NOT core words, then I 
want to input '1' into 'Fringe' (and if there are only core words and nothing 
extra, then input '0' into 'Fringe').  I will not have a list of Fringe words.

Basically, right now I have a child ID and only the utterances.  Here is a 
snippet of my data.

ID  Utterance
1   a baby
2   small
3   yes
4   where's his bed
5   there's his bed
6   where's his pillow
7   what is that on his head
8   hey he has his arm stuck here
9   there there's it
10  now you're gonna go night-night
11  and that's the thing you can turn on
12  yeah where's the music box
13  what is this
14  small
15  there you go baby


The following code runs but isn't doing exactly what I need--which is:  1) the 
ability to detect words from the list and define as core; 2) the ability to 
search the utterance and if there are any words in the utterance that are NOT 
core, to identify those as �1� as I will not have a list of fringe words.

```

library(dplyr)
library(stringr)
library(tidyr)

coreWords <-c("I", "no", "yes", "my", "the", "want", "is", "it", "that", "a", 
"go", "mine", "you", "what", "on", "in", "here", "more", "out", "off", "some", 
"help", "all done", "finished")

str_detect(df,)

dfplus <- df %>%
  mutate(id = row_number()) %>%
  separate_rows(Utterance, sep = ' ') %>%
  mutate(Core = + str_detect(Utterance, str_c(coreWords, collapse = '|')),
 Fringe = + !Core) %>%
  group_by(id) %>%
  mutate(Core = + (sum(Core) > 0),
 Fringe = + (sum(Fringe) > 0)) %>%
  slice(1) %>%
  select(-Utterance) %>%
  left_join(df) %>%
  ungroup() %>%
  select(Utterance, Core, Fringe, ID)

```

The dput() code is:

structure(list(Utterance = c("a baby", "small", "yes", "where's his bed",
"there's his bed", "where's his pillow", "what is that on his head",
"hey he has his arm stuck here", "there there's it", "now you're gonna go 
night-night",
"and that's the thing you can turn on", "yeah where's the music box",
"what is this", "small", "there you go baby ", "what is this for ",
"a ", "and the go goodnight here ", "and what is this ", " what's that sound ",
"what does she say ", "what she say", "should I turn the on so Laura doesn't 
cry ",
"what is this ", "what is that ", "where's clothes ", " where's the baby's 
bedroom ",
"that might be in dad's bed+room ", "yes ", "there you go baby ",
"you're welcome "), Core = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), Fringe = c(0L, 0L, 0L, 1L, 1L, 1L,
0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = 1:31), row.names = c(NA,
-31L), class = c("tbl_df", "tbl", "data.frame"))

```

The first 10 rows of output looks like this:

Utterance   CoreFringe  ID
1   a baby  1   0   1
2   small   1   0   2
3   yes 1   0   3
4   where's his bed 1   1   4
5   there's his bed 1   1   5
6   where's his pillow  1   1   6
7   what is that on his head1   0   7
8   hey he has his arm stuck here   1   1   8
9   there there's it1   0   9
10  now you're gonna go night-night 1   1   10

For example, in line 1 of the output, �a� is a core word so �1� for core is 
correct.  However, �baby� should be picked up as fringe so there should be �1�, 
not �0�, for fringe. Lines 7 and 9 also have words that should be 

Re: [R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Bert Gunter
Note that your specification is ambiguous. "all done" is not a single word
-- it's a phrase. So what do you want to do if:

1) "all"  and/or "done"  are also among your core words?
2) "I'm all done" is another of your core phrases.

The existence of phrases in your core list allows such conflicts to arise.
Do you claim that phrases would be chosen so that this can never happen? --
or what is your specification if they can (what constitutes a match and in
what priority)?

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 Fri, Jun 11, 2021 at 10:06 AM Debbie Hahs-Vaughn  wrote:

> I am working with utterances, statements spoken by children.  From each
> utterance, if one or more words in the statement match a predefined list of
> multiple 'core' words (probably 300 words), then I want to input '1' into
> 'Core' (and if none, then input '0' into 'Core').
>
> If there are one or more words in the statement that are NOT core words,
> then I want to input '1' into 'Fringe' (and if there are only core words
> and nothing extra, then input '0' into 'Fringe').  I will not have a list
> of Fringe words.
>
> Basically, right now I have a child ID and only the utterances.  Here is a
> snippet of my data.
>
> ID  Utterance
> 1   a baby
> 2   small
> 3   yes
> 4   where's his bed
> 5   there's his bed
> 6   where's his pillow
> 7   what is that on his head
> 8   hey he has his arm stuck here
> 9   there there's it
> 10  now you're gonna go night-night
> 11  and that's the thing you can turn on
> 12  yeah where's the music box
> 13  what is this
> 14  small
> 15  there you go baby
>
>
> The following code runs but isn't doing exactly what I need--which is:  1)
> the ability to detect words from the list and define as core; 2) the
> ability to search the utterance and if there are any words in the utterance
> that are NOT core, to identify those as ‘1’ as I will not have a list of
> fringe words.
>
> ```
>
> library(dplyr)
> library(stringr)
> library(tidyr)
>
> coreWords <-c("I", "no", "yes", "my", "the", "want", "is", "it", "that",
> "a", "go", "mine", "you", "what", "on", "in", "here", "more", "out", "off",
> "some", "help", "all done", "finished")
>
> str_detect(df,)
>
> dfplus <- df %>%
>   mutate(id = row_number()) %>%
>   separate_rows(Utterance, sep = ' ') %>%
>   mutate(Core = + str_detect(Utterance, str_c(coreWords, collapse = '|')),
>  Fringe = + !Core) %>%
>   group_by(id) %>%
>   mutate(Core = + (sum(Core) > 0),
>  Fringe = + (sum(Fringe) > 0)) %>%
>   slice(1) %>%
>   select(-Utterance) %>%
>   left_join(df) %>%
>   ungroup() %>%
>   select(Utterance, Core, Fringe, ID)
>
> ```
>
> The dput() code is:
>
> structure(list(Utterance = c("a baby", "small", "yes", "where's his bed",
> "there's his bed", "where's his pillow", "what is that on his head",
> "hey he has his arm stuck here", "there there's it", "now you're gonna go
> night-night",
> "and that's the thing you can turn on", "yeah where's the music box",
> "what is this", "small", "there you go baby ", "what is this for ",
> "a ", "and the go goodnight here ", "and what is this ", " what's that
> sound ",
> "what does she say ", "what she say", "should I turn the on so Laura
> doesn't cry ",
> "what is this ", "what is that ", "where's clothes ", " where's the baby's
> bedroom ",
> "that might be in dad's bed+room ", "yes ", "there you go baby ",
> "you're welcome "), Core = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L), Fringe = c(0L, 0L, 0L, 1L, 1L, 1L,
> 0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = 1:31), row.names = c(NA,
> -31L), class = c("tbl_df", "tbl", "data.frame"))
>
> ```
>
> The first 10 rows of output looks like this:
>
> Utterance   CoreFringe  ID
> 1   a baby  1   0   1
> 2   small   1   0   2
> 3   yes 1   0   3
> 4   where's his bed 1   1   4
> 5   there's his bed 1   1   5
> 6   where's his pillow  1   1   6
> 7   what is that on his head1   0   7
> 8   hey he has his arm stuck here   1   1   8
> 9   there there's it1   0   9
> 10  now you're gonna go night-night 1   1   10
>
> For example, in line 1 of the output, ‘a’ is a core word so ‘1’ for core
> is correct.  However, ‘baby’ should be picked up as fringe so there should
> be ‘1’, not ‘0’, for fringe. Lines 7 and 9 also have words that should be
> identified as fringe but are not.
>
> Additionally, it seems like if the utterance has parts of a core word in
> it, it’s being counted. For example, ‘small’ is identified as a core word
> even though it's not (but 'all done' is a 

Re: [R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Rui Barradas

Hello,

For what I understood of the problem, this might be what you want.


library(dplyr)
library(stringr)

coreWordsPat <- paste0("\\b", coreWords, "\\b")
coreWordsPat <- paste(coreWordsPat, collapse = "|")

left_join(
  df %>%
mutate(Core = +str_detect(Utterance, coreWordsPat)) %>%
select(ID, Utterance, Core),
  df %>%
mutate(Fringe = str_remove_all(Utterance, coreWordsPat),
   Fringe = +(nchar(trimws(Fringe)) > 0)) %>%
select(ID, Fringe),
  by = "ID"
)


Hope this helps,

Rui Barradas

Às 18:02 de 11/06/21, Debbie Hahs-Vaughn escreveu:

I am working with utterances, statements spoken by children.  From each 
utterance, if one or more words in the statement match a predefined list of 
multiple 'core' words (probably 300 words), then I want to input '1' into 
'Core' (and if none, then input '0' into 'Core').

If there are one or more words in the statement that are NOT core words, then I 
want to input '1' into 'Fringe' (and if there are only core words and nothing 
extra, then input '0' into 'Fringe').  I will not have a list of Fringe words.

Basically, right now I have a child ID and only the utterances.  Here is a 
snippet of my data.

ID  Utterance
1   a baby
2   small
3   yes
4   where's his bed
5   there's his bed
6   where's his pillow
7   what is that on his head
8   hey he has his arm stuck here
9   there there's it
10  now you're gonna go night-night
11  and that's the thing you can turn on
12  yeah where's the music box
13  what is this
14  small
15  there you go baby


The following code runs but isn't doing exactly what I need--which is:  1) the 
ability to detect words from the list and define as core; 2) the ability to 
search the utterance and if there are any words in the utterance that are NOT 
core, to identify those as �1� as I will not have a list of fringe words.

```

library(dplyr)
library(stringr)
library(tidyr)

coreWords <-c("I", "no", "yes", "my", "the", "want", "is", "it", "that", "a", "go", "mine", "you", "what", "on", "in", "here", "more", 
"out", "off", "some", "help", "all done", "finished")

str_detect(df,)

dfplus <- df %>%
   mutate(id = row_number()) %>%
   separate_rows(Utterance, sep = ' ') %>%
   mutate(Core = + str_detect(Utterance, str_c(coreWords, collapse = '|')),
  Fringe = + !Core) %>%
   group_by(id) %>%
   mutate(Core = + (sum(Core) > 0),
  Fringe = + (sum(Fringe) > 0)) %>%
   slice(1) %>%
   select(-Utterance) %>%
   left_join(df) %>%
   ungroup() %>%
   select(Utterance, Core, Fringe, ID)

```

The dput() code is:

structure(list(Utterance = c("a baby", "small", "yes", "where's his bed",
"there's his bed", "where's his pillow", "what is that on his head",
"hey he has his arm stuck here", "there there's it", "now you're gonna go 
night-night",
"and that's the thing you can turn on", "yeah where's the music box",
"what is this", "small", "there you go baby ", "what is this for ",
"a ", "and the go goodnight here ", "and what is this ", " what's that sound ",
"what does she say ", "what she say", "should I turn the on so Laura doesn't cry 
",
"what is this ", "what is that ", "where's clothes ", " where's the baby's bedroom 
",
"that might be in dad's bed+room ", "yes ", "there you go baby ",
"you're welcome "), Core = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), Fringe = c(0L, 0L, 0L, 1L, 1L, 1L,
0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = 1:31), row.names = c(NA,
-31L), class = c("tbl_df", "tbl", "data.frame"))

```

The first 10 rows of output looks like this:

Utterance   CoreFringe  ID
1   a baby  1   0   1
2   small   1   0   2
3   yes 1   0   3
4   where's his bed 1   1   4
5   there's his bed 1   1   5
6   where's his pillow  1   1   6
7   what is that on his head1   0   7
8   hey he has his arm stuck here   1   1   8
9   there there's it1   0   9
10  now you're gonna go night-night 1   1   10

For example, in line 1 of the output, �a� is a core word so �1� for core is 
correct.  However, �baby� should be picked up as fringe so there should be �1�, 
not �0�, for fringe. Lines 7 and 9 also have words that should be identified as 
fringe but are not.

Additionally, it seems like if the utterance has parts of a core word in it, 
it�s being counted. For example, �small� is identified as a core word even 
though it's not (but 'all done' is a core word). 'Where's his bed' is 
identified as core and fringe, although none of the words are core.

Any suggestions on what is happening and how to correct it are greatly 
appreciated.

[[alternative HTML version deleted]]


__
R-help@r-project.org mailing list -- To 

[R] Identifying words from a list and code as 0 or 1 and words NOT on the list code as 1

2021-06-11 Thread Debbie Hahs-Vaughn
I am working with utterances, statements spoken by children.  From each 
utterance, if one or more words in the statement match a predefined list of 
multiple 'core' words (probably 300 words), then I want to input '1' into 
'Core' (and if none, then input '0' into 'Core').

If there are one or more words in the statement that are NOT core words, then I 
want to input '1' into 'Fringe' (and if there are only core words and nothing 
extra, then input '0' into 'Fringe').  I will not have a list of Fringe words.

Basically, right now I have a child ID and only the utterances.  Here is a 
snippet of my data.

ID  Utterance
1   a baby
2   small
3   yes
4   where's his bed
5   there's his bed
6   where's his pillow
7   what is that on his head
8   hey he has his arm stuck here
9   there there's it
10  now you're gonna go night-night
11  and that's the thing you can turn on
12  yeah where's the music box
13  what is this
14  small
15  there you go baby


The following code runs but isn't doing exactly what I need--which is:  1) the 
ability to detect words from the list and define as core; 2) the ability to 
search the utterance and if there are any words in the utterance that are NOT 
core, to identify those as �1� as I will not have a list of fringe words.

```

library(dplyr)
library(stringr)
library(tidyr)

coreWords <-c("I", "no", "yes", "my", "the", "want", "is", "it", "that", "a", 
"go", "mine", "you", "what", "on", "in", "here", "more", "out", "off", "some", 
"help", "all done", "finished")

str_detect(df,)

dfplus <- df %>%
  mutate(id = row_number()) %>%
  separate_rows(Utterance, sep = ' ') %>%
  mutate(Core = + str_detect(Utterance, str_c(coreWords, collapse = '|')),
 Fringe = + !Core) %>%
  group_by(id) %>%
  mutate(Core = + (sum(Core) > 0),
 Fringe = + (sum(Fringe) > 0)) %>%
  slice(1) %>%
  select(-Utterance) %>%
  left_join(df) %>%
  ungroup() %>%
  select(Utterance, Core, Fringe, ID)

```

The dput() code is:

structure(list(Utterance = c("a baby", "small", "yes", "where's his bed",
"there's his bed", "where's his pillow", "what is that on his head",
"hey he has his arm stuck here", "there there's it", "now you're gonna go 
night-night",
"and that's the thing you can turn on", "yeah where's the music box",
"what is this", "small", "there you go baby ", "what is this for ",
"a ", "and the go goodnight here ", "and what is this ", " what's that sound ",
"what does she say ", "what she say", "should I turn the on so Laura doesn't 
cry ",
"what is this ", "what is that ", "where's clothes ", " where's the baby's 
bedroom ",
"that might be in dad's bed+room ", "yes ", "there you go baby ",
"you're welcome "), Core = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L), Fringe = c(0L, 0L, 0L, 1L, 1L, 1L,
0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), ID = 1:31), row.names = c(NA,
-31L), class = c("tbl_df", "tbl", "data.frame"))

```

The first 10 rows of output looks like this:

Utterance   CoreFringe  ID
1   a baby  1   0   1
2   small   1   0   2
3   yes 1   0   3
4   where's his bed 1   1   4
5   there's his bed 1   1   5
6   where's his pillow  1   1   6
7   what is that on his head1   0   7
8   hey he has his arm stuck here   1   1   8
9   there there's it1   0   9
10  now you're gonna go night-night 1   1   10

For example, in line 1 of the output, �a� is a core word so �1� for core is 
correct.  However, �baby� should be picked up as fringe so there should be �1�, 
not �0�, for fringe. Lines 7 and 9 also have words that should be identified as 
fringe but are not.

Additionally, it seems like if the utterance has parts of a core word in it, 
it�s being counted. For example, �small� is identified as a core word even 
though it's not (but 'all done' is a core word). 'Where's his bed' is 
identified as core and fringe, although none of the words are core.

Any suggestions on what is happening and how to correct it are greatly 
appreciated.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question re: tidycensus

2021-06-11 Thread Milton O Faison
The problem is resolved.

o

M. Omar Faison, Ph.D.
Associate Professor, Biology
Associate Vice President, Research, Economic Development, and Graduate Studies
Virginia State University
Petersburg, VA 23806
(804) 524-6793
http://twitter.com/omarfaison
At VSU, we are proudly committed to providing a transformative experience for 
our students, strategically investing in our academic programs, embracing our 
position as a top Land Grant University, embracing our role as Virginia’s 
Opportunity University, and partnering together as a University to tell our 
story.

-Original Message-
From: R-help  On Behalf Of Milton O Faison
Sent: Friday, June 11, 2021 11:04 AM
To: r-help@R-project.org
Subject: [R] question re: tidycensus

[EMAIL FROM EXTERNAL SENDER] [Do not click links or open attachments unless you 
can confirm the sender and know the content is safe.]

Hi, all,

I'm having a new (for me) problem with tidycensus. When I attempt to pull data 
at the zcta level using get_acs, I get "GEOMETRYCOLLECTION EMPTY" in the 
geometry column. It does not happen when I pull data at the census tract level. 
This is also a fairly new problem, because I was using old code that I wrote 
and successfully generated maps from in the past. Any thoughts? Here are some 
code snippets that you can run to see what I am talking about:

zcta_test<-get_acs(geography="zcta",
   variables=(c(all_pop = "B03002_001",
white_pop = "B03002_003",
black_pop = "B03002_004",
latin_pop = "B03002_012")),
   geometry=T, cache=T )

ct_test<-get_acs(geography="tract", state="51",
 variables=(c(all_pop = "B03002_001",
  white_pop = "B03002_003",
  black_pop = "B03002_004",
  latin_pop = "B03002_012")),
 geometry=T, cache=T )

Thanks in advance for any help you can provide.

o
M. Omar Faison, Ph.D.
Associate Professor, Biology
Associate Vice President, Research, Economic Development, and Graduate Studies 
Virginia State University Petersburg, VA 23806
(804) 524-6793
https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_omarfaison=DwICAg=x0kF_uL9Aj8Nho9NV_Y5N0VRgus3JhNu4ET-UrQfa2c=IxtcqU8MuUxaq7uVsaxQkg=XhPOfl_j7ZHB6bCZibPPH67hk0TqkCT-EryOLREjd30=-Dr4LICOMPZZPalYZfcnmLhGdBAqE9yJZXjX-nGQpow=
 

At VSU, we are proudly committed to providing a transformative experience for 
our students, strategically investing in our academic programs, embracing our 
position as a top Land Grant University, embracing our role as Virginia's 
Opportunity University, and partnering together as a University to tell our 
story.

"The information in this email and any attachments may be confidential and 
privileged. Access to this email by anyone other than the intended addressee is 
unauthorized. If you are not the intended recipient (or the employee or agent 
responsible for delivering this information to the intended recipient) please 
notify the sender by reply email and immediately delete this email and any 
copies from your computer and/or storage system. The sender does not authorize 
the use, distribution, disclosure or reproduction of this email (or any part of 
its contents) by anyone other than the intended recipient(s). No representation 
is made that this email and any attachments are free of viruses. Virus scanning 
is recommended and is the responsibility of the recipient."

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp=DwICAg=x0kF_uL9Aj8Nho9NV_Y5N0VRgus3JhNu4ET-UrQfa2c=IxtcqU8MuUxaq7uVsaxQkg=XhPOfl_j7ZHB6bCZibPPH67hk0TqkCT-EryOLREjd30=QRP2OKyBRcfl93mIq6F159UuDSgEC62WqRDYl8ZPUf0=
PLEASE do read the posting guide 
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html=DwICAg=x0kF_uL9Aj8Nho9NV_Y5N0VRgus3JhNu4ET-UrQfa2c=IxtcqU8MuUxaq7uVsaxQkg=XhPOfl_j7ZHB6bCZibPPH67hk0TqkCT-EryOLREjd30=VG60V4vdazTZv1wM5Q0nvEh46A33pFBwkB0Bxa9jzEw=
and provide commented, minimal, self-contained, reproducible code.
“The information in this email and any attachments may be confidential and 
privileged. Access to this email by anyone other than the intended addressee is 
unauthorized. If you are not the intended recipient (or the employee or agent 
responsible for delivering this information to the intended recipient) please 
notify the sender by reply email and immediately delete this email and any 
copies from your computer and/or 

Re: [R] question re: tidycensus

2021-06-11 Thread Bert Gunter
Have you read the posting guide, linked below, which says:

"For questions about functions in standard packages distributed with R (see
the FAQ Add-on packages in R
), ask
questions on R-help.
If the question relates to a *contributed package* , e.g., one downloaded
from CRAN, try contacting the package maintainer first. You can also use
find("functionname") and packageDescription("packagename") to find this
information. *Only* send such questions to R-help or R-devel if you get no
reply or need further assistance. This applies to both requests for help
and to bug reports."

The "tidyverse" consists of contributed packages, so do not be surprised if
you do not receive a response here. Of course, if you have contacted the
maintainers, say so, but of course that doesn't guarantee a response.

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 Fri, Jun 11, 2021 at 8:04 AM Milton O Faison  wrote:

> Hi, all,
>
> I'm having a new (for me) problem with tidycensus. When I attempt to pull
> data at the zcta level using get_acs, I get "GEOMETRYCOLLECTION EMPTY" in
> the geometry column. It does not happen when I pull data at the census
> tract level. This is also a fairly new problem, because I was using old
> code that I wrote and successfully generated maps from in the past. Any
> thoughts? Here are some code snippets that you can run to see what I am
> talking about:
>
> zcta_test<-get_acs(geography="zcta",
>variables=(c(all_pop = "B03002_001",
> white_pop = "B03002_003",
> black_pop = "B03002_004",
> latin_pop = "B03002_012")),
>geometry=T, cache=T )
>
> ct_test<-get_acs(geography="tract", state="51",
>  variables=(c(all_pop = "B03002_001",
>   white_pop = "B03002_003",
>   black_pop = "B03002_004",
>   latin_pop = "B03002_012")),
>  geometry=T, cache=T )
>
> Thanks in advance for any help you can provide.
>
> o
> M. Omar Faison, Ph.D.
> Associate Professor, Biology
> Associate Vice President, Research, Economic Development, and Graduate
> Studies
> Virginia State University
> Petersburg, VA 23806
> (804) 524-6793
> http://twitter.com/omarfaison<
> https://urldefense.proofpoint.com/v2/url?u=http-3A__twitter.com_omarfaison=DwMFaQ=x0kF_uL9Aj8Nho9NV_Y5N0VRgus3JhNu4ET-UrQfa2c=IxtcqU8MuUxaq7uVsaxQkg=c2Jz-ZN8dT7jr1ymvzj06YmlEcGQKIlxGcJ241xeVvc=9hWiMv7VHiP6W763kVu0J8RpEijbsKpHXY9CDrs7buc=
> >
> At VSU, we are proudly committed to providing a transformative experience
> for our students, strategically investing in our academic programs,
> embracing our position as a top Land Grant University, embracing our role
> as Virginia's Opportunity University, and partnering together as a
> University to tell our story.
>
> "The information in this email and any attachments may be confidential and
> privileged. Access to this email by anyone other than the intended
> addressee is unauthorized. If you are not the intended recipient (or the
> employee or agent responsible for delivering this information to the
> intended recipient) please notify the sender by reply email and immediately
> delete this email and any copies from your computer and/or storage system.
> The sender does not authorize the use, distribution, disclosure or
> reproduction of this email (or any part of its contents) by anyone other
> than the intended recipient(s). No representation is made that this email
> and any attachments are free of viruses. Virus scanning is recommended and
> is the responsibility of the recipient."
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] question re: tidycensus

2021-06-11 Thread Milton O Faison
Hi, all,

I'm having a new (for me) problem with tidycensus. When I attempt to pull data 
at the zcta level using get_acs, I get "GEOMETRYCOLLECTION EMPTY" in the 
geometry column. It does not happen when I pull data at the census tract level. 
This is also a fairly new problem, because I was using old code that I wrote 
and successfully generated maps from in the past. Any thoughts? Here are some 
code snippets that you can run to see what I am talking about:

zcta_test<-get_acs(geography="zcta",
   variables=(c(all_pop = "B03002_001",
white_pop = "B03002_003",
black_pop = "B03002_004",
latin_pop = "B03002_012")),
   geometry=T, cache=T )

ct_test<-get_acs(geography="tract", state="51",
 variables=(c(all_pop = "B03002_001",
  white_pop = "B03002_003",
  black_pop = "B03002_004",
  latin_pop = "B03002_012")),
 geometry=T, cache=T )

Thanks in advance for any help you can provide.

o
M. Omar Faison, Ph.D.
Associate Professor, Biology
Associate Vice President, Research, Economic Development, and Graduate Studies
Virginia State University
Petersburg, VA 23806
(804) 524-6793
http://twitter.com/omarfaison
At VSU, we are proudly committed to providing a transformative experience for 
our students, strategically investing in our academic programs, embracing our 
position as a top Land Grant University, embracing our role as Virginia's 
Opportunity University, and partnering together as a University to tell our 
story.

"The information in this email and any attachments may be confidential and 
privileged. Access to this email by anyone other than the intended addressee is 
unauthorized. If you are not the intended recipient (or the employee or agent 
responsible for delivering this information to the intended recipient) please 
notify the sender by reply email and immediately delete this email and any 
copies from your computer and/or storage system. The sender does not authorize 
the use, distribution, disclosure or reproduction of this email (or any part of 
its contents) by anyone other than the intended recipient(s). No representation 
is made that this email and any attachments are free of viruses. Virus scanning 
is recommended and is the responsibility of the recipient."

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] with replace na with 0?

2021-06-11 Thread Jiefei Wang
Hi,

I did not follow your previous post but your code looks confusing to me

with(datatable,ifelse(is.na(x),y,x))

Why do you have 'x' in the first place if all you want is to do the
operation on y? It's like you want to count how many apples you have
but your eyes are looking at peaches. Please rethink your code and
what you want to achieve.

Best,
Jiefei

On Fri, Jun 11, 2021 at 10:23 PM Enrico Gabrielli
 wrote:
>
> Hello
> I almost got through the problem in post "aggregation of irregular
> interval time-series"
> I just don't understand how to fix that when I try
> ''
> with(datatable,ifelse(is.na(x),y,x))
> ''
> if y is na
> replaces me with 0
> and not with na
>
> Thank you
> --
> Perito agrario Enrico Gabrielli
> Tessera n. 633 Collegio Periti agrari prov. Di Modena
> Biblioteca agricoltura: https://www.zotero.org/groups/aplomb/
> https://it.linkedin.com/pub/enrico-gabrielli/9a/186/159
> https://enricogabrielli76.wordpress.com/
> https://www.inaturalist.org/observations/bonushenricus
> skype: enricogabrielli (enricogabrielli76.per...@gmail.com)
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] with replace na with 0?

2021-06-11 Thread Bert Gunter
reprex?

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 Fri, Jun 11, 2021 at 7:23 AM Enrico Gabrielli <
enricogabrielli76.per...@gmail.com> wrote:

> Hello
> I almost got through the problem in post "aggregation of irregular
> interval time-series"
> I just don't understand how to fix that when I try
> ''
> with(datatable,ifelse(is.na(x),y,x))
> ''
> if y is na
> replaces me with 0
> and not with na
>
> Thank you
> --
> Perito agrario Enrico Gabrielli
> Tessera n. 633 Collegio Periti agrari prov. Di Modena
> Biblioteca agricoltura: https://www.zotero.org/groups/aplomb/
> https://it.linkedin.com/pub/enrico-gabrielli/9a/186/159
> https://enricogabrielli76.wordpress.com/
> https://www.inaturalist.org/observations/bonushenricus
> skype: enricogabrielli (enricogabrielli76.per...@gmail.com)
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] with replace na with 0?

2021-06-11 Thread Enrico Gabrielli
Hello
I almost got through the problem in post "aggregation of irregular
interval time-series"
I just don't understand how to fix that when I try
''
with(datatable,ifelse(is.na(x),y,x))
''
if y is na
replaces me with 0
and not with na

Thank you
-- 
Perito agrario Enrico Gabrielli
Tessera n. 633 Collegio Periti agrari prov. Di Modena
Biblioteca agricoltura: https://www.zotero.org/groups/aplomb/
https://it.linkedin.com/pub/enrico-gabrielli/9a/186/159
https://enricogabrielli76.wordpress.com/
https://www.inaturalist.org/observations/bonushenricus
skype: enricogabrielli (enricogabrielli76.per...@gmail.com)

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comments on "Introduction to R"

2021-06-11 Thread Jim Lemon
Hi Abdullah,
A good job of proof reading, something too often neglected in documentation.

Jim

On Fri, Jun 11, 2021 at 4:51 PM Abdullah Khasawneh
 wrote:
>
> Dear all,
>
> I have recently finished reading "Introduction to R" and enjoyed it and 
> benefited from it immensely. Thank you very much for your efforts.
>
> I feel the word "corrections" is a bit presumptuous, so below are a few 
> suggestions I have regarding the text. Please let me know if I am mistaken in 
> any.
>
> Thank you again.
>
> Best regards,
> Abdullah Khasawneh
>
> 
>
> Page 2:
> (Indeed most of the system supplied functions are themselves written in the S 
> language.)\
> I suggest a hyphen between the two highlighted words.
>
> Page 2:
> We prefer to think of it of an environment within which many classical and 
> modern statistical techniques have been implemented.
> Perhaps "as an environment"?
>
> Page 4:
> The ‘Search Engine and Keywords’ link in the page loaded by help.start() is 
> particularly useful as it is contains a high-level concept list which 
> searches though available functions.
> I think these should be "as it contains" and "through".
>
> Page 5:
> Commands are separated either by a semi-colon (‘;’), or by a newline.
> I think the two words have been connected inadvertently.
>
> Page 6:
> When R is started at later time from the same directory it reloads the 
> workspace from this file.
> I think it's "at a later time".
>
> Page 6:
> ... but it can be quite hard to decide what they might be when the several 
> analyses have been conducted in the same directory.
> Perhaps it should be "when several analyses", without "the".
>
> Page 7:
> Notice that the assignment operator (‘<-’), which consists of the two 
> characters ‘<’ (“less than”) and ‘-’ (“minus”) occurring strictly 
> side-by-side and it ‘points’ to the object receiving the value of the 
> expression.
> I suggest a comma here, and deleting "and it".
>
> Page 14:
> Similarly character() is a empty character vector, and so on.
> It should be "an empty". Also, a comma after "similarly" would be nice.
>
> Page 14:
> ... makes it an object of length 5 consisting of just the former components 
> with even index.
> Should it be "with even indices"?
>
> Page 17:
> Since there is an builtin function var() to calculate...
> I suggest "a built-in".
>
> Page 17:
> Note that R’s a builtin function sd() is something different.
> There is no need for the indefinite article, and perhaps "built-in" should be 
> hyphenated.
>
> Page 20:
> For example, if the vector h contains 24 or fewer, numbers then the command...
> The comma should be after the word "numbers".
>
> Page 20:
> ... would use h to set up 3 by 4 by 2 array in Z.
> I believe it's "a 3-by-4-by-2". I am not sure about the hyphenation, but 
> there should be an indefinite article.
>
> Page 21:
> The result of the function is an array of the same size as a but with old 
> dimension given by perm[j] becoming the new j-th dimension.
> It's "with the old dimension".
>
> Page 24:
> In this case any vector argument, possibly cyclically extended, are of course 
> taken as row vectors.
> Either "argument" should be pluralized, or other parts of the sentence 
> singularized.
>
> Page 27:
> ... and by default1 character vectors are coerced to be factors, whose levels 
> are the unique values appearing in the vector.
> Unfortunately, in the current edition of R, they are coerced to be character 
> variables, if I'm not mistaken.
>
> Page 30:
> By default numeric items (except row labels) are read as numeric variables 
> and non-numeric variables, such as Cent.heat in the example, as factors.
> I suggest a comma after "By default". Also, please refer to the note above 
> about coercion into factors.
>
> Page 47:
> ... it replaces the value, in that environment, with the value of right hand 
> side.
> Maybe it should be "of the right-hand side".
>
> Page 54:
> ... (Akaike’s An Information Criterion)...
> I think it's "Akaike information criterion".
>
> Page 63:
> Although this is done automatically, it may useful to know that...
> This is missing the verb "be".
>
> Page 66:
> Also lm.obj may be list with a coefficients component of length 2...
> I recommend adding the indefinite article "a" before the word "list".
>
> Page 68:
> The identify() functions performs no plotting itself, but...
> The word "functions" is pluralized.
>
> Page 76:
> R does not have builtin capabilities for dynamic or interactive graphics, 
> e.g. rotating point clouds or to “brushing” (interactively highlighting) 
> points.
> I suggest a hyphen in "built-in", and perhaps "for" instead of "to".
>
> Page 79:
> ... platforms, considerable effort has gone into make the scripting 
> facilities as platform-independent as is feasible.
> The gerund "making" should be used here.
>
> End of list.
> Thank you for your patience.
> 
>
>  

Re: [R-es] Posible fuga de datos y malware

2021-06-11 Thread miguel.angel.rodriguez.muinos
Hola Jorge.

Soy el administrador (uno de ellos) de la lista de R-help-es.

Por favor reenvíame el email (por privado) para realizar unas comprobaciones.
Te confirmo que al resto de usuarios de la lista no nos están llegando correos 
sospechosos procedentes de tu dirección (para que te quedes tranquilo) pero es 
un tema que hay que revisar.

Gracias.


Un Saludo,
-
Miguel Ángel Rodríguez Muíños
Dirección Xeral de Saúde Pública
Consellería de Sanidade
Xunta de Galicia
https://dxsp.sergas.gal/



De: R-help-es  en nombre de jorge.senan 

Enviado: jueves, 10 de junio de 2021 16:40
Para: r-help-es@r-project.org
Asunto: [R-es] Posible fuga de datos y malware

Buenos días,

Perdonar este mail pero me están apareciendo mails de malware con datos
de mi cuenta, asunto de la lista de r-españa [R-es] y contenido de
mensajes en hilos de la lista de R-es.

Creo que se apoyan en la publicación en abierto de conversaciones de
este foro...Aparece recurrrentemente la dirección de la gestión del
mail. (stat.ethz.ch/mailman/listinfo/r-help-es)

Prefiero no reenviar el mail pero si requeris un captura de mail o algo
no dudeis en pedírmelo.

Por favor, quien tenga acceso de administrador, que mire las condiciones
de privacidad de la lista y revise el buen uso de los usuarios. Puede
que se esten publicando listas de correos o conversaciones.

Atentamente

Un saludo

Jorge Senán-Salinas
IMDEA-Agua

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es



Nota: A información contida nesta mensaxe e os seus posibles documentos 
adxuntos é privada e confidencial e está dirixida únicamente ó seu 
destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por 
favor elimínea. A distribución ou copia desta mensaxe non está autorizada.

Nota: La información contenida en este mensaje y sus posibles documentos 
adjuntos es privada y confidencial y está dirigida únicamente a su 
destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, 
por favor elimínelo. La distribución o copia de este mensaje no está autorizada.

See more languages: http://www.sergas.es/aviso-confidencialidad

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Comments on "Introduction to R"

2021-06-11 Thread Abdullah Khasawneh
Dear all,

I have recently finished reading "Introduction to R" and enjoyed it and 
benefited from it immensely. Thank you very much for your efforts.

I feel the word "corrections" is a bit presumptuous, so below are a few 
suggestions I have regarding the text. Please let me know if I am mistaken in 
any.

Thank you again.

Best regards,
Abdullah Khasawneh



Page 2:
(Indeed most of the system supplied functions are themselves written in the S 
language.)\
I suggest a hyphen between the two highlighted words.

Page 2:
We prefer to think of it of an environment within which many classical and 
modern statistical techniques have been implemented.
Perhaps "as an environment"?

Page 4:
The �Search Engine and Keywords� link in the page loaded by help.start() is 
particularly useful as it is contains a high-level concept list which searches 
though available functions.
I think these should be "as it contains" and "through".

Page 5:
Commands are separated either by a semi-colon (�;�), or by a newline.
I think the two words have been connected inadvertently.

Page 6:
When R is started at later time from the same directory it reloads the 
workspace from this file.
I think it's "at a later time".

Page 6:
... but it can be quite hard to decide what they might be when the several 
analyses have been conducted in the same directory.
Perhaps it should be "when several analyses", without "the".

Page 7:
Notice that the assignment operator (�<-�), which consists of the two 
characters �<� (�less than�) and �-� (�minus�) occurring strictly side-by-side 
and it �points� to the object receiving the value of the expression.
I suggest a comma here, and deleting "and it".

Page 14:
Similarly character() is a empty character vector, and so on.
It should be "an empty". Also, a comma after "similarly" would be nice.

Page 14:
... makes it an object of length 5 consisting of just the former components 
with even index.
Should it be "with even indices"?

Page 17:
Since there is an builtin function var() to calculate...
I suggest "a built-in".

Page 17:
Note that R�s a builtin function sd() is something different.
There is no need for the indefinite article, and perhaps "built-in" should be 
hyphenated.

Page 20:
For example, if the vector h contains 24 or fewer, numbers then the command...
The comma should be after the word "numbers".

Page 20:
... would use h to set up 3 by 4 by 2 array in Z.
I believe it's "a 3-by-4-by-2". I am not sure about the hyphenation, but there 
should be an indefinite article.

Page 21:
The result of the function is an array of the same size as a but with old 
dimension given by perm[j] becoming the new j-th dimension.
It's "with the old dimension".

Page 24:
In this case any vector argument, possibly cyclically extended, are of course 
taken as row vectors.
Either "argument" should be pluralized, or other parts of the sentence 
singularized.

Page 27:
... and by default1 character vectors are coerced to be factors, whose levels 
are the unique values appearing in the vector.
Unfortunately, in the current edition of R, they are coerced to be character 
variables, if I'm not mistaken.

Page 30:
By default numeric items (except row labels) are read as numeric variables and 
non-numeric variables, such as Cent.heat in the example, as factors.
I suggest a comma after "By default". Also, please refer to the note above 
about coercion into factors.

Page 47:
... it replaces the value, in that environment, with the value of right hand 
side.
Maybe it should be "of the right-hand side".

Page 54:
... (Akaike�s An Information Criterion)...
I think it's "Akaike information criterion".

Page 63:
Although this is done automatically, it may useful to know that...
This is missing the verb "be".

Page 66:
Also lm.obj may be list with a coefficients component of length 2...
I recommend adding the indefinite article "a" before the word "list".

Page 68:
The identify() functions performs no plotting itself, but...
The word "functions" is pluralized.

Page 76:
R does not have builtin capabilities for dynamic or interactive graphics, e.g. 
rotating point clouds or to �brushing� (interactively highlighting) points.
I suggest a hyphen in "built-in", and perhaps "for" instead of "to".

Page 79:
... platforms, considerable effort has gone into make the scripting facilities 
as platform-independent as is feasible.
The gerund "making" should be used here.

End of list.
Thank you for your patience.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.