Re: [R] (no subject)

2024-10-01 Thread avi.e.gross
Grant, I think,

Your NO SUBJECT message confused me as it seems a continuation of an earlier
discussion of a new and likely irrelevant metric of the worthiness of R
programs.

Did you make a mistake here? I tried your code as well and the results did
not look like what the OP asked for.

It took me a bit to figure out why we needed factors to do what was asked,
and I have concluded we did not but that a particular approach made use of
it as a way to get unsplit to gather the right values together as in:

  x <- list(`1` = c(7, 13, 1, 4, 10),
`2` = c(2, 5,  14, 8, 11),
`3` = c(6, 9, 15, 12, 3))
  f <- factor(rep(1:3,5))

  result <- unsplit(x, f)

By inspection, what the code is doing is treating the three list elements
like rows  stacked and then reading down the columns from left to right:

  > x
  $`1`
  [1]  7 13  1  4 10

  $`2`
  [1]  2  5 14  8 11

  $`3`
  [1]  6  9 15 12  3

  > unsplit(x, f)
   [1]  7  2  6 13  5  9  1 14 15  4  8 12 10 11  3

Your code offers, instead:

unlist(x[f])

I have no idea why that would work as it acts by taking indices (not really
factors even if in factor form as it end up being integers from 1 to 3
repeated 5 times) and thus simply repeats all of x five times and then
gathers all the results in a pile of numbers that does not resemble what is
wanted:

> f
 [1] 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
Levels: 1 2 3
> x[f]
$`1`
[1]  7 13  1  4 10

$`2`
[1]  2  5 14  8 11

$`3`
[1]  6  9 15 12  3

$`1`
[1]  7 13  1  4 10

<< unlist(x[f])
11 12 13 14 15 21 22 23 24 25 31 32 33 34 35 11 12 13 14 15 21 22 23 24 25
31 32 33 34 35 11 12 13 14 15 
 7 13  1  4 10  2  5 14  8 11  6  9 15 12  3  7 13  1  4 10  2  5 14  8 11
6  9 15 12  3  7 13  1  4 10 
21 22 23 24 25 31 32 33 34 35 11 12 13 14 15 21 22 23 24 25 31 32 33 34 35
11 12 13 14 15 21 22 23 24 25 
 2  5 14  8 11  6  9 15 12  3  7 13  1  4 10  2  5 14  8 11  6  9 15 12  3
7 13  1  4 10  2  5 14  8 11 
31 32 33 34 35 
 6  9 15 12  3

I would like to hear if you meant something else or am I doing anything
wrong.

I was thinking of how to expand the request using the technique we now
consider the Rexiest.

If you declare x to be a list of Nrows vectors, all the same length, Mcols,
then a generalized version might be working on something like this, where,
names do not seem needed or even relevant as the various methods use have
tossed them.

x <- list(c(7, 13, 1, 4, 10, 12),
  c(2, 5,  14, 8, 11, 13),
  c(6, 9, 15, 12, 3, 14),
  c( 101, 102, 103, 104, 105, 15),
  c(-105, -104, -103, -102, -101, 16))

I added one number at the end of each from above and added two rows.

The number of items in the list is:

Nrows <- length(x)

In the above example, that happens to be five and in the original, 3.

Assuming all the parts are the same length, you can just check one of them
for a length as a vector:

Mcols <- length(x[[1]])

And you get 6 for the new version and 5 for the original.

So, using the same technique, generalized, should work as:

f <- factor(rep(1:Nrows,Mcols))

And the result is:

result <- unsplit(x, f)

Comparing the new test of x versus results shows

> x
[[1]]
[1]  7 13  1  4 10 12

[[2]]
[1]  2  5 14  8 11 13

[[3]]
[1]  6  9 15 12  3 14

[[4]]
[1] 101 102 103 104 105  15

[[5]]
[1] -105 -104 -103 -102 -101   16

> result
 [1]726  101 -105   1359  102 -1041   14   15  103
-10348   12  104 -102
[21]   10   113  105 -101   12   13   14   15   16

Of course, many of the other techniques we discussed here also scale up to
any size easily, if not as compactly.




-Original Message-
From: R-help  On Behalf Of Izmirlian, Grant
(NIH/NCI) [E] via R-help
Sent: Tuesday, October 1, 2024 7:54 AM
To: [email protected]
Subject: [R] (no subject)

I would go with unlist on x,single bracket subsetted on f


x <- list(`1` = c(7, 13, 1, 4, 10),
  `2` = c(2, 5,  14, 8, 11),
  `3` = c(6, 9, 15, 12, 3))
f <- factor(rep(1:3,5))

unlist(x[f])


Yes, unsplit() it is. I was messing around with ave() (which can be hammered
into submission, sort of).

My overlooking unsplit() is somewhat impressive in view of "svn diff -c
18591"

-pd

> On 27 Sep 2024, at 17:08 , Martin Maechler 
wrote:

>
>> Chris Evans via R-help
>>on Fri, 27 Sep 2024 12:20:47 +0200 writes:
>
>> Oh glorious!  Thanks Duncan.
>> Fortune cookie nomination!
>
> I don't  disagree with the nomination -- thank you, Duncan!
>
> However, please note that I'm sure Rolf's was challenged /
> question was ment to work correctly for all  factors `f`  with
> levels "1", "2", "3".
>
> Almost all solution were simply assuming that the toy example
> `f` was the real `f`, but that's not realistic.
>
> Consequently, in my view, the only valid proposition and a very
> nice one, indeed, was  Deepayan's (well, he's "R core", ...)
>
>   unsplit(x, f)
>
> Martin
>
>> On 27/09/2024 11:13, Duncan Murdoch wrote:
>>> On 2024-09-26 11:55 p.m., Rolf Turner wrote:

 I hav

Re: [R] (no subject)

2024-09-16 Thread Francesca
Sorry, my typing was corrected by the computer.
When I have a NA, there should be a missing value.
So, if a group has 2 values and a NA, the two that have values, should be
replaced by the mean of the two,
the third should be NA.
The NA is the participant that dropped out.

On Tue, 17 Sept 2024 at 02:27, Bert Gunter  wrote:

> Hmmm... typos and thinkos ?
>
> Maybe:
> mean_narm<- function(x) {
>m <- mean(x, na.rm = T)
>if (is.nan (m)) NA else m
> }
>
> -- Bert
>
> On Mon, Sep 16, 2024 at 4:40 PM CALUM POLWART  wrote:
> >
> > Rui's solution is good.
> >
> > Bert's suggestion is also good!
> >
> > For Berts suggestion you'd make the list bit
> >
> > list(mean = mean_narm)
> >
> > But prior to that define a function:
> >
> > mean_narm<- function(x) {
> >
> > m <- mean(x, na.rm = T)
> >
> > if (!is.Nan (m)) {
> > m <- NA
> > }
> >
> > return (m)
> > }
> >
> > Would do what you suggested in your reply to Bert.
> >
> > On Mon, 16 Sep 2024, 19:48 Rui Barradas,  wrote:
> >
> > > Às 15:23 de 16/09/2024, Francesca escreveu:
> > > > Sorry for posting a non understandable code. In my screen the dataset
> > > > looked correctly.
> > > >
> > > >
> > > > I recreated my dataset, folllowing your example:
> > > >
> > > > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5,
> NA, 17,
> > > >   2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> > > >  c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 ,
> 5,
> > > 19,
> > > > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> > > >  c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4,
> 4, 4,
> > > 2,
> > > > 2, 3, 2, 3, 3, 2, 2 ,4),
> > > >  c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4,
> 7,
> > > 5,
> > > > 8, 5, 1, 2, 4, 7, 6, 6)))
> > > > colnames(test)<-c("cp1","cp2","role","groupid")
> > > >
> > > > What I have done so far is the following, that works:
> > > >   test %>%
> > > >group_by(groupid) %>%
> > > >mutate(across(starts_with("cp"), list(mean = mean)))
> > > >
> > > > But the problem is with NA: everytime the mean encounters a NA, it
> > > creates
> > > > NA for all group members.
> > > > I need the software to calculate the mean ignoring NA. So when the
> group
> > > is
> > > > made of three people, mean of the three.
> > > > If the group is two values and an NA, calculate the mean of two.
> > > >
> > > > My code works , creates a mean at each position for three subjects,
> > > > replacing instead of the value of the single, the group mean.
> > > > But when NA appears, all the group gets NA.
> > > >
> > > > Perhaps there is a different way to obtain the same result.
> > > >
> > > >
> > > >
> > > > On Mon, 16 Sept 2024 at 11:35, Rui Barradas 
> > > wrote:
> > > >
> > > >> Às 08:28 de 16/09/2024, Francesca escreveu:
> > > >>> Dear Contributors,
> > > >>> I hope someone has found a similar issue.
> > > >>>
> > > >>> I have this data set,
> > > >>>
> > > >>>
> > > >>>
> > > >>> cp1
> > > >>> cp2
> > > >>> role
> > > >>> groupid
> > > >>> 1
> > > >>> 10
> > > >>> 13
> > > >>> 4
> > > >>> 5
> > > >>> 2
> > > >>> 5
> > > >>> 10
> > > >>> 3
> > > >>> 1
> > > >>> 3
> > > >>> 7
> > > >>> 7
> > > >>> 4
> > > >>> 6
> > > >>> 4
> > > >>> 10
> > > >>> 4
> > > >>> 2
> > > >>> 7
> > > >>> 5
> > > >>> 5
> > > >>> 8
> > > >>> 3
> > > >>> 2
> > > >>> 6
> > > >>> 8
> > > >>> 7
> > > >>> 4
> > > >>> 4
> > > >>> 7
> > > >>> 8
> > > >>> 8
> > > >>> 4
> > > >>> 7
> > > >>> 8
> > > >>> 10
> > > >>> 15
> > > >>> 3
> > > >>> 3
> > > >>> 9
> > > >>> 15
> > > >>> 10
> > > >>> 2
> > > >>> 2
> > > >>> 10
> > > >>> 5
> > > >>> 5
> > > >>> 2
> > > >>> 4
> > > >>> 11
> > > >>> 20
> > > >>> 20
> > > >>> 2
> > > >>> 5
> > > >>> 12
> > > >>> 9
> > > >>> 11
> > > >>> 3
> > > >>> 6
> > > >>> 13
> > > >>> 10
> > > >>> 13
> > > >>> 4
> > > >>> 3
> > > >>> 14
> > > >>> 12
> > > >>> 6
> > > >>> 4
> > > >>> 2
> > > >>> 15
> > > >>> 7
> > > >>> 4
> > > >>> 4
> > > >>> 1
> > > >>> 16
> > > >>> 10
> > > >>> 0
> > > >>> 3
> > > >>> 7
> > > >>> 17
> > > >>> 20
> > > >>> 15
> > > >>> 3
> > > >>> 8
> > > >>> 18
> > > >>> 10
> > > >>> 7
> > > >>> 3
> > > >>> 4
> > > >>> 19
> > > >>> 8
> > > >>> 13
> > > >>> 3
> > > >>> 5
> > > >>> 20
> > > >>> 10
> > > >>> 9
> > > >>> 2
> > > >>> 6
> > > >>>
> > > >>>
> > > >>>
> > > >>> I need to to average of groups, using the values of column
> groupid, and
> > > >>> create a twin dataset in which the mean of the group is replaced
> > > instead
> > > >> of
> > > >>> individual values.
> > > >>> So for example, groupid 3, I calculate the mean (12+18)/2 and then
> I
> > > >>> replace in the new dataframe, but in the same positions, instead
> of 12
> > > >> and
> > > >>> 18, the values of the corresponding mean.
> > > >>> I found this solution, where db10_means is the output dataset,
> db10 is
> > > my
> > > >>> initial data.
> > > >>>
> > > >>> db10_means<-db10 %>%
> > > >>> group_by(groupid) %>%
> > > >>> mutate(across(starts_with("cp"), list(mean = mean)))
> > > >>>
> > > >>> It works perfec

Re: [R] (no subject)

2024-09-16 Thread Bert Gunter
Hmmm... typos and thinkos ?

Maybe:
mean_narm<- function(x) {
   m <- mean(x, na.rm = T)
   if (is.nan (m)) NA else m
}

-- Bert

On Mon, Sep 16, 2024 at 4:40 PM CALUM POLWART  wrote:
>
> Rui's solution is good.
>
> Bert's suggestion is also good!
>
> For Berts suggestion you'd make the list bit
>
> list(mean = mean_narm)
>
> But prior to that define a function:
>
> mean_narm<- function(x) {
>
> m <- mean(x, na.rm = T)
>
> if (!is.Nan (m)) {
> m <- NA
> }
>
> return (m)
> }
>
> Would do what you suggested in your reply to Bert.
>
> On Mon, 16 Sep 2024, 19:48 Rui Barradas,  wrote:
>
> > Às 15:23 de 16/09/2024, Francesca escreveu:
> > > Sorry for posting a non understandable code. In my screen the dataset
> > > looked correctly.
> > >
> > >
> > > I recreated my dataset, folllowing your example:
> > >
> > > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
> > >   2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> > >  c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5,
> > 19,
> > > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> > >  c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4,
> > 2,
> > > 2, 3, 2, 3, 3, 2, 2 ,4),
> > >  c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7,
> > 5,
> > > 8, 5, 1, 2, 4, 7, 6, 6)))
> > > colnames(test)<-c("cp1","cp2","role","groupid")
> > >
> > > What I have done so far is the following, that works:
> > >   test %>%
> > >group_by(groupid) %>%
> > >mutate(across(starts_with("cp"), list(mean = mean)))
> > >
> > > But the problem is with NA: everytime the mean encounters a NA, it
> > creates
> > > NA for all group members.
> > > I need the software to calculate the mean ignoring NA. So when the group
> > is
> > > made of three people, mean of the three.
> > > If the group is two values and an NA, calculate the mean of two.
> > >
> > > My code works , creates a mean at each position for three subjects,
> > > replacing instead of the value of the single, the group mean.
> > > But when NA appears, all the group gets NA.
> > >
> > > Perhaps there is a different way to obtain the same result.
> > >
> > >
> > >
> > > On Mon, 16 Sept 2024 at 11:35, Rui Barradas 
> > wrote:
> > >
> > >> Às 08:28 de 16/09/2024, Francesca escreveu:
> > >>> Dear Contributors,
> > >>> I hope someone has found a similar issue.
> > >>>
> > >>> I have this data set,
> > >>>
> > >>>
> > >>>
> > >>> cp1
> > >>> cp2
> > >>> role
> > >>> groupid
> > >>> 1
> > >>> 10
> > >>> 13
> > >>> 4
> > >>> 5
> > >>> 2
> > >>> 5
> > >>> 10
> > >>> 3
> > >>> 1
> > >>> 3
> > >>> 7
> > >>> 7
> > >>> 4
> > >>> 6
> > >>> 4
> > >>> 10
> > >>> 4
> > >>> 2
> > >>> 7
> > >>> 5
> > >>> 5
> > >>> 8
> > >>> 3
> > >>> 2
> > >>> 6
> > >>> 8
> > >>> 7
> > >>> 4
> > >>> 4
> > >>> 7
> > >>> 8
> > >>> 8
> > >>> 4
> > >>> 7
> > >>> 8
> > >>> 10
> > >>> 15
> > >>> 3
> > >>> 3
> > >>> 9
> > >>> 15
> > >>> 10
> > >>> 2
> > >>> 2
> > >>> 10
> > >>> 5
> > >>> 5
> > >>> 2
> > >>> 4
> > >>> 11
> > >>> 20
> > >>> 20
> > >>> 2
> > >>> 5
> > >>> 12
> > >>> 9
> > >>> 11
> > >>> 3
> > >>> 6
> > >>> 13
> > >>> 10
> > >>> 13
> > >>> 4
> > >>> 3
> > >>> 14
> > >>> 12
> > >>> 6
> > >>> 4
> > >>> 2
> > >>> 15
> > >>> 7
> > >>> 4
> > >>> 4
> > >>> 1
> > >>> 16
> > >>> 10
> > >>> 0
> > >>> 3
> > >>> 7
> > >>> 17
> > >>> 20
> > >>> 15
> > >>> 3
> > >>> 8
> > >>> 18
> > >>> 10
> > >>> 7
> > >>> 3
> > >>> 4
> > >>> 19
> > >>> 8
> > >>> 13
> > >>> 3
> > >>> 5
> > >>> 20
> > >>> 10
> > >>> 9
> > >>> 2
> > >>> 6
> > >>>
> > >>>
> > >>>
> > >>> I need to to average of groups, using the values of column groupid, and
> > >>> create a twin dataset in which the mean of the group is replaced
> > instead
> > >> of
> > >>> individual values.
> > >>> So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> > >>> replace in the new dataframe, but in the same positions, instead of 12
> > >> and
> > >>> 18, the values of the corresponding mean.
> > >>> I found this solution, where db10_means is the output dataset, db10 is
> > my
> > >>> initial data.
> > >>>
> > >>> db10_means<-db10 %>%
> > >>> group_by(groupid) %>%
> > >>> mutate(across(starts_with("cp"), list(mean = mean)))
> > >>>
> > >>> It works perfectly, except that for NA values, where it replaces to all
> > >>> group members the NA, while in some cases, the group is made of some NA
> > >> and
> > >>> some values.
> > >>> So, when I have a group of two values and one NA, I would like that for
> > >>> those with a value, the mean is replaced, for those with NA, the NA is
> > >>> replaced.
> > >>> Here the mean function has not the na.rm=T option associated, but it
> > >>> appears that this solution cannot be implemented in this case. I am not
> > >>> even sure that this would be enough to solve my problem.
> > >>> Thanks for any help provided.
> > >>>
> > >> Hello,
> > >>
> > >> Your data is a mess, please don't post html, this is plain text only
> > >> list. Anyway, I managed to create a data frame by co

Re: [R] (no subject)

2024-09-16 Thread CALUM POLWART
Rui's solution is good.

Bert's suggestion is also good!

For Berts suggestion you'd make the list bit

list(mean = mean_narm)

But prior to that define a function:

mean_narm<- function(x) {

m <- mean(x, na.rm = T)

if (!is.Nan (m)) {
m <- NA
}

return (m)
}

Would do what you suggested in your reply to Bert.

On Mon, 16 Sep 2024, 19:48 Rui Barradas,  wrote:

> Às 15:23 de 16/09/2024, Francesca escreveu:
> > Sorry for posting a non understandable code. In my screen the dataset
> > looked correctly.
> >
> >
> > I recreated my dataset, folllowing your example:
> >
> > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
> >   2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> >  c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5,
> 19,
> > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> >  c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4,
> 2,
> > 2, 3, 2, 3, 3, 2, 2 ,4),
> >  c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7,
> 5,
> > 8, 5, 1, 2, 4, 7, 6, 6)))
> > colnames(test)<-c("cp1","cp2","role","groupid")
> >
> > What I have done so far is the following, that works:
> >   test %>%
> >group_by(groupid) %>%
> >mutate(across(starts_with("cp"), list(mean = mean)))
> >
> > But the problem is with NA: everytime the mean encounters a NA, it
> creates
> > NA for all group members.
> > I need the software to calculate the mean ignoring NA. So when the group
> is
> > made of three people, mean of the three.
> > If the group is two values and an NA, calculate the mean of two.
> >
> > My code works , creates a mean at each position for three subjects,
> > replacing instead of the value of the single, the group mean.
> > But when NA appears, all the group gets NA.
> >
> > Perhaps there is a different way to obtain the same result.
> >
> >
> >
> > On Mon, 16 Sept 2024 at 11:35, Rui Barradas 
> wrote:
> >
> >> Às 08:28 de 16/09/2024, Francesca escreveu:
> >>> Dear Contributors,
> >>> I hope someone has found a similar issue.
> >>>
> >>> I have this data set,
> >>>
> >>>
> >>>
> >>> cp1
> >>> cp2
> >>> role
> >>> groupid
> >>> 1
> >>> 10
> >>> 13
> >>> 4
> >>> 5
> >>> 2
> >>> 5
> >>> 10
> >>> 3
> >>> 1
> >>> 3
> >>> 7
> >>> 7
> >>> 4
> >>> 6
> >>> 4
> >>> 10
> >>> 4
> >>> 2
> >>> 7
> >>> 5
> >>> 5
> >>> 8
> >>> 3
> >>> 2
> >>> 6
> >>> 8
> >>> 7
> >>> 4
> >>> 4
> >>> 7
> >>> 8
> >>> 8
> >>> 4
> >>> 7
> >>> 8
> >>> 10
> >>> 15
> >>> 3
> >>> 3
> >>> 9
> >>> 15
> >>> 10
> >>> 2
> >>> 2
> >>> 10
> >>> 5
> >>> 5
> >>> 2
> >>> 4
> >>> 11
> >>> 20
> >>> 20
> >>> 2
> >>> 5
> >>> 12
> >>> 9
> >>> 11
> >>> 3
> >>> 6
> >>> 13
> >>> 10
> >>> 13
> >>> 4
> >>> 3
> >>> 14
> >>> 12
> >>> 6
> >>> 4
> >>> 2
> >>> 15
> >>> 7
> >>> 4
> >>> 4
> >>> 1
> >>> 16
> >>> 10
> >>> 0
> >>> 3
> >>> 7
> >>> 17
> >>> 20
> >>> 15
> >>> 3
> >>> 8
> >>> 18
> >>> 10
> >>> 7
> >>> 3
> >>> 4
> >>> 19
> >>> 8
> >>> 13
> >>> 3
> >>> 5
> >>> 20
> >>> 10
> >>> 9
> >>> 2
> >>> 6
> >>>
> >>>
> >>>
> >>> I need to to average of groups, using the values of column groupid, and
> >>> create a twin dataset in which the mean of the group is replaced
> instead
> >> of
> >>> individual values.
> >>> So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> >>> replace in the new dataframe, but in the same positions, instead of 12
> >> and
> >>> 18, the values of the corresponding mean.
> >>> I found this solution, where db10_means is the output dataset, db10 is
> my
> >>> initial data.
> >>>
> >>> db10_means<-db10 %>%
> >>> group_by(groupid) %>%
> >>> mutate(across(starts_with("cp"), list(mean = mean)))
> >>>
> >>> It works perfectly, except that for NA values, where it replaces to all
> >>> group members the NA, while in some cases, the group is made of some NA
> >> and
> >>> some values.
> >>> So, when I have a group of two values and one NA, I would like that for
> >>> those with a value, the mean is replaced, for those with NA, the NA is
> >>> replaced.
> >>> Here the mean function has not the na.rm=T option associated, but it
> >>> appears that this solution cannot be implemented in this case. I am not
> >>> even sure that this would be enough to solve my problem.
> >>> Thanks for any help provided.
> >>>
> >> Hello,
> >>
> >> Your data is a mess, please don't post html, this is plain text only
> >> list. Anyway, I managed to create a data frame by copying the data to a
> >> file named "rhelp.txt" and then running
> >>
> >>
> >>
> >> db10 <- scan(file = "rhelp.txt", what = character())
> >> header <- db10[1:4]
> >> db10 <- db10[-(1:4)] |> as.numeric()
> >> db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
> >> as.data.frame() |>
> >> setNames(header)
> >>
> >> str(db10)
> >> #> 'data.frame':25 obs. of  4 variables:
> >> #>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
> >> #>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
> >> #>  $ role   : num  13 5 3 6 2 8 8 7 7 3 ...
> >> #>  $ groupid: num  4 10 7 4 7 3 7 8 8 3 ...
> >>
> >>
> >> And here 

Re: [R] (no subject)

2024-09-16 Thread Rui Barradas

Às 15:23 de 16/09/2024, Francesca escreveu:

Sorry for posting a non understandable code. In my screen the dataset
looked correctly.


I recreated my dataset, folllowing your example:

test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
 c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 19,
NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
 c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 2,
2, 3, 2, 3, 3, 2, 2 ,4),
 c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
8, 5, 1, 2, 4, 7, 6, 6)))
colnames(test)<-c("cp1","cp2","role","groupid")

What I have done so far is the following, that works:
  test %>%
   group_by(groupid) %>%
   mutate(across(starts_with("cp"), list(mean = mean)))

But the problem is with NA: everytime the mean encounters a NA, it creates
NA for all group members.
I need the software to calculate the mean ignoring NA. So when the group is
made of three people, mean of the three.
If the group is two values and an NA, calculate the mean of two.

My code works , creates a mean at each position for three subjects,
replacing instead of the value of the single, the group mean.
But when NA appears, all the group gets NA.

Perhaps there is a different way to obtain the same result.



On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:


Às 08:28 de 16/09/2024, Francesca escreveu:

Dear Contributors,
I hope someone has found a similar issue.

I have this data set,



cp1
cp2
role
groupid
1
10
13
4
5
2
5
10
3
1
3
7
7
4
6
4
10
4
2
7
5
5
8
3
2
6
8
7
4
4
7
8
8
4
7
8
10
15
3
3
9
15
10
2
2
10
5
5
2
4
11
20
20
2
5
12
9
11
3
6
13
10
13
4
3
14
12
6
4
2
15
7
4
4
1
16
10
0
3
7
17
20
15
3
8
18
10
7
3
4
19
8
13
3
5
20
10
9
2
6



I need to to average of groups, using the values of column groupid, and
create a twin dataset in which the mean of the group is replaced instead

of

individual values.
So for example, groupid 3, I calculate the mean (12+18)/2 and then I
replace in the new dataframe, but in the same positions, instead of 12

and

18, the values of the corresponding mean.
I found this solution, where db10_means is the output dataset, db10 is my
initial data.

db10_means<-db10 %>%
group_by(groupid) %>%
mutate(across(starts_with("cp"), list(mean = mean)))

It works perfectly, except that for NA values, where it replaces to all
group members the NA, while in some cases, the group is made of some NA

and

some values.
So, when I have a group of two values and one NA, I would like that for
those with a value, the mean is replaced, for those with NA, the NA is
replaced.
Here the mean function has not the na.rm=T option associated, but it
appears that this solution cannot be implemented in this case. I am not
even sure that this would be enough to solve my problem.
Thanks for any help provided.


Hello,

Your data is a mess, please don't post html, this is plain text only
list. Anyway, I managed to create a data frame by copying the data to a
file named "rhelp.txt" and then running



db10 <- scan(file = "rhelp.txt", what = character())
header <- db10[1:4]
db10 <- db10[-(1:4)] |> as.numeric()
db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
as.data.frame() |>
setNames(header)

str(db10)
#> 'data.frame':25 obs. of  4 variables:
#>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
#>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
#>  $ role   : num  13 5 3 6 2 8 8 7 7 3 ...
#>  $ groupid: num  4 10 7 4 7 3 7 8 8 3 ...


And here is the data in dput format.



db10 <-
structure(list(
  cp1 = c(1, 5, 3, 7, 10, 5, 2, 4, 8, 10, 9, 2,
  2, 20, 9, 13, 3, 4, 4, 10, 17, 8, 3, 13, 10),
  cp2 = c(10, 2, 1, 4, 4, 5, 6, 4, 4, 15, 15, 10,
  4, 2, 11, 10, 14, 2, 4, 0, 20, 18, 4, 3, 9),
  role = c(13, 5, 3, 6, 2, 8, 8, 7, 7, 3, 10, 5,
   11, 5, 3, 13, 12, 15, 1, 3, 15, 10, 19, 5, 2),
  groupid = c(4, 10, 7, 4, 7, 3, 7, 8, 8, 3, 2, 5,
  20, 12, 6, 4, 6, 7, 16, 7, 3, 7, 8, 20, 6)),
  class = "data.frame", row.names = c(NA, -25L))



As for the problem, I am not sure if you want summarise instead of
mutate but here is a summarise solution.



library(dplyr)

db10 %>%
group_by(groupid) %>%
summarise(across(starts_with("cp"), ~ mean(.x, na.rm = TRUE)))

# same result, summarise's new argument .by avoids the need to group_by
db10 %>%
summarise(across(starts_with("cp"), ~ mean(.x, na.rm = TRUE)), .by =
groupid)



Can you post the expected output too?

Hope this helps,

Rui Barradas


--
Este e-mail foi analisado pelo software antivírus AVG para verificar a
presença de vírus.
www.avg.com





Hello,

Something like this?


test <-
  structure(list(
cp1 = c(1, 5, 3, 7, 10, 5, 2, 4, 8, 10, 9, 2,
2, 20, 9, 13, 3, 4, 4, 10, 17, 8, 3, 13, 10),
cp2 = c(10, 2, 1, 4, 4, 5, 6, 4, 4, 15, 15, 10,
4, 2, 11, 10, 14, 2, 4, 0, 20, 18, 4, 3, 9),
role = c(13, 5, 3, 6, 2, 8, 8,

Re: [R] (no subject)

2024-09-16 Thread Bert Gunter
Incidentally, if you intend to use these means for further analytical
purposes, you may produce irreproducible conclusions: after all, a
mean of 10 things is more *meaningful* than a mean of 2. However, that
is a discussion too far for this list. Consult your local statistical
resources if you need to go there and need help.

Cheers,
Bert

On Mon, Sep 16, 2024 at 11:02 AM Bert Gunter  wrote:
>
> It's NA *not* Na. Details matter.
>
> Ah, but note:
> > mean(c(NA,NA), na.rm = TRUE)
> [1] NaN
>
> So if that might happen, you'll have to write your own mean function,
> say mymean(), to do what you want. I leave that (simple) pleasure to
> you.
>
> -- Bert
>
> On Mon, Sep 16, 2024 at 8:05 AM Francesca  
> wrote:
> >
> > All' Na Is Na.
> >
> >
> > Il lun 16 set 2024, 16:29 Bert Gunter  ha scritto:
> >>
> >> See the na.rm argument of ?mean
> >>
> >> But what happens if all values are NA?
> >>
> >> -- Bert
> >>
> >>
> >> On Mon, Sep 16, 2024 at 7:24 AM Francesca  
> >> wrote:
> >> >
> >> > Sorry for posting a non understandable code. In my screen the dataset
> >> > looked correctly.
> >> >
> >> >
> >> > I recreated my dataset, folllowing your example:
> >> >
> >> > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
> >> >  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> >> > c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 
> >> > 19,
> >> > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> >> > c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 
> >> > 2,
> >> > 2, 3, 2, 3, 3, 2, 2 ,4),
> >> > c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
> >> > 8, 5, 1, 2, 4, 7, 6, 6)))
> >> > colnames(test)<-c("cp1","cp2","role","groupid")
> >> >
> >> > What I have done so far is the following, that works:
> >> >  test %>%
> >> >   group_by(groupid) %>%
> >> >   mutate(across(starts_with("cp"), list(mean = mean)))
> >> >
> >> > But the problem is with NA: everytime the mean encounters a NA, it 
> >> > creates
> >> > NA for all group members.
> >> > I need the software to calculate the mean ignoring NA. So when the group 
> >> > is
> >> > made of three people, mean of the three.
> >> > If the group is two values and an NA, calculate the mean of two.
> >> >
> >> > My code works , creates a mean at each position for three subjects,
> >> > replacing instead of the value of the single, the group mean.
> >> > But when NA appears, all the group gets NA.
> >> >
> >> > Perhaps there is a different way to obtain the same result.
> >> >
> >> >
> >> >
> >> > On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:
> >> >
> >> > > Às 08:28 de 16/09/2024, Francesca escreveu:
> >> > > > Dear Contributors,
> >> > > > I hope someone has found a similar issue.
> >> > > >
> >> > > > I have this data set,
> >> > > >
> >> > > >
> >> > > >
> >> > > > cp1
> >> > > > cp2
> >> > > > role
> >> > > > groupid
> >> > > > 1
> >> > > > 10
> >> > > > 13
> >> > > > 4
> >> > > > 5
> >> > > > 2
> >> > > > 5
> >> > > > 10
> >> > > > 3
> >> > > > 1
> >> > > > 3
> >> > > > 7
> >> > > > 7
> >> > > > 4
> >> > > > 6
> >> > > > 4
> >> > > > 10
> >> > > > 4
> >> > > > 2
> >> > > > 7
> >> > > > 5
> >> > > > 5
> >> > > > 8
> >> > > > 3
> >> > > > 2
> >> > > > 6
> >> > > > 8
> >> > > > 7
> >> > > > 4
> >> > > > 4
> >> > > > 7
> >> > > > 8
> >> > > > 8
> >> > > > 4
> >> > > > 7
> >> > > > 8
> >> > > > 10
> >> > > > 15
> >> > > > 3
> >> > > > 3
> >> > > > 9
> >> > > > 15
> >> > > > 10
> >> > > > 2
> >> > > > 2
> >> > > > 10
> >> > > > 5
> >> > > > 5
> >> > > > 2
> >> > > > 4
> >> > > > 11
> >> > > > 20
> >> > > > 20
> >> > > > 2
> >> > > > 5
> >> > > > 12
> >> > > > 9
> >> > > > 11
> >> > > > 3
> >> > > > 6
> >> > > > 13
> >> > > > 10
> >> > > > 13
> >> > > > 4
> >> > > > 3
> >> > > > 14
> >> > > > 12
> >> > > > 6
> >> > > > 4
> >> > > > 2
> >> > > > 15
> >> > > > 7
> >> > > > 4
> >> > > > 4
> >> > > > 1
> >> > > > 16
> >> > > > 10
> >> > > > 0
> >> > > > 3
> >> > > > 7
> >> > > > 17
> >> > > > 20
> >> > > > 15
> >> > > > 3
> >> > > > 8
> >> > > > 18
> >> > > > 10
> >> > > > 7
> >> > > > 3
> >> > > > 4
> >> > > > 19
> >> > > > 8
> >> > > > 13
> >> > > > 3
> >> > > > 5
> >> > > > 20
> >> > > > 10
> >> > > > 9
> >> > > > 2
> >> > > > 6
> >> > > >
> >> > > >
> >> > > >
> >> > > > I need to to average of groups, using the values of column groupid, 
> >> > > > and
> >> > > > create a twin dataset in which the mean of the group is replaced 
> >> > > > instead
> >> > > of
> >> > > > individual values.
> >> > > > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> >> > > > replace in the new dataframe, but in the same positions, instead of 
> >> > > > 12
> >> > > and
> >> > > > 18, the values of the corresponding mean.
> >> > > > I found this solution, where db10_means is the output dataset, db10 
> >> > > > is my
> >> > > > initial data.
> >> > > >
> >> > > > db10_means<-db10 %>%
> >> > > >group_by(groupid) %>%
> >> > > >mutate(across(starts_with("cp"), list(mean 

Re: [R] (no subject)

2024-09-16 Thread Bert Gunter
It's NA *not* Na. Details matter.

Ah, but note:
> mean(c(NA,NA), na.rm = TRUE)
[1] NaN

So if that might happen, you'll have to write your own mean function,
say mymean(), to do what you want. I leave that (simple) pleasure to
you.

-- Bert

On Mon, Sep 16, 2024 at 8:05 AM Francesca  wrote:
>
> All' Na Is Na.
>
>
> Il lun 16 set 2024, 16:29 Bert Gunter  ha scritto:
>>
>> See the na.rm argument of ?mean
>>
>> But what happens if all values are NA?
>>
>> -- Bert
>>
>>
>> On Mon, Sep 16, 2024 at 7:24 AM Francesca  
>> wrote:
>> >
>> > Sorry for posting a non understandable code. In my screen the dataset
>> > looked correctly.
>> >
>> >
>> > I recreated my dataset, folllowing your example:
>> >
>> > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
>> >  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
>> > c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 19,
>> > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
>> > c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 2,
>> > 2, 3, 2, 3, 3, 2, 2 ,4),
>> > c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
>> > 8, 5, 1, 2, 4, 7, 6, 6)))
>> > colnames(test)<-c("cp1","cp2","role","groupid")
>> >
>> > What I have done so far is the following, that works:
>> >  test %>%
>> >   group_by(groupid) %>%
>> >   mutate(across(starts_with("cp"), list(mean = mean)))
>> >
>> > But the problem is with NA: everytime the mean encounters a NA, it creates
>> > NA for all group members.
>> > I need the software to calculate the mean ignoring NA. So when the group is
>> > made of three people, mean of the three.
>> > If the group is two values and an NA, calculate the mean of two.
>> >
>> > My code works , creates a mean at each position for three subjects,
>> > replacing instead of the value of the single, the group mean.
>> > But when NA appears, all the group gets NA.
>> >
>> > Perhaps there is a different way to obtain the same result.
>> >
>> >
>> >
>> > On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:
>> >
>> > > Às 08:28 de 16/09/2024, Francesca escreveu:
>> > > > Dear Contributors,
>> > > > I hope someone has found a similar issue.
>> > > >
>> > > > I have this data set,
>> > > >
>> > > >
>> > > >
>> > > > cp1
>> > > > cp2
>> > > > role
>> > > > groupid
>> > > > 1
>> > > > 10
>> > > > 13
>> > > > 4
>> > > > 5
>> > > > 2
>> > > > 5
>> > > > 10
>> > > > 3
>> > > > 1
>> > > > 3
>> > > > 7
>> > > > 7
>> > > > 4
>> > > > 6
>> > > > 4
>> > > > 10
>> > > > 4
>> > > > 2
>> > > > 7
>> > > > 5
>> > > > 5
>> > > > 8
>> > > > 3
>> > > > 2
>> > > > 6
>> > > > 8
>> > > > 7
>> > > > 4
>> > > > 4
>> > > > 7
>> > > > 8
>> > > > 8
>> > > > 4
>> > > > 7
>> > > > 8
>> > > > 10
>> > > > 15
>> > > > 3
>> > > > 3
>> > > > 9
>> > > > 15
>> > > > 10
>> > > > 2
>> > > > 2
>> > > > 10
>> > > > 5
>> > > > 5
>> > > > 2
>> > > > 4
>> > > > 11
>> > > > 20
>> > > > 20
>> > > > 2
>> > > > 5
>> > > > 12
>> > > > 9
>> > > > 11
>> > > > 3
>> > > > 6
>> > > > 13
>> > > > 10
>> > > > 13
>> > > > 4
>> > > > 3
>> > > > 14
>> > > > 12
>> > > > 6
>> > > > 4
>> > > > 2
>> > > > 15
>> > > > 7
>> > > > 4
>> > > > 4
>> > > > 1
>> > > > 16
>> > > > 10
>> > > > 0
>> > > > 3
>> > > > 7
>> > > > 17
>> > > > 20
>> > > > 15
>> > > > 3
>> > > > 8
>> > > > 18
>> > > > 10
>> > > > 7
>> > > > 3
>> > > > 4
>> > > > 19
>> > > > 8
>> > > > 13
>> > > > 3
>> > > > 5
>> > > > 20
>> > > > 10
>> > > > 9
>> > > > 2
>> > > > 6
>> > > >
>> > > >
>> > > >
>> > > > I need to to average of groups, using the values of column groupid, and
>> > > > create a twin dataset in which the mean of the group is replaced 
>> > > > instead
>> > > of
>> > > > individual values.
>> > > > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
>> > > > replace in the new dataframe, but in the same positions, instead of 12
>> > > and
>> > > > 18, the values of the corresponding mean.
>> > > > I found this solution, where db10_means is the output dataset, db10 is 
>> > > > my
>> > > > initial data.
>> > > >
>> > > > db10_means<-db10 %>%
>> > > >group_by(groupid) %>%
>> > > >mutate(across(starts_with("cp"), list(mean = mean)))
>> > > >
>> > > > It works perfectly, except that for NA values, where it replaces to all
>> > > > group members the NA, while in some cases, the group is made of some NA
>> > > and
>> > > > some values.
>> > > > So, when I have a group of two values and one NA, I would like that for
>> > > > those with a value, the mean is replaced, for those with NA, the NA is
>> > > > replaced.
>> > > > Here the mean function has not the na.rm=T option associated, but it
>> > > > appears that this solution cannot be implemented in this case. I am not
>> > > > even sure that this would be enough to solve my problem.
>> > > > Thanks for any help provided.
>> > > >
>> > > Hello,
>> > >
>> > > Your data is a mess, please don't post html, this is plain text only
>> > > list. Anyway, I managed to create a data frame by copying the data to a
>> 

Re: [R] (no subject)

2024-09-16 Thread Francesca
All' Na Is Na.


Il lun 16 set 2024, 16:29 Bert Gunter  ha scritto:

> See the na.rm argument of ?mean
>
> But what happens if all values are NA?
>
> -- Bert
>
>
> On Mon, Sep 16, 2024 at 7:24 AM Francesca 
> wrote:
> >
> > Sorry for posting a non understandable code. In my screen the dataset
> > looked correctly.
> >
> >
> > I recreated my dataset, folllowing your example:
> >
> > test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
> >  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> > c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5,
> 19,
> > NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> > c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4,
> 2,
> > 2, 3, 2, 3, 3, 2, 2 ,4),
> > c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
> > 8, 5, 1, 2, 4, 7, 6, 6)))
> > colnames(test)<-c("cp1","cp2","role","groupid")
> >
> > What I have done so far is the following, that works:
> >  test %>%
> >   group_by(groupid) %>%
> >   mutate(across(starts_with("cp"), list(mean = mean)))
> >
> > But the problem is with NA: everytime the mean encounters a NA, it
> creates
> > NA for all group members.
> > I need the software to calculate the mean ignoring NA. So when the group
> is
> > made of three people, mean of the three.
> > If the group is two values and an NA, calculate the mean of two.
> >
> > My code works , creates a mean at each position for three subjects,
> > replacing instead of the value of the single, the group mean.
> > But when NA appears, all the group gets NA.
> >
> > Perhaps there is a different way to obtain the same result.
> >
> >
> >
> > On Mon, 16 Sept 2024 at 11:35, Rui Barradas 
> wrote:
> >
> > > Às 08:28 de 16/09/2024, Francesca escreveu:
> > > > Dear Contributors,
> > > > I hope someone has found a similar issue.
> > > >
> > > > I have this data set,
> > > >
> > > >
> > > >
> > > > cp1
> > > > cp2
> > > > role
> > > > groupid
> > > > 1
> > > > 10
> > > > 13
> > > > 4
> > > > 5
> > > > 2
> > > > 5
> > > > 10
> > > > 3
> > > > 1
> > > > 3
> > > > 7
> > > > 7
> > > > 4
> > > > 6
> > > > 4
> > > > 10
> > > > 4
> > > > 2
> > > > 7
> > > > 5
> > > > 5
> > > > 8
> > > > 3
> > > > 2
> > > > 6
> > > > 8
> > > > 7
> > > > 4
> > > > 4
> > > > 7
> > > > 8
> > > > 8
> > > > 4
> > > > 7
> > > > 8
> > > > 10
> > > > 15
> > > > 3
> > > > 3
> > > > 9
> > > > 15
> > > > 10
> > > > 2
> > > > 2
> > > > 10
> > > > 5
> > > > 5
> > > > 2
> > > > 4
> > > > 11
> > > > 20
> > > > 20
> > > > 2
> > > > 5
> > > > 12
> > > > 9
> > > > 11
> > > > 3
> > > > 6
> > > > 13
> > > > 10
> > > > 13
> > > > 4
> > > > 3
> > > > 14
> > > > 12
> > > > 6
> > > > 4
> > > > 2
> > > > 15
> > > > 7
> > > > 4
> > > > 4
> > > > 1
> > > > 16
> > > > 10
> > > > 0
> > > > 3
> > > > 7
> > > > 17
> > > > 20
> > > > 15
> > > > 3
> > > > 8
> > > > 18
> > > > 10
> > > > 7
> > > > 3
> > > > 4
> > > > 19
> > > > 8
> > > > 13
> > > > 3
> > > > 5
> > > > 20
> > > > 10
> > > > 9
> > > > 2
> > > > 6
> > > >
> > > >
> > > >
> > > > I need to to average of groups, using the values of column groupid,
> and
> > > > create a twin dataset in which the mean of the group is replaced
> instead
> > > of
> > > > individual values.
> > > > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> > > > replace in the new dataframe, but in the same positions, instead of
> 12
> > > and
> > > > 18, the values of the corresponding mean.
> > > > I found this solution, where db10_means is the output dataset, db10
> is my
> > > > initial data.
> > > >
> > > > db10_means<-db10 %>%
> > > >group_by(groupid) %>%
> > > >mutate(across(starts_with("cp"), list(mean = mean)))
> > > >
> > > > It works perfectly, except that for NA values, where it replaces to
> all
> > > > group members the NA, while in some cases, the group is made of some
> NA
> > > and
> > > > some values.
> > > > So, when I have a group of two values and one NA, I would like that
> for
> > > > those with a value, the mean is replaced, for those with NA, the NA
> is
> > > > replaced.
> > > > Here the mean function has not the na.rm=T option associated, but it
> > > > appears that this solution cannot be implemented in this case. I am
> not
> > > > even sure that this would be enough to solve my problem.
> > > > Thanks for any help provided.
> > > >
> > > Hello,
> > >
> > > Your data is a mess, please don't post html, this is plain text only
> > > list. Anyway, I managed to create a data frame by copying the data to a
> > > file named "rhelp.txt" and then running
> > >
> > >
> > >
> > > db10 <- scan(file = "rhelp.txt", what = character())
> > > header <- db10[1:4]
> > > db10 <- db10[-(1:4)] |> as.numeric()
> > > db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
> > >as.data.frame() |>
> > >setNames(header)
> > >
> > > str(db10)
> > > #> 'data.frame':25 obs. of  4 variables:
> > > #>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
> > > #>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
> > > #>  $ ro

Re: [R] (no subject)

2024-09-16 Thread John Kane
Hi,

Thanks for the revised dataset.  The R-list does not accept HTML s a safety
measure so it strips everything down to text which is what gives us the
very garbled text so you need to always send in text format.

The best way to supply sample   data is using the dput() function.  The
dput() function gives us an exact copy of your R data set. Here is a very
simple example of how to do it.

```
dat <- data.frame(xx = 1:10, yy = letters[1:10])

dput(dat)
```
This gives us
```
structure(list(xx = 1:10, yy = c("a", "b", "c", "d", "e", "f",
 "g", "h", "i", "j")), class =
"data.frame", row.names = c(NA,  -10L))
```
Paste it into your email and we  can then copy it into R





On Mon, 16 Sept 2024 at 10:24, Francesca 
wrote:

> Sorry for posting a non understandable code. In my screen the dataset
> looked correctly.
>
>
> I recreated my dataset, folllowing your example:
>
> test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
>  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 19,
> NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 2,
> 2, 3, 2, 3, 3, 2, 2 ,4),
> c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
> 8, 5, 1, 2, 4, 7, 6, 6)))
> colnames(test)<-c("cp1","cp2","role","groupid")
>
> What I have done so far is the following, that works:
>  test %>%
>   group_by(groupid) %>%
>   mutate(across(starts_with("cp"), list(mean = mean)))
>
> But the problem is with NA: everytime the mean encounters a NA, it creates
> NA for all group members.
> I need the software to calculate the mean ignoring NA. So when the group is
> made of three people, mean of the three.
> If the group is two values and an NA, calculate the mean of two.
>
> My code works , creates a mean at each position for three subjects,
> replacing instead of the value of the single, the group mean.
> But when NA appears, all the group gets NA.
>
> Perhaps there is a different way to obtain the same result.
>
>
>
> On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:
>
> > Às 08:28 de 16/09/2024, Francesca escreveu:
> > > Dear Contributors,
> > > I hope someone has found a similar issue.
> > >
> > > I have this data set,
> > >
> > >
> > >
> > > cp1
> > > cp2
> > > role
> > > groupid
> > > 1
> > > 10
> > > 13
> > > 4
> > > 5
> > > 2
> > > 5
> > > 10
> > > 3
> > > 1
> > > 3
> > > 7
> > > 7
> > > 4
> > > 6
> > > 4
> > > 10
> > > 4
> > > 2
> > > 7
> > > 5
> > > 5
> > > 8
> > > 3
> > > 2
> > > 6
> > > 8
> > > 7
> > > 4
> > > 4
> > > 7
> > > 8
> > > 8
> > > 4
> > > 7
> > > 8
> > > 10
> > > 15
> > > 3
> > > 3
> > > 9
> > > 15
> > > 10
> > > 2
> > > 2
> > > 10
> > > 5
> > > 5
> > > 2
> > > 4
> > > 11
> > > 20
> > > 20
> > > 2
> > > 5
> > > 12
> > > 9
> > > 11
> > > 3
> > > 6
> > > 13
> > > 10
> > > 13
> > > 4
> > > 3
> > > 14
> > > 12
> > > 6
> > > 4
> > > 2
> > > 15
> > > 7
> > > 4
> > > 4
> > > 1
> > > 16
> > > 10
> > > 0
> > > 3
> > > 7
> > > 17
> > > 20
> > > 15
> > > 3
> > > 8
> > > 18
> > > 10
> > > 7
> > > 3
> > > 4
> > > 19
> > > 8
> > > 13
> > > 3
> > > 5
> > > 20
> > > 10
> > > 9
> > > 2
> > > 6
> > >
> > >
> > >
> > > I need to to average of groups, using the values of column groupid, and
> > > create a twin dataset in which the mean of the group is replaced
> instead
> > of
> > > individual values.
> > > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> > > replace in the new dataframe, but in the same positions, instead of 12
> > and
> > > 18, the values of the corresponding mean.
> > > I found this solution, where db10_means is the output dataset, db10 is
> my
> > > initial data.
> > >
> > > db10_means<-db10 %>%
> > >group_by(groupid) %>%
> > >mutate(across(starts_with("cp"), list(mean = mean)))
> > >
> > > It works perfectly, except that for NA values, where it replaces to all
> > > group members the NA, while in some cases, the group is made of some NA
> > and
> > > some values.
> > > So, when I have a group of two values and one NA, I would like that for
> > > those with a value, the mean is replaced, for those with NA, the NA is
> > > replaced.
> > > Here the mean function has not the na.rm=T option associated, but it
> > > appears that this solution cannot be implemented in this case. I am not
> > > even sure that this would be enough to solve my problem.
> > > Thanks for any help provided.
> > >
> > Hello,
> >
> > Your data is a mess, please don't post html, this is plain text only
> > list. Anyway, I managed to create a data frame by copying the data to a
> > file named "rhelp.txt" and then running
> >
> >
> >
> > db10 <- scan(file = "rhelp.txt", what = character())
> > header <- db10[1:4]
> > db10 <- db10[-(1:4)] |> as.numeric()
> > db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
> >as.data.frame() |>
> >setNames(header)
> >
> > str(db10)
> > #> 'data.frame':25 obs. of  4 var

Re: [R] (no subject)

2024-09-16 Thread Bert Gunter
See the na.rm argument of ?mean

But what happens if all values are NA?

-- Bert


On Mon, Sep 16, 2024 at 7:24 AM Francesca  wrote:
>
> Sorry for posting a non understandable code. In my screen the dataset
> looked correctly.
>
>
> I recreated my dataset, folllowing your example:
>
> test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
>  2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
> c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 19,
> NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
> c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 2,
> 2, 3, 2, 3, 3, 2, 2 ,4),
> c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
> 8, 5, 1, 2, 4, 7, 6, 6)))
> colnames(test)<-c("cp1","cp2","role","groupid")
>
> What I have done so far is the following, that works:
>  test %>%
>   group_by(groupid) %>%
>   mutate(across(starts_with("cp"), list(mean = mean)))
>
> But the problem is with NA: everytime the mean encounters a NA, it creates
> NA for all group members.
> I need the software to calculate the mean ignoring NA. So when the group is
> made of three people, mean of the three.
> If the group is two values and an NA, calculate the mean of two.
>
> My code works , creates a mean at each position for three subjects,
> replacing instead of the value of the single, the group mean.
> But when NA appears, all the group gets NA.
>
> Perhaps there is a different way to obtain the same result.
>
>
>
> On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:
>
> > Às 08:28 de 16/09/2024, Francesca escreveu:
> > > Dear Contributors,
> > > I hope someone has found a similar issue.
> > >
> > > I have this data set,
> > >
> > >
> > >
> > > cp1
> > > cp2
> > > role
> > > groupid
> > > 1
> > > 10
> > > 13
> > > 4
> > > 5
> > > 2
> > > 5
> > > 10
> > > 3
> > > 1
> > > 3
> > > 7
> > > 7
> > > 4
> > > 6
> > > 4
> > > 10
> > > 4
> > > 2
> > > 7
> > > 5
> > > 5
> > > 8
> > > 3
> > > 2
> > > 6
> > > 8
> > > 7
> > > 4
> > > 4
> > > 7
> > > 8
> > > 8
> > > 4
> > > 7
> > > 8
> > > 10
> > > 15
> > > 3
> > > 3
> > > 9
> > > 15
> > > 10
> > > 2
> > > 2
> > > 10
> > > 5
> > > 5
> > > 2
> > > 4
> > > 11
> > > 20
> > > 20
> > > 2
> > > 5
> > > 12
> > > 9
> > > 11
> > > 3
> > > 6
> > > 13
> > > 10
> > > 13
> > > 4
> > > 3
> > > 14
> > > 12
> > > 6
> > > 4
> > > 2
> > > 15
> > > 7
> > > 4
> > > 4
> > > 1
> > > 16
> > > 10
> > > 0
> > > 3
> > > 7
> > > 17
> > > 20
> > > 15
> > > 3
> > > 8
> > > 18
> > > 10
> > > 7
> > > 3
> > > 4
> > > 19
> > > 8
> > > 13
> > > 3
> > > 5
> > > 20
> > > 10
> > > 9
> > > 2
> > > 6
> > >
> > >
> > >
> > > I need to to average of groups, using the values of column groupid, and
> > > create a twin dataset in which the mean of the group is replaced instead
> > of
> > > individual values.
> > > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> > > replace in the new dataframe, but in the same positions, instead of 12
> > and
> > > 18, the values of the corresponding mean.
> > > I found this solution, where db10_means is the output dataset, db10 is my
> > > initial data.
> > >
> > > db10_means<-db10 %>%
> > >group_by(groupid) %>%
> > >mutate(across(starts_with("cp"), list(mean = mean)))
> > >
> > > It works perfectly, except that for NA values, where it replaces to all
> > > group members the NA, while in some cases, the group is made of some NA
> > and
> > > some values.
> > > So, when I have a group of two values and one NA, I would like that for
> > > those with a value, the mean is replaced, for those with NA, the NA is
> > > replaced.
> > > Here the mean function has not the na.rm=T option associated, but it
> > > appears that this solution cannot be implemented in this case. I am not
> > > even sure that this would be enough to solve my problem.
> > > Thanks for any help provided.
> > >
> > Hello,
> >
> > Your data is a mess, please don't post html, this is plain text only
> > list. Anyway, I managed to create a data frame by copying the data to a
> > file named "rhelp.txt" and then running
> >
> >
> >
> > db10 <- scan(file = "rhelp.txt", what = character())
> > header <- db10[1:4]
> > db10 <- db10[-(1:4)] |> as.numeric()
> > db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
> >as.data.frame() |>
> >setNames(header)
> >
> > str(db10)
> > #> 'data.frame':25 obs. of  4 variables:
> > #>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
> > #>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
> > #>  $ role   : num  13 5 3 6 2 8 8 7 7 3 ...
> > #>  $ groupid: num  4 10 7 4 7 3 7 8 8 3 ...
> >
> >
> > And here is the data in dput format.
> >
> >
> >
> > db10 <-
> >structure(list(
> >  cp1 = c(1, 5, 3, 7, 10, 5, 2, 4, 8, 10, 9, 2,
> >  2, 20, 9, 13, 3, 4, 4, 10, 17, 8, 3, 13, 10),
> >  cp2 = c(10, 2, 1, 4, 4, 5, 6, 4, 4, 15, 15, 10,
> >  4, 2, 11, 10, 14, 2, 4, 0, 20, 18, 4, 3, 9),
> >  role = c(13, 5, 3, 6, 2, 8, 8, 7, 7, 3, 10, 5,
> >   11, 5, 3, 13, 12, 

Re: [R] (no subject)

2024-09-16 Thread Francesca
Sorry for posting a non understandable code. In my screen the dataset
looked correctly.


I recreated my dataset, folllowing your example:

test<-data.frame(matrix(c( 8,  8,  5 , 5 ,NA ,NA , 1, 15, 20,  5, NA, 17,
 2 , 5 , 5,  2 , 5 ,NA,  5 ,10, 10,  5 ,12, NA),
c( 18,  5,  5,  5, NA,  9,  2,  2, 10,  7 , 5, 19,
NA, 10, NA, 4, NA,  8, NA,  5, 10,  3, 17, NA),
c( 4, 3, 3, 2, 2, 4, 3, 3, 2, 4, 4 ,3, 4, 4, 4, 2,
2, 3, 2, 3, 3, 2, 2 ,4),
c(3, 8, 1, 2, 4, 2, 7, 6, 3, 5, 1, 3, 8, 4, 7, 5,
8, 5, 1, 2, 4, 7, 6, 6)))
colnames(test)<-c("cp1","cp2","role","groupid")

What I have done so far is the following, that works:
 test %>%
  group_by(groupid) %>%
  mutate(across(starts_with("cp"), list(mean = mean)))

But the problem is with NA: everytime the mean encounters a NA, it creates
NA for all group members.
I need the software to calculate the mean ignoring NA. So when the group is
made of three people, mean of the three.
If the group is two values and an NA, calculate the mean of two.

My code works , creates a mean at each position for three subjects,
replacing instead of the value of the single, the group mean.
But when NA appears, all the group gets NA.

Perhaps there is a different way to obtain the same result.



On Mon, 16 Sept 2024 at 11:35, Rui Barradas  wrote:

> Às 08:28 de 16/09/2024, Francesca escreveu:
> > Dear Contributors,
> > I hope someone has found a similar issue.
> >
> > I have this data set,
> >
> >
> >
> > cp1
> > cp2
> > role
> > groupid
> > 1
> > 10
> > 13
> > 4
> > 5
> > 2
> > 5
> > 10
> > 3
> > 1
> > 3
> > 7
> > 7
> > 4
> > 6
> > 4
> > 10
> > 4
> > 2
> > 7
> > 5
> > 5
> > 8
> > 3
> > 2
> > 6
> > 8
> > 7
> > 4
> > 4
> > 7
> > 8
> > 8
> > 4
> > 7
> > 8
> > 10
> > 15
> > 3
> > 3
> > 9
> > 15
> > 10
> > 2
> > 2
> > 10
> > 5
> > 5
> > 2
> > 4
> > 11
> > 20
> > 20
> > 2
> > 5
> > 12
> > 9
> > 11
> > 3
> > 6
> > 13
> > 10
> > 13
> > 4
> > 3
> > 14
> > 12
> > 6
> > 4
> > 2
> > 15
> > 7
> > 4
> > 4
> > 1
> > 16
> > 10
> > 0
> > 3
> > 7
> > 17
> > 20
> > 15
> > 3
> > 8
> > 18
> > 10
> > 7
> > 3
> > 4
> > 19
> > 8
> > 13
> > 3
> > 5
> > 20
> > 10
> > 9
> > 2
> > 6
> >
> >
> >
> > I need to to average of groups, using the values of column groupid, and
> > create a twin dataset in which the mean of the group is replaced instead
> of
> > individual values.
> > So for example, groupid 3, I calculate the mean (12+18)/2 and then I
> > replace in the new dataframe, but in the same positions, instead of 12
> and
> > 18, the values of the corresponding mean.
> > I found this solution, where db10_means is the output dataset, db10 is my
> > initial data.
> >
> > db10_means<-db10 %>%
> >group_by(groupid) %>%
> >mutate(across(starts_with("cp"), list(mean = mean)))
> >
> > It works perfectly, except that for NA values, where it replaces to all
> > group members the NA, while in some cases, the group is made of some NA
> and
> > some values.
> > So, when I have a group of two values and one NA, I would like that for
> > those with a value, the mean is replaced, for those with NA, the NA is
> > replaced.
> > Here the mean function has not the na.rm=T option associated, but it
> > appears that this solution cannot be implemented in this case. I am not
> > even sure that this would be enough to solve my problem.
> > Thanks for any help provided.
> >
> Hello,
>
> Your data is a mess, please don't post html, this is plain text only
> list. Anyway, I managed to create a data frame by copying the data to a
> file named "rhelp.txt" and then running
>
>
>
> db10 <- scan(file = "rhelp.txt", what = character())
> header <- db10[1:4]
> db10 <- db10[-(1:4)] |> as.numeric()
> db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
>as.data.frame() |>
>setNames(header)
>
> str(db10)
> #> 'data.frame':25 obs. of  4 variables:
> #>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
> #>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
> #>  $ role   : num  13 5 3 6 2 8 8 7 7 3 ...
> #>  $ groupid: num  4 10 7 4 7 3 7 8 8 3 ...
>
>
> And here is the data in dput format.
>
>
>
> db10 <-
>structure(list(
>  cp1 = c(1, 5, 3, 7, 10, 5, 2, 4, 8, 10, 9, 2,
>  2, 20, 9, 13, 3, 4, 4, 10, 17, 8, 3, 13, 10),
>  cp2 = c(10, 2, 1, 4, 4, 5, 6, 4, 4, 15, 15, 10,
>  4, 2, 11, 10, 14, 2, 4, 0, 20, 18, 4, 3, 9),
>  role = c(13, 5, 3, 6, 2, 8, 8, 7, 7, 3, 10, 5,
>   11, 5, 3, 13, 12, 15, 1, 3, 15, 10, 19, 5, 2),
>  groupid = c(4, 10, 7, 4, 7, 3, 7, 8, 8, 3, 2, 5,
>  20, 12, 6, 4, 6, 7, 16, 7, 3, 7, 8, 20, 6)),
>  class = "data.frame", row.names = c(NA, -25L))
>
>
>
> As for the problem, I am not sure if you want summarise instead of
> mutate but here is a summarise solution.
>
>
>
> library(dplyr)
>
> db10 %>%
>group_by(groupid) %>%
>summarise(across(starts_with("cp"), ~ mean(.x, na.rm = TRUE)))
>
> # same result, summarise's new argument .by avoids the need to group_by
> db10 %>%
>summaris

Re: [R] (no subject)

2024-09-16 Thread Rui Barradas

Às 08:28 de 16/09/2024, Francesca escreveu:

Dear Contributors,
I hope someone has found a similar issue.

I have this data set,



cp1
cp2
role
groupid
1
10
13
4
5
2
5
10
3
1
3
7
7
4
6
4
10
4
2
7
5
5
8
3
2
6
8
7
4
4
7
8
8
4
7
8
10
15
3
3
9
15
10
2
2
10
5
5
2
4
11
20
20
2
5
12
9
11
3
6
13
10
13
4
3
14
12
6
4
2
15
7
4
4
1
16
10
0
3
7
17
20
15
3
8
18
10
7
3
4
19
8
13
3
5
20
10
9
2
6



I need to to average of groups, using the values of column groupid, and
create a twin dataset in which the mean of the group is replaced instead of
individual values.
So for example, groupid 3, I calculate the mean (12+18)/2 and then I
replace in the new dataframe, but in the same positions, instead of 12 and
18, the values of the corresponding mean.
I found this solution, where db10_means is the output dataset, db10 is my
initial data.

db10_means<-db10 %>%
   group_by(groupid) %>%
   mutate(across(starts_with("cp"), list(mean = mean)))

It works perfectly, except that for NA values, where it replaces to all
group members the NA, while in some cases, the group is made of some NA and
some values.
So, when I have a group of two values and one NA, I would like that for
those with a value, the mean is replaced, for those with NA, the NA is
replaced.
Here the mean function has not the na.rm=T option associated, but it
appears that this solution cannot be implemented in this case. I am not
even sure that this would be enough to solve my problem.
Thanks for any help provided.


Hello,

Your data is a mess, please don't post html, this is plain text only 
list. Anyway, I managed to create a data frame by copying the data to a 
file named "rhelp.txt" and then running




db10 <- scan(file = "rhelp.txt", what = character())
header <- db10[1:4]
db10 <- db10[-(1:4)] |> as.numeric()
db10 <- matrix(db10, ncol = 4L, byrow = TRUE) |>
  as.data.frame() |>
  setNames(header)

str(db10)
#> 'data.frame':25 obs. of  4 variables:
#>  $ cp1: num  1 5 3 7 10 5 2 4 8 10 ...
#>  $ cp2: num  10 2 1 4 4 5 6 4 4 15 ...
#>  $ role   : num  13 5 3 6 2 8 8 7 7 3 ...
#>  $ groupid: num  4 10 7 4 7 3 7 8 8 3 ...


And here is the data in dput format.



db10 <-
  structure(list(
cp1 = c(1, 5, 3, 7, 10, 5, 2, 4, 8, 10, 9, 2,
2, 20, 9, 13, 3, 4, 4, 10, 17, 8, 3, 13, 10),
cp2 = c(10, 2, 1, 4, 4, 5, 6, 4, 4, 15, 15, 10,
4, 2, 11, 10, 14, 2, 4, 0, 20, 18, 4, 3, 9),
role = c(13, 5, 3, 6, 2, 8, 8, 7, 7, 3, 10, 5,
 11, 5, 3, 13, 12, 15, 1, 3, 15, 10, 19, 5, 2),
groupid = c(4, 10, 7, 4, 7, 3, 7, 8, 8, 3, 2, 5,
20, 12, 6, 4, 6, 7, 16, 7, 3, 7, 8, 20, 6)),
class = "data.frame", row.names = c(NA, -25L))



As for the problem, I am not sure if you want summarise instead of 
mutate but here is a summarise solution.




library(dplyr)

db10 %>%
  group_by(groupid) %>%
  summarise(across(starts_with("cp"), ~ mean(.x, na.rm = TRUE)))

# same result, summarise's new argument .by avoids the need to group_by
db10 %>%
  summarise(across(starts_with("cp"), ~ mean(.x, na.rm = TRUE)), .by = 
groupid)




Can you post the expected output too?

Hope this helps,

Rui Barradas


--
Este e-mail foi analisado pelo software antivírus AVG para verificar a presença 
de vírus.
www.avg.com

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


Re: [R] (no subject)

2023-01-26 Thread Hasan Diwan
Upananda.
On Mon, 16 Jan 2023 at 12:55, Upananda Pani  wrote:

> Greetings! I would like to know how to create the lag variable for my data.
>

Kindly provide a link to your data, on a publicly accessible page or a
means to generate fake data that illustrates your issue. -- H

-- 
OpenPGP: https://hasan.d8u.us/openpgp.asc
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2022-11-25 Thread Ebert,Timothy Aaron
1) Any HTML content you intended to share did not make it past the filters. All 
I get is [[alternative HTML version deleted]
2) AIC is for comparing models where lower AIC indicates a better model, though 
please see a statistics reference for additional details. No models were 
presented.
3) Distributions have quantiles. Quantiles can be calculated from data. There 
is no quantile distribution. It would not be possible to calculate quantiles 
from a function that lacked other statistical attributes (mean, median, mode, 
variance, etc...). I cannot interpret "distribution have only quantile 
function."

Please clarify the question.
Tim

-Original Message-
From: R-help  On Behalf Of ASHLIN VARKEY
Sent: Friday, November 25, 2022 1:34 AM
To: [email protected]
Subject: [R] (no subject)

[External Email]

How to calculate AIC , when the distribution have only quantile function

[[alternative HTML version deleted]]

__
[email protected] mailing list -- To UNSUBSCRIBE and more, see
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu%7C1412d0c214ca47b72c3a08dacf42af21%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638050182572115235%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=C26VbfYv6B8DJTUbgR2%2BvmlBZswHWYkDC50bG%2Bf0j5s%3D&reserved=0
PLEASE do read the posting guide 
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C1412d0c214ca47b72c3a08dacf42af21%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638050182572115235%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zD4yMbhpaLGO8p4KUHSH8quKHFmkmtwSLptF55KLeWY%3D&reserved=0
and provide commented, minimal, self-contained, reproducible code.

__
[email protected] 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] (no subject)

2022-11-07 Thread Ivan Krylov
On Sun, 6 Nov 2022 23:34:46 +
Nick Wray  wrote:

> Most of the sets work fine with MICE but with a few I get an error
> message:
> 
> This data set, which generated the error message has five columns
> 
> iter imp variable
>   1   1  986Error in terms.formula(tmp, simplify = TRUE) :
>   invalid term in model formula

Currently, there doesn't seem to be any issues [*] related to your
problem, so you could be the first to report it. (This does look like a
bug in mice; at the very least, the error message could be improved.)
How could the maintainer reproduce your problem in order to debug it?
[**]

traceback() and options(error = recover) are invaluable when trying to
find out what is going on before a crash (see ?traceback, ?recover and
?browser for more information; also the free book R Inferno [***]).

For example, if you set options(error = recover) and then reproduce the
crash, you'll be able to print(tmp) at the time of the crash and see
the term that terms.formula is having a problem with. The next step
would be finding out how this formula came to be, and so on.

>   [[alternative HTML version deleted]]

Please post in plain text to R mailing lists. This particular message
came through mostly fine, but in many cases, the plain text version
automatically generated by the sender's mailer from the user-composed
HTML version makes for very unpleasant reading.

-- 
Best regards,
Ivan

[*]
https://github.com/amices/mice/issues?q=invalid+term+in+model+formula

[**]
See also: https://www.chiark.greenend.org.uk/~sgtatham/bugs.html

[***]
https://www.burns-stat.com/documents/books/the-r-inferno/

__
[email protected] 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] (no subject)

2022-10-06 Thread Ivan Krylov
Hi Julie,

В Thu, 6 Oct 2022 10:58:51 -0400
Julie Coughlin  пишет:

> Can you send me a later version of r programming to use on my macos
> version 10.12.6? The newest r program is not compatible with my
> macbook.

Since R 4.0.0, the official builds of R require macOS ≥ 10.13. The
Homebrew project doesn't seem to have any binaries for 10.12 either,
but it should be able to build R for you:
https://formulae.brew.sh/formula/r#default

Alternatively, you can follow the guide at
https://cran.r-project.org/doc/manuals/r-release/R-admin.html and build
the source code yourself.

We have a special mailing list dedicated to Mac-related questions:
[email protected]

-- 
Best regards,
Ivan

__
[email protected] 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] (no subject)

2022-10-06 Thread Rui Barradas

Hello,

I am not a Mac user but have you tried the official R downloads web 
site, The Comprehensive R Archive Network - CRAN?

Here is the link:

https://cran.r-project.org/

Hope this helps,

Rui Barradas

Às 15:58 de 06/10/2022, Julie Coughlin escreveu:

Hi ,
Can you send me a later version of r programming to use on my macos version
10.12.6? The newest r program is not compatible with my macbook.
Thank you, Julie :)

[[alternative HTML version deleted]]

__
[email protected] 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.


__
[email protected] 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] (no subject)

2022-05-05 Thread Avi Gross via R-help
I get suspicious about patterns. A similar request from a gmail account with 
another username was made just a day ago on a Python mailing list asking about 
learning that language. That user has not responded so far to anything people 
replied. 
Hopefully this is not yet another person getting their jollies by having others 
waste their time.
I now refuse to answer overly general requests that tell us nothing about the 
background of the person and are not really about more specific aspects of the 
language. As noted, there are plenty of free resources on the Internet in text 
form and even classes as well as free library books if you live in an area  
that has them and of course books and classes you can pay for. But what works 
for a person with zero programming experience is not what someone who knows 
multiple languages already needs and so on. 
I apologize if I am wrong and see patterns where there may be none. But unless 
a new semester is starting somewhere, why would we get such requests in early 
May?
I also note the request is not limited to R but programming in general. I don't 
volunteer.


-Original Message-
From: Jeff Newmiller 
To: [email protected]; Ariyan Khayer 
Sent: Thu, May 5, 2022 7:28 pm
Subject: Re: [R] (no subject)

Sigh. You _do_ have a source... the Internet.

But to get off the dime, try https://rstudio-education.github.io/hopr. Once you 
have some familiarity with basic programming concepts in R, do read the manuals 
that come with R when you install it... and for contributed packages, vignettes 
are particularly useful.

On May 4, 2022 11:30:20 AM PDT, Ariyan Khayer  wrote:
>Hello.i was interested in learning about programming.(Especially R) but I
>do not have any source to study and learn from.can you help me with that?
>
>    [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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]]

__
[email protected] 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] (no subject)

2022-05-05 Thread Jeff Newmiller
Sigh. You _do_ have a source... the Internet.

But to get off the dime, try https://rstudio-education.github.io/hopr. Once you 
have some familiarity with basic programming concepts in R, do read the manuals 
that come with R when you install it... and for contributed packages, vignettes 
are particularly useful.

On May 4, 2022 11:30:20 AM PDT, Ariyan Khayer  wrote:
>Hello.i was interested in learning about programming.(Especially R) but I
>do not have any source to study and learn from.can you help me with that?
>
>   [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2021-11-09 Thread Arnaud FELD
Thanks for your answer. That is helpful even if that is disappointing
for me ;) I can see now that, as R (base and recommended packages) has
had contributions from a lot of people, it's not like a package, you
just can't have a punctual "okay do what you want". I'll have to stick
with a slow window call, I guess.

I was right to ask anyway, and thanks for your advices.

Le mar. 9 nov. 2021 à 22:51, Duncan Murdoch  a écrit :
>
> On 09/11/2021 3:52 p.m., Jeff Newmiller wrote:
> > I understand that, but the reason he gives for copying code from the stats 
> > package is to change the license. That decision seems like something that 
> > requires a very direct communication with/permission from the maintainer.
>
> The stats package doesn't give a valid maintainer() address.  It gives a
> vague reference to the r-project.org website, but that website doesn't
> give a contact address.
>
> In fact, the authorship of R is very widely distributed among at least
> dozens of contributors.  Identifying and contacting them all would be a
> nightmare but probably isn't necessary.  However, identifying and
> contacting the necessary ones (the ones who hold copyright on the parts
> he wants to copy) would be very difficult.  Not contacting the relevant
> ones would mean Arnaud's work would be potentially in violation of their
> copyright.
>
> Even if he did manage to contact all the copyright holders, some of them
> would probably not agree to more permissive licenses.  For example, I am
> a copyright holder on some parts of the source, and I wouldn't agree to
> relicensing.
>
> Duncan Murdoch
>
>
>
> >
> > On November 9, 2021 12:21:18 PM PST, Duncan Murdoch 
> >  wrote:
> >> On 09/11/2021 2:45 p.m., Jeff Newmiller wrote:
> >>> This question isn't a "how to do package development" question... this is 
> >>> about a specific package so you should send email to the package 
> >>> developer identified by the maintainer() function.
> >>
> >> I think Arnaud is the package developer; his question is whether he can
> >> copy R source into his package.
> >>
> >> Duncan Murdoch
> >>
> >>>
> >>> I can't foresee this request finding a positive response from R Core, but 
> >>> email seems the most correct approach.
> >>>
> >>> On November 9, 2021 11:34:12 AM PST, Bert Gunter  
> >>> wrote:
>  Questions about package development should be posted to
>  R-package-devel (**not R-devel**).
>  See https://www.r-project.org/mail.html  for details.
> 
>  (I am not sure that they get into legal weeds there, but it seems like
>  the right place to try).
> 
>  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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  
>  wrote:
> >
> > Hi,
> >
> > I use that mailing list because I’ve tried to send a message to the
> > r-core address and received :
> >
> >> "Non-members are typically *NOT* allowed to post messages to this
> >> private developers' list. Please use an appropriate mailing list (from
> >> http://www.r-project.org/mail.html). For R packages, use
> >> maintainer("") in R (and if that is R-core@.., use the R-help
> >> address).
> >
> >I would like to borrow most of the code of stats :: window within my
> > package disaggR, which has an uncompatible license as it is MIT not
> > GPL2. window has some extra overhead because of the calling of time()
> > at the beginning of the function (that is only used for extend =
> > FALSE). Copying the function and modifying it would allow me a bit of
> > optimization, but I need some agreement as my package is MIT.
> > Is it possible ?
> >
> > Thanks,
> >
> > Arnaud FELDMANN
> >
> > __
> > [email protected] 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.
> 
>  __
>  [email protected] 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.
> >>>
> >>
> >
>

__
[email protected] 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] (no subject)

2021-11-09 Thread Duncan Murdoch

On 09/11/2021 3:52 p.m., Jeff Newmiller wrote:

I understand that, but the reason he gives for copying code from the stats 
package is to change the license. That decision seems like something that 
requires a very direct communication with/permission from the maintainer.


The stats package doesn't give a valid maintainer() address.  It gives a 
vague reference to the r-project.org website, but that website doesn't 
give a contact address.


In fact, the authorship of R is very widely distributed among at least 
dozens of contributors.  Identifying and contacting them all would be a 
nightmare but probably isn't necessary.  However, identifying and 
contacting the necessary ones (the ones who hold copyright on the parts 
he wants to copy) would be very difficult.  Not contacting the relevant 
ones would mean Arnaud's work would be potentially in violation of their 
copyright.


Even if he did manage to contact all the copyright holders, some of them 
would probably not agree to more permissive licenses.  For example, I am 
a copyright holder on some parts of the source, and I wouldn't agree to 
relicensing.


Duncan Murdoch





On November 9, 2021 12:21:18 PM PST, Duncan Murdoch  
wrote:

On 09/11/2021 2:45 p.m., Jeff Newmiller wrote:

This question isn't a "how to do package development" question... this is about 
a specific package so you should send email to the package developer identified by the 
maintainer() function.


I think Arnaud is the package developer; his question is whether he can
copy R source into his package.

Duncan Murdoch



I can't foresee this request finding a positive response from R Core, but email 
seems the most correct approach.

On November 9, 2021 11:34:12 AM PST, Bert Gunter  wrote:

Questions about package development should be posted to
R-package-devel (**not R-devel**).
See https://www.r-project.org/mail.html  for details.

(I am not sure that they get into legal weeds there, but it seems like
the right place to try).

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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  wrote:


Hi,

I use that mailing list because I’ve tried to send a message to the
r-core address and received :


"Non-members are typically *NOT* allowed to post messages to this
private developers' list. Please use an appropriate mailing list (from
http://www.r-project.org/mail.html). For R packages, use
maintainer("") in R (and if that is R-core@.., use the R-help
address).


   I would like to borrow most of the code of stats :: window within my
package disaggR, which has an uncompatible license as it is MIT not
GPL2. window has some extra overhead because of the calling of time()
at the beginning of the function (that is only used for extend =
FALSE). Copying the function and modifying it would allow me a bit of
optimization, but I need some agreement as my package is MIT.
Is it possible ?

Thanks,

Arnaud FELDMANN

__
[email protected] 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.


__
[email protected] 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.








__
[email protected] 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] (no subject)

2021-11-09 Thread Jeff Newmiller
I understand that, but the reason he gives for copying code from the stats 
package is to change the license. That decision seems like something that 
requires a very direct communication with/permission from the maintainer.

On November 9, 2021 12:21:18 PM PST, Duncan Murdoch  
wrote:
>On 09/11/2021 2:45 p.m., Jeff Newmiller wrote:
>> This question isn't a "how to do package development" question... this is 
>> about a specific package so you should send email to the package developer 
>> identified by the maintainer() function.
>
>I think Arnaud is the package developer; his question is whether he can 
>copy R source into his package.
>
>Duncan Murdoch
>
>> 
>> I can't foresee this request finding a positive response from R Core, but 
>> email seems the most correct approach.
>> 
>> On November 9, 2021 11:34:12 AM PST, Bert Gunter  
>> wrote:
>>> Questions about package development should be posted to
>>> R-package-devel (**not R-devel**).
>>> See https://www.r-project.org/mail.html  for details.
>>>
>>> (I am not sure that they get into legal weeds there, but it seems like
>>> the right place to try).
>>>
>>> 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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  
>>> wrote:

 Hi,

 I use that mailing list because I’ve tried to send a message to the
 r-core address and received :

> "Non-members are typically *NOT* allowed to post messages to this
> private developers' list. Please use an appropriate mailing list (from
> http://www.r-project.org/mail.html). For R packages, use
> maintainer("") in R (and if that is R-core@.., use the R-help
> address).

   I would like to borrow most of the code of stats :: window within my
 package disaggR, which has an uncompatible license as it is MIT not
 GPL2. window has some extra overhead because of the calling of time()
 at the beginning of the function (that is only used for extend =
 FALSE). Copying the function and modifying it would allow me a bit of
 optimization, but I need some agreement as my package is MIT.
 Is it possible ?

 Thanks,

 Arnaud FELDMANN

 __
 [email protected] 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.
>>>
>>> __
>>> [email protected] 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.
>> 
>

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2021-11-09 Thread Duncan Murdoch

On 09/11/2021 2:45 p.m., Jeff Newmiller wrote:

This question isn't a "how to do package development" question... this is about 
a specific package so you should send email to the package developer identified by the 
maintainer() function.


I think Arnaud is the package developer; his question is whether he can 
copy R source into his package.


Duncan Murdoch



I can't foresee this request finding a positive response from R Core, but email 
seems the most correct approach.

On November 9, 2021 11:34:12 AM PST, Bert Gunter  wrote:

Questions about package development should be posted to
R-package-devel (**not R-devel**).
See https://www.r-project.org/mail.html  for details.

(I am not sure that they get into legal weeds there, but it seems like
the right place to try).

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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  wrote:


Hi,

I use that mailing list because I’ve tried to send a message to the
r-core address and received :


"Non-members are typically *NOT* allowed to post messages to this
private developers' list. Please use an appropriate mailing list (from
http://www.r-project.org/mail.html). For R packages, use
maintainer("") in R (and if that is R-core@.., use the R-help
address).


  I would like to borrow most of the code of stats :: window within my
package disaggR, which has an uncompatible license as it is MIT not
GPL2. window has some extra overhead because of the calling of time()
at the beginning of the function (that is only used for extend =
FALSE). Copying the function and modifying it would allow me a bit of
optimization, but I need some agreement as my package is MIT.
Is it possible ?

Thanks,

Arnaud FELDMANN

__
[email protected] 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.


__
[email protected] 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.




__
[email protected] 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] (no subject)

2021-11-09 Thread Duncan Murdoch

On 09/11/2021 8:27 a.m., Arnaud FELD wrote:

Hi,

I use that mailing list because I’ve tried to send a message to the
r-core address and received :


"Non-members are typically *NOT* allowed to post messages to this
private developers' list. Please use an appropriate mailing list (from
http://www.r-project.org/mail.html). For R packages, use
maintainer("") in R (and if that is R-core@.., use the R-help
address).


  I would like to borrow most of the code of stats :: window within my
package disaggR, which has an uncompatible license as it is MIT not
GPL2. window has some extra overhead because of the calling of time()
at the beginning of the function (that is only used for extend =
FALSE). Copying the function and modifying it would allow me a bit of
optimization, but I need some agreement as my package is MIT.
Is it possible ?


I would assume not.  Most of R has many, many authors, and some of us 
will not agree to changing the license to a more permissive form.


Duncan Murdoch

__
[email protected] 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] (no subject)

2021-11-09 Thread Jeff Newmiller
This question isn't a "how to do package development" question... this is about 
a specific package so you should send email to the package developer identified 
by the maintainer() function.

I can't foresee this request finding a positive response from R Core, but email 
seems the most correct approach.

On November 9, 2021 11:34:12 AM PST, Bert Gunter  wrote:
>Questions about package development should be posted to
>R-package-devel (**not R-devel**).
>See https://www.r-project.org/mail.html  for details.
>
>(I am not sure that they get into legal weeds there, but it seems like
>the right place to try).
>
>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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  wrote:
>>
>> Hi,
>>
>> I use that mailing list because I’ve tried to send a message to the
>> r-core address and received :
>>
>> >"Non-members are typically *NOT* allowed to post messages to this
>> >private developers' list. Please use an appropriate mailing list (from
>> >http://www.r-project.org/mail.html). For R packages, use
>> >maintainer("") in R (and if that is R-core@.., use the R-help
>> >address).
>>
>>  I would like to borrow most of the code of stats :: window within my
>> package disaggR, which has an uncompatible license as it is MIT not
>> GPL2. window has some extra overhead because of the calling of time()
>> at the beginning of the function (that is only used for extend =
>> FALSE). Copying the function and modifying it would allow me a bit of
>> optimization, but I need some agreement as my package is MIT.
>> Is it possible ?
>>
>> Thanks,
>>
>> Arnaud FELDMANN
>>
>> __
>> [email protected] 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.
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2021-11-09 Thread Bert Gunter
Questions about package development should be posted to
R-package-devel (**not R-devel**).
See https://www.r-project.org/mail.html  for details.

(I am not sure that they get into legal weeds there, but it seems like
the right place to try).

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 Tue, Nov 9, 2021 at 11:17 AM Arnaud FELD  wrote:
>
> Hi,
>
> I use that mailing list because I’ve tried to send a message to the
> r-core address and received :
>
> >"Non-members are typically *NOT* allowed to post messages to this
> >private developers' list. Please use an appropriate mailing list (from
> >http://www.r-project.org/mail.html). For R packages, use
> >maintainer("") in R (and if that is R-core@.., use the R-help
> >address).
>
>  I would like to borrow most of the code of stats :: window within my
> package disaggR, which has an uncompatible license as it is MIT not
> GPL2. window has some extra overhead because of the calling of time()
> at the beginning of the function (that is only used for extend =
> FALSE). Copying the function and modifying it would allow me a bit of
> optimization, but I need some agreement as my package is MIT.
> Is it possible ?
>
> Thanks,
>
> Arnaud FELDMANN
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2021-10-06 Thread Bert Gunter
Perhaps it's R packages and the security policies -- checks for malicious
software, etc. -- of the repositories on which they reside that Thomas
should be concerned with. R, itself, is fine(checksums are provided), but,
as you say, can be programmed to do anything. So R packages can certainly
do damage. For CRAN, at least, I believe it's download at your own risk.
Presumably, virus checking capabilities at the local level could check all
such downloads, as per usual.

Correction and clarification of any of the above welcome of course.

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 Wed, Oct 6, 2021 at 2:53 AM Ivan Krylov  wrote:

> On Tue, 5 Oct 2021 22:20:33 +
> Thomas Subia  wrote:
>
> > Some co-workers are wondering about how secure R software is.
>
> I'm afraid that this question is too hard to answer without their
> threat model. Secure against what, specifically?
>
> > Is there any documentation on this which I can forward to them?
>
> Well, R is a programming language. It's Turing-complete (see halting
> problem), will happily run machine code from shared objects (see
> dyn.load, .C, .Call), and install.packages() is there to download
> third-party code from the Internet. But that's the case with all
> programming languages I know that are used for statistics, which aren't
> supposed to run untrusted code.
>
> Maybe you're concerned about data input/output instead. Functions are
> first-class objects, so it's possible to save and load them from data
> files. Not sure if there's a way to run code on data load, but you can
> do it on print() (e.g. print.nls(x) calling x$m$getAllPars()), so don't
> load()/readRDS() untrusted data files. There are known bugs in the
> deserialiser, too: https://bugs.r-project.org/show_bug.cgi?id=16034
>
> Don't know if it's documented anywhere, though. What are your
> co-workers concerned about?
>
> --
> Best regards,
> Ivan
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2021-10-06 Thread Ivan Krylov
On Tue, 5 Oct 2021 22:20:33 +
Thomas Subia  wrote:

> Some co-workers are wondering about how secure R software is.

I'm afraid that this question is too hard to answer without their
threat model. Secure against what, specifically?

> Is there any documentation on this which I can forward to them?

Well, R is a programming language. It's Turing-complete (see halting
problem), will happily run machine code from shared objects (see
dyn.load, .C, .Call), and install.packages() is there to download
third-party code from the Internet. But that's the case with all
programming languages I know that are used for statistics, which aren't
supposed to run untrusted code.

Maybe you're concerned about data input/output instead. Functions are
first-class objects, so it's possible to save and load them from data
files. Not sure if there's a way to run code on data load, but you can
do it on print() (e.g. print.nls(x) calling x$m$getAllPars()), so don't
load()/readRDS() untrusted data files. There are known bugs in the
deserialiser, too: https://bugs.r-project.org/show_bug.cgi?id=16034

Don't know if it's documented anywhere, though. What are your
co-workers concerned about?

-- 
Best regards,
Ivan

__
[email protected] 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] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-12 01:14 +0500, Anas Jamshed wrote:
> On Sat, Dec 12, 2020 at 1:12 AM Rasmus Liland wrote:
> >
> > Anas Jamshed,
> >
> > I do not need to explain why I am tired
> > at all.  Not at all.
> 
> but plz try to help me

Once upon a midnight dreary, while I pondered, weak and weary,
Over many a quaint and curious volume of forgotten lore—
While I nodded, nearly napping, suddenly there came a tapping,
As of some one gently rapping, rapping at my chamber door.
“’Tis some visitor,” I muttered, “tapping at my chamber door—
Only this and nothing more.”

Ah, distinctly I remember it was in the bleak December;
And each separate dying ember wrought its ghost upon the floor.
Eagerly I wished the morrow;—vainly I had sought to borrow
From my books surcease of sorrow—sorrow for the lost Lenore—
For the rare and radiant maiden whom the angels name Lenore—
Nameless here for evermore.

And the silken, sad, uncertain rustling of each purple curtain
Thrilled me—filled me with fantastic terrors never felt before;
So that now, to still the beating of my heart, I stood repeating
“’Tis some visitor entreating entrance at my chamber door—
Some late visitor entreating entrance at my chamber door;—
This it is and nothing more.”

Presently my soul grew stronger; hesitating then no longer,
“Sir,” said I, “or Madam, truly your forgiveness I implore;
But the fact is I was napping, and so gently you came rapping,
And so faintly you came tapping, tapping at my chamber door,
That I scarce was sure I heard you”—here I opened wide the door;—
Darkness there and nothing more.

Deep into that darkness peering, long I stood there wondering, fearing,
Doubting, dreaming dreams no mortal ever dared to dream before;
But the silence was unbroken, and the stillness gave no token,
And the only word there spoken was the whispered word, “Lenore?”
This I whispered, and an echo murmured back the word, “Lenore!”—
Merely this and nothing more.

Back into the chamber turning, all my soul within me burning,
Soon again I heard a tapping somewhat louder than before.
“Surely,” said I, “surely that is something at my window lattice;
  Let me see, then, what thereat is, and this mystery explore—
Let my heart be still a moment and this mystery explore;—
’Tis the wind and nothing more!”

Open here I flung the shutter, when, with many a flirt and flutter,
In there stepped a stately Raven of the saintly days of yore;
Not the least obeisance made he; not a minute stopped or stayed he;
But, with mien of lord or lady, perched above my chamber door—
Perched upon a bust of Pallas just above my chamber door—
Perched, and sat, and nothing more.

Then this ebony bird beguiling my sad fancy into smiling,
By the grave and stern decorum of the countenance it wore,
“Though thy crest be shorn and shaven, thou,” I said, “art sure no craven,
Ghastly grim and ancient Raven wandering from the Nightly shore—
Tell me what thy lordly name is on the Night’s Plutonian shore!”
Quoth the Raven “Nevermore.”

Much I marvelled this ungainly fowl to hear discourse so plainly,
Though its answer little meaning—little relevancy bore;
For we cannot help agreeing that no living human being
Ever yet was blessed with seeing bird above his chamber door—
Bird or beast upon the sculptured bust above his chamber door,
With such name as “Nevermore.”

But the Raven, sitting lonely on the placid bust, spoke only
That one word, as if his soul in that one word he did outpour.
Nothing farther then he uttered—not a feather then he fluttered—
Till I scarcely more than muttered “Other friends have flown before—
On the morrow he will leave me, as my Hopes have flown before.”
Then the bird said “Nevermore.”

Startled at the stillness broken by reply so aptly spoken,
“Doubtless,” said I, “what it utters is its only stock and store
Caught from some unhappy master whom unmerciful Disaster
Followed fast and followed faster till his songs one burden bore—
Till the dirges of his Hope that melancholy burden bore
Of ‘Never—nevermore’.”

But the Raven still beguiling all my fancy into smiling,
Straight I wheeled a cushioned seat in front of bird, and bust and door;
Then, upon the velvet sinking, I betook myself to linking
Fancy unto fancy, thinking what this ominous bird of yore—
What this grim, ungainly, ghastly, gaunt, and ominous bird of yore
Meant in croaking “Nevermore.”

This I sat engaged in guessing, but no syllable expressing
To the fowl whose fiery eyes now burned into my bosom’s core;
This and more I sat divining, with my head at ease reclining
On the cushion’s velvet lining that the lamp-light gloated o’er,
But whose velvet-violet lining with the lamp-light gloating o’er,
She shall press, ah, nevermore!

Then, metho

Re: [R] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 22:19 +0500, Anas Jamshed wrote:
> On Fri, Dec 11, 2020 at 10:17 PM Rasmus Liland wrote:
> >
> > Sorry, I think I am too tired atm.  I
> > took this pneumonia vaccine, and it
> > really banged me up you know ...
> >
> > Maybe someone else can row this ship
> > ashore again ...
> 
> why you are tired?

Anas Jamshed,

I do not need to explain why I am tired 
at all.  Not at all.

__
[email protected] 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] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 22:09 +0500, Anas Jamshed wrote:
> On Fri, Dec 11, 2020 at 9:51 PM Rasmus Liland wrote:
> >
> > Say, how do I create fit3, eset, design,
> > etc. ...
> >
> > R
> 
> library(oligo)
> if (!requireNamespace("BiocManager", quietly = TRUE))
> install.packages("BiocManager")
> BiocManager::install("pd.hg.u133.plus.2")
> list.celfiles()
> setwd("C:/Users/USER/Desktop/RNA_Seq")
> list.celfiles()
> names = list.celfiles()
> array = read.celfiles(names)
> array
> eset = rma(array)
> write.exprs(eset, file = "data_normalized.txt") #this will be your
> normalized data by rma
> eset
> targets<-read.delim(file="targets.txt", header=T)
> targets<-read.delim(file="E-MTAB-5716.sdrf.txt", header=T)
> targets
> 
> eset <- eset[[idx]]
> 
> design <- model.matrix(~0+ eset)
> design
> fit <- lmFit(eset, design)
> fit
> 
> cont.matrix <- makeContrasts(eset, levels=design)
> fit2 <- contrasts.fit(fit, cont.matrix)
> fit2
> fit3 <- eBayes(fit2, 0.01)
> fit3
> tT <- topTable(fit3, adjust="fdr", sort.by="B", number=1250)
> tT

Sorry, I think I am too tired atm.  I 
took this pneumonia vaccine, and it 
really banged me up you know ...

Maybe someone else can row this ship 
ashore again ...

R

__
[email protected] 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] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 21:04 +0500, Anas Jamshed wrote:
> On Fri, Dec 11, 2020 at 9:03 PM Anas Jamshed wrote:
> > On Fri, Dec 11, 2020 at 8:37 PM Rasmus Liland wrote:
> > >
> > > I think that's too many unspecific lines
> > > and too large files directly here on
> > > email (24MiB!).
> > >
> > > Would you please narrow down your
> > > question.
> >
> > E-MTAB is an original sample data file and another one is normalized data
> > file  but I don't know why I get just one gene(up reg) when I apply top
> > table and decide test function
> > results<-decideTests(fit3,adjust.method="fdr",p=0.05)
> > results
> > summary(results)
> > cont.matrix <- makeContrasts(eset, levels=design)
> > fit.cont <- contrasts.fit(fit, cont.matrix)
> > fit.cont
> > fit.cont<- eBayes(fit.cont)
> > fit.cont
> > results<-decideTests(fit.cont,adjust.method="fdr",p=0.001)
> 
> [image: image.png]

Say, how do I create fit3, eset, design, 
etc. ...

R

__
[email protected] 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] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 20:14 +0500, Anas Jamshed wrote:
> On Fri, Dec 11, 2020 at 7:49 PM Rasmus Liland  wrote:
> 
> > On 2020-12-11 19:16 +0500, Anas Jamshed wrote:
> > > On Fri, Dec 11, 2020 at 6:37 PM Rasmus Liland wrote:
> > > > On 2020-12-11 18:08 +0500, Anas Jamshed wrote:
> > > > >
> > > >
> > > > Anas Jamshed,
> > > >
> > > > I found this
> > > >
> > > > https://support.bioconductor.org/p/130817/
> > > >
> > > > maybe it helps ...
> > >
> > > still have the problem in 2nd error
> > >
> > > > > Also when i tried to:
> > > > >
> > > > > #Load the target files which the information about the sample and
> > > > > their corresponding group by
> > > > >
> > > > > targets<-read.delim(file="targets.txt", header=T)and create design
> > and
> > > > > fit the design by
> > > > > design <- model.matrix(~0+ conditions)
> > > > >
> > > > > It gives me the error :
> > > > >
> > > > > Error in model.frame.default(object, data, xlev = xlev) :
> > > > >   invalid type (closure) for variable 'conditions'
> >
> > Glad my suggestion helped.
> >
> > Do state how you solved that for someone
> > else to find it another time (maybe
> > yourself even ... ).
> >
> > One problem at a time ... pocito pocito
> > ...
> >
> > Read here or something
> >
> > https://stackoverflow.com/questions/33023508/why-am-i-getting-the-error-invalid-type-closure
> > ...
> >
> > > https://postimg.cc/1fKPj1xg
> >
> > Right, it says the object is not a
> > matrix ... there is a flag there called
> > «data,» perhaps look into specifying you
> > matrix there ...
> >
> > It would be more helpful for me as a
> > helper if you stated your problem in a
> > small example code snippet, instead of
> > just the error.  I might lack the
> > sufficient amount of teaching emphathy
> > there to se clearly through images and
> > error messages from a distance.  E.g.
> > use dput to paste some small dataset
> > here ...
> >
> > R
> 
> E-MTAB is an original sample data file and another one is normalized data
> file  but I don't know why I get just one gene(up reg) when I apply top
> table and decide test function
> 
> My R history file is :
> library(oligo)
> if (!requireNamespace("BiocManager", quietly = TRUE))
> install.packages("BiocManager")
> BiocManager::install("pd.hg.u133.plus.2")
> list.celfiles()
> setwd("C:/Users/USER/Desktop/RNA_Seq")
> list.celfiles()
> names = list.celfiles()
> array = read.celfiles(names)
> array
> eset = rma(array)
> write.exprs(eset, file = "data_normalized.txt") #this will be your
> normalized data by rma
> eset
> targets<-read.delim(file="targets.txt", header=T)
> targets<-read.delim(file="E-MTAB-5716.sdrf.txt", header=T)
> targets
> design <- model.matrix(~0+ conditions)
> fit <- lmFit(eset, design)
> fit <- lmFit(eset, targets)
> design <- model.matrix(~ description + 0, gset)
> design
> fit <- lmFit(eset, design)
> targets$Source.Name <-fl
> targets$Source.Name <-fl
> targets$Source.Name <-f1
> sml <- paste("G", sml, sep="")
> targets$Source.Name
> design <- model.matrix(~ description + 0, eset)
> design <- model.matrix(~ targets + 0, eset)
> design <- model.matrix(~ targets + 0, conditions())
> design <- model.matrix(~ targets + 0, conditions)
> design <- model.matrix(~0+ conditions)
> design <- model.matrix(~ description + 0 + conditions)
> design <- model.matrix(~ description + 0 , conditions)
> design <- model.matrix(~ description + 0, gset)
> design <- model.matrix(~ description + 0, eset)
> design <- model.matrix(~ targets + 0, eset)
> targets$Source.Name
> design <- model.matrix(~ Source.Name + 0, eset)
> design <- model.matrix(~ Source + 0, eset)
> gset
> gset$description
> eset <- eset[[idx]]
> eset
> design <- model.matrix(~ description + 0, eset)
> fvarLabels(eset) <- make.names(fvarLabels(eset))
> gsms <- paste0("00XXX1",
> "11XXX")
> sml <- c()
> for (i in 1:nchar(gsms)) { sml[i] <- substr(gsms,i,i) }
> make.names()
> fvarLabels(eset) <- make.names(fvarLabels(eset))
> sel <- which(sml != "X")
> sml <- sml[sel]
> gset <- eset[ ,sel]
> eset
> design <- model.matrix(~0+ conditions)
> design <- model.matrix(~0+ eset)
> design
> fit <- lmFit(eset, design)
> fit
> contrast.matrix <- makeContrasts(group1=condition1-control,
> group2=condition2-control, levels = design)
> fit
> cont.matrix <- makeContrasts(G1-G0, levels=design)
> sml <- paste("G", sml, sep="")# set group names
> fl <- as.factor(sml)
> sml
> cont.matrix <- makeContrasts(G1-G0, levels=design)
> design
> gset
> design
> cont.matrix <- makeContrasts(eset, levels=design)
> fit2 <- contrasts.fit(fit, cont.matrix)
> fit2
> fit3 <- eBayes(fit2, 0.01)
> fit3
> tT <- topTable(fit3, adjust="fdr", sort.by="B", number=1250)
> tT
> tT <- topTable(fit3, adjust="fdr", sort.by="B", number=50)
> tT
> tT <- topTable(fit3, adjust="fdr", sort.by="B", number=50,p=0.05)
> tT
> fit.cont <- contrasts.fit(fit, contrast.matrix)
> fit.cont <- contrasts.fit(fit, contrast.matrix)
> fit.cont <- contrasts.fit(fit2, 

Re: [R] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 19:16 +0500, Anas Jamshed wrote:
> On Fri, Dec 11, 2020 at 6:37 PM Rasmus Liland wrote:
> > On 2020-12-11 18:08 +0500, Anas Jamshed wrote:
> > >
> >
> > Anas Jamshed,
> >
> > I found this
> >
> > https://support.bioconductor.org/p/130817/
> >
> > maybe it helps ...
> 
> still have the problem in 2nd error
> 
> > > Also when i tried to:
> > >
> > > #Load the target files which the information about the sample and
> > > their corresponding group by
> > >
> > > targets<-read.delim(file="targets.txt", header=T)and create design and
> > > fit the design by
> > > design <- model.matrix(~0+ conditions)
> > >
> > > It gives me the error :
> > >
> > > Error in model.frame.default(object, data, xlev = xlev) :
> > >   invalid type (closure) for variable 'conditions'

Glad my suggestion helped.  

Do state how you solved that for someone 
else to find it another time (maybe 
yourself even ... ).

One problem at a time ... pocito pocito 
... 

Read here or something 
https://stackoverflow.com/questions/33023508/why-am-i-getting-the-error-invalid-type-closure
...

> https://postimg.cc/1fKPj1xg

Right, it says the object is not a 
matrix ... there is a flag there called 
«data,» perhaps look into specifying you 
matrix there ... 

It would be more helpful for me as a 
helper if you stated your problem in a 
small example code snippet, instead of 
just the error.  I might lack the 
sufficient amount of teaching emphathy 
there to se clearly through images and 
error messages from a distance.  E.g. 
use dput to paste some small dataset 
here ... 

R

__
[email protected] 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] (no subject)

2020-12-11 Thread Rasmus Liland
On 2020-12-11 18:08 +0500, Anas Jamshed wrote:
> when I tried to install oligo package by
> 
> if (!requireNamespace("BiocManager", quietly = TRUE))
> 
> install.packages("BiocManager")
> 
> BiocManager::install("oligo
> 
> It gives me the following eroor:
> 
> Warning messages:
> 1: In file.copy(savedcopy, lib, recursive = TRUE) :
>   problem copying
> C:\Users\USER\Documents\R\win-library\4.0\00LOCK\bit\libs\x64\bit.dll
> to C:\Users\USER\Documents\R\win-library\4.0\bit\libs\x64\bit.dll:
> Permission denied
> 2: In file.copy(savedcopy, lib, recursive = TRUE) :
>   problem copying
> C:\Users\USER\Documents\R\win-library\4.0\00LOCK\matrixStats\libs\x64\matrixStats.dll
> to 
> C:\Users\USER\Documents\R\win-library\4.0\matrixStats\libs\x64\matrixStats.dll:
> Permission denied
> 
> Also when i tried to:
> 
> #Load the target files which the information about the sample and
> their corresponding group by
> 
> targets<-read.delim(file="targets.txt", header=T)and create design and
> fit the design by
> design <- model.matrix(~0+ conditions)
> 
> It gives me the error :
> 
> Error in model.frame.default(object, data, xlev = xlev) :
>   invalid type (closure) for variable 'conditions'

Anas Jamshed,

I found this

https://support.bioconductor.org/p/130817/

maybe it helps ...

Best,
Rasmus Liland

__
[email protected] 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] (no subject)

2020-10-01 Thread Peter Dalgaard
Then please follow the link in the footer. Other recipients can't help you.


> On 1 Oct 2020, at 09:30 , Marte Lilleeng  wrote:
> 
> I want to unsubscribe from this list.
> 
> -- 
> Mvh Marte Synnøve Lilleeng
> tlf 97 74 38 12
> 
>   [[alternative HTML version deleted]]
> 
> __
> [email protected] 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [email protected]  Priv: [email protected]

__
[email protected] 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] (no subject)

2020-05-14 Thread Ivan Krylov
Dear Luigi,

These questions (and your previous one about R on Chromebook) are best
directed to the R-SIG-Debian mailing list [*], or maybe Ubuntu forums
[**]. I think that they are off-topic here on R-help.

Here is a short advice: try to make sure that you have the
r-recommended package installed from CRAN, not Ubuntu repository. If
that doesn't help, try to raise the priority [***] of packages from the
CRAN repository in order to avoid them being superseded by Ubuntu
packages. Another workaround would be removing the *.deb kernsmooth and
nnet packages from the system and installing them manually from CRAN in
the personal library by means of install.packages().

>   [[alternative HTML version deleted]]

Please don't post in HTML (see link to posting guide below).

-- 
Best regards,
Ivan

[*] https://stat.ethz.ch/mailman/listinfo/r-sig-debian
[**] https://ubuntuforums.org/
[***] https://jaqque.sbih.org/kplug/apt-pinning.html

__
[email protected] 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] (no subject)

2020-03-08 Thread Eric Berger
I have no experience with these packages/libraries. I did a Google search
on 'R interface for G@RCH' and there seemed to be a number of relevant
hits, such as

https://faculty.chicagobooth.edu/ruey.tsay/teaching/bs41202/sp2009/G@RCH_info.txt


HTH,
Eric


On Sun, Mar 8, 2020 at 12:42 PM Jim Lemon  wrote:

> Hi Meryem,
> It seems that OxMetrics is the underlying environment for G@RCH and
> OxConsole (command line) is free for academic use.
> (https://www.doornik.com/products.html). A quick glance didn't reveal
> any interface for R.
>
> Jim
>
> On Sun, Mar 8, 2020 at 9:27 PM meryem khanniji
>  wrote:
> >
> > Hello to all  R users' , I need to get the Ox interface in R, can anyone
> > help me to know if the garchOxfit is still working .
> > Also i want to know if there is a way to get G@RCH package.
> > Thanks in advance
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > [email protected] 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.
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2020-03-08 Thread Jim Lemon
Hi Meryem,
It seems that OxMetrics is the underlying environment for G@RCH and
OxConsole (command line) is free for academic use.
(https://www.doornik.com/products.html). A quick glance didn't reveal
any interface for R.

Jim

On Sun, Mar 8, 2020 at 9:27 PM meryem khanniji
 wrote:
>
> Hello to all  R users' , I need to get the Ox interface in R, can anyone
> help me to know if the garchOxfit is still working .
> Also i want to know if there is a way to get G@RCH package.
> Thanks in advance
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2020-01-20 Thread Jeff Newmiller
Per the Posting Guide... stop sending HTML-formatted email to this mailing 
list. The formatting gets stripped out anyway and introduces confusion. Gmail 
_has_ this option, but you must specify it before you send the email.

Also, try to use Reply-all when discussing the same topic to keep related 
emails together.

On January 20, 2020 6:40:43 AM PST, Paul Bernal  wrote:
>Example of conversion to decimal of a signed binary number in two's
>complement representation
>
>Let's convert to decimal the following signed binary number: 10110010
>10110010 = -1×27 + 0×26 + 1×25 + 1×24 + 0×23 + 0×22 + 1×21 + 0×20 =
>-128 +
>32 + 16 + 2 = -78.
>
>that operation ilvoves base 2 raised to the 7th, 6th, 5th,  and 0th
>power. Only the first one has a minus one multiplying. The  first one
>is
>multiplied by a 2 raised to the seventh power because powers goe from
>right
>to left, starting from zero, all the way to the leftmost integer.
>
>Thank you so much for your valuable help,
>
>Cheers,
>
>Paul
>
>   [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2020-01-20 Thread Jeff Newmiller
Per the Posting Guide... stop sending HTML-formatted email to this mailing 
list. The formatting gets stripped out anyway and introduces confusion. Gmail 
_has_ this option, but you must specify it before you send the email.

Also, try to use Reply-all when discussing the same topic to keep related 
emails together.

On January 20, 2020 6:40:43 AM PST, Paul Bernal  wrote:
>Example of conversion to decimal of a signed binary number in two's
>complement representation
>
>Let's convert to decimal the following signed binary number: 10110010
>10110010 = -1×27 + 0×26 + 1×25 + 1×24 + 0×23 + 0×22 + 1×21 + 0×20 =
>-128 +
>32 + 16 + 2 = -78.
>
>that operation ilvoves base 2 raised to the 7th, 6th, 5th,  and 0th
>power. Only the first one has a minus one multiplying. The  first one
>is
>multiplied by a 2 raised to the seventh power because powers goe from
>right
>to left, starting from zero, all the way to the leftmost integer.
>
>Thank you so much for your valuable help,
>
>Cheers,
>
>Paul
>
>   [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2019-11-05 Thread David Winsemius
This question is off-topic for rhelp despite your use of an R package 
because it is a request for advice for statistical issues, rather than 
about R coding. You should read the Posting guide where you are advised 
of this concern. You are also asked to post in plain text and include an 
informative subject line. There are other venues for statistical advice 
such as stats.stackexchange.com and there is also the possibility that 
the package author or maintainer might respond to a polite email.



--

David.

On 11/5/19 4:23 AM, imran damkar wrote:

Greetings,
I have collected the data based on 5 point likert scale(very low, low,
neutral, high,very high) on the factor considered by individual before
making investment decision. There are five factors (D.Vs) Influencing
investment decisions. I am interested in knowing whether there is
significant difference in preference level of male and female(IVs) for the
above said factors.Number of males are 252 and females 98. I have applied
Permutational Manova in adonis function of R, since data are ordinal in
nature, and result is non significant. I have read in literature that
permutation test is non parametric in nature. Does for the permutation test
equality of variance is highly important. Also the computation of mean, S.
D and variance are discouraged by many scholars for ordinal data.
Pls through some light of permutation test and it’s assumption and
violation of it. And if in case PERMANAVO is not suitable for my data then
please suggest appropriate alternative.
Shall be highly obliged.
Thanks

[[alternative HTML version deleted]]

__
[email protected] 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.


__
[email protected] 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] (no subject)

2019-11-04 Thread Kevin Thorpe
Have you read the help pages of the two functions? That is where I would start.

-- 
Kevin E. Thorpe
Head of Biostatistics,  Applied Health Research Centre (AHRC)
Li Ka Shing Knowledge Institute of St. Michael's
Assistant Professor, Dalla Lana School of Public Health
University of Toronto
email: [email protected]  Tel: 416.864.5776  Fax: 416.864.3016
 

On 2019-11-04, 1:47 PM, "R-help on behalf of imran damkar" 
 wrote:

Hi,
I would like to know what is the difference between function oneway_test
and independence_test of coin package.
You will highly appreciated
Regards

[[alternative HTML version deleted]]

__
[email protected] 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.


__
[email protected] 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] (no subject)

2019-02-11 Thread Adrian Johnson
Pardon me, I forgot to add subject line.
-Adrian.

On Sun, Feb 10, 2019 at 3:49 PM Adrian Johnson
 wrote:
>
> Dear group,
>
> I have two large matrices.
>
> Matrix one: is 24776 x 76 (example toy1 dput object given below)
>
> Matrix two: is 12913 x 76 (example toy2 dput object given below)
>
> Column names of both matrices are identical.
>
> My aim is:
>
> a. Take each row of toy2 and transform vector into UP (>0)  and DN (
> <0 ) categories. (kc)
> b  Test association between kc and every row of toy1.
>
> My code, given below, although this works but is very slow.
>
> I gave dput objects for toy1, toy2 and result matrix.
>
> Could you suggest/help me how I can make this faster.  Also, how can I
> select values in result column that are less than 0.001 (p < 0.001).
>
> Appreciate your help. Thank you.
>
> Code:
> ===
>
>
>
> result <- matrix(NA,nrow=nrow(toy1),ncol=nrow(toy2))
>
> rownames(result) <- rownames(toy1)
> colnames(result) <- rownames(toy2)
>
> for(i in 1:nrow(toy2)){
> for(j in 1:nrow(toy1)){
> kx = toy2[i,]
> kc <- rep('NC',length(kx))
> kc[ kx >0] <- 'UP'
> kc[ kx <=0 ] <- 'DN'
> xpv <- fisher.test(table(kc,toy1[j,]),simulate.p.value = TRUE)$p.value
> result[j,i] <- xpv
> }
> }
>
> ===
>
>
> ===
>
>
> > dput(toy1)
> structure(c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1,
> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
> -1, -1, -1, -1, -1), .Dim = c(10L, 7L), .Dimnames = list(c("ACAP3",
> "ACTRT2", "AGRN", "ANKRD65", "ATAD3A", "ATAD3B", "ATAD3C", "AURKAIP1",
> "B3GALT6", "C1orf159"), c("a", "b", "c", "d", "e", "f", "g")))
>
>
>
> > dput(toy2)
> structure(c(-0.242891119688613, -0.0514058216682132, 0.138447212993773,
> -0.312576648033122, 0.271489918720452, -0.281196468299486, 
> -0.0407160143344565,
> -0.328353812845287, 0.151667836674511, 0.408596843743938, -0.049351944902924,
> 0.238586287349249, 0.200571558784821, -0.0737604184858411, 0.245971526254877,
> 0.24740263959845, -0.161528943131908, 0.197521973013793, 0.0402668125708444,
> 0.376323735212088, 0.0731550871764204, 0.385270176969893, 0.28953042756208,
> 0.062587289401188, -0.281187168932979, -0.0202298984561554, 
> -0.0848696970309447,
> 0.0349676726358973, -0.520484215644868, -0.481991414222996,
> -0.00698099201388211,
> 0.135503878341873, 0.156983081312087, 0.320223832092661, 0.34582193394074,
> 0.0844455960468667, -0.157825604090972, 0.204758250510969, 0.261796072978612,
> -0.19510450641405, 0.43196474472874, -0.211155577453175, -0.0921641871215187,
> 0.420950361292263, 0.390261862151936, -0.422273930504427, 0.344653684951627,
> 0.0378273248838503, 0.197782027324611, 0.0963124876309569, 0.332093167080656,
> 0.128036554821915, -0.41338065859335, -0.409470440033177, 0.371490567256253,
> -0.0912549189140141, -0.247451812684234, 0.127741739114639, 
> 0.0856254238844557,
> 0.515282940316031, -0.25675759521248, 0.333943163209869, 0.604141413840881,
> 0.0824942299510931, -0.179605710473021, -0.275604207054643, 
> -0.113251154591898,
> 0.172897837449258, -0.329808795076691, -0.239255324324506), .Dim = c(10L,
> 7L), .Dimnames = list(c("chr5q23", "chr16q24", "chr8q24", "chr13q11",
> "chr7p21", "chr10q23", "chr13q13", "chr10q21", "chr1p13", "chrxp21"
> ), c("a", "b", "c", "d", "e", "f", "g")))
> >
>
>
> > dput(result)
> structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.532733633183408,
> 0.511244377811094, 0.528235882058971, 0.526736631684158, 0.51424287856072,
> 0.530734632683658, 0.513243378310845, 0.533233383308346, 0.542228885557221,
> 0.517241379310345, 0.532733633183408, 0.521739130434783, 0.529235382308846,
> 0.530234882558721, 0.548725637181409, 0.525737131434283, 0.527236381809095,
> 0.532733633183408, 0.530234882558721, 0.520739630184908, 0.15592203898051,
> 0.142928535732134, 0.140929535232384, 0.150924537731134, 0.160419790104948,
> 0.139430284857571, 0.152923538230885, 0.146426786606697, 0.149425287356322,
> 0.145427286356822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.282358820589705,
> 0.293853073463268, 0.262868565717141, 0.290854572713643, 0.276861569215392,
> 0.288855572213893, 0.282358820589705, 0.292853573213393, 0.286356821589205,
> 0.271364317841079, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1), .Dim = c(10L, 10L), .Dimnames = list(c("ACAP3",
> "ACTRT2", "AGRN", "ANKRD65", "ATAD3A", "ATAD3B", "ATAD3C", "AURKAIP1",
> "B3GALT6", "C1orf159"), c("chr5q23", "chr16q24", "chr8q24", "chr13q11",
> "chr7p21", "chr10q23", "chr13q13", "chr10q21", "chr1p13", "chrxp21"
> )))
>
>
> ===

___

Re: [R] (no subject)

2019-02-10 Thread Hasan Diwan
This is spam, right? -- H

On Sun, 10 Feb 2019 at 12:36, Diego Miro  wrote:

> 4 xxx ff
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.
>


-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2019-02-03 Thread Rui Barradas

Hello,

It is just a guess but I bet that what the OP means is


f <- function(x) {
  2 + x^2 - x^3
}

uniroot(f, lower = 1, upper = 2)


To the OP: please learn how to write math in R *before* trying to solve 
problems.


Hope this helps,

Rui Barradas


Às 16:07 de 02/02/2019, Berend Hasselman escreveu:




On 1 Feb 2019, at 12:41, malika yassa via R-help  wrote:

Please, can you help me I have a equation to solve by newton method but I can 
not do it
for example

f<-function(x) {


2+X2-X3=0}
this equation have un solution in [1,2]
is there a function in R for solve it or i have to programme it



What is the relation between the function argument x and variables X2 and X3?

As it stands this is incomprehensible. The function argument x is not used 
anywhere in the function body.

Berend Hasselman





[[alternative HTML version deleted]]

__
[email protected] 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.


__
[email protected] 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.



__
[email protected] 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] (no subject)

2019-02-02 Thread Berend Hasselman



> On 1 Feb 2019, at 12:41, malika yassa via R-help  wrote:
> 
> Please, can you help me I have a equation to solve by newton method but I can 
> not do it
> for example
> 
> f<-function(x) {
> 
> 
> 2+X2-X3=0}
> this equation have un solution in [1,2]
> is there a function in R for solve it or i have to programme it
> 

What is the relation between the function argument x and variables X2 and X3?

As it stands this is incomprehensible. The function argument x is not used 
anywhere in the function body.

Berend Hasselman

> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2019-02-02 Thread Hasan Diwan
Look at the rootSolve package[1] for what you need. Hope it helps... -- H

On Sat, 2 Feb 2019 at 06:46, malika yassa via R-help 
wrote:

> Please, can you help me I have a equation to solve by newton method but I
> can not do it
> for example
>
> f<-function(x) {
>
>
> 2+X2-X3=0}
> this equation have un solution in [1,2]
> is there a function in R for solve it or i have to programme it
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.
>


-- 
OpenPGP:
https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using
*bit.ly/hd1AppointmentRequest
*.
Si vous voudrais faire connnaisance, allez a *bit.ly/hd1AppointmentRequest
*.

Sent
from my mobile device
Envoye de mon portable

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2019-01-10 Thread Bert Gunter
Please post on R-package-devel, not here. That list is specifically devoted
to such issues. This list is about R programming help.

-- 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 Thu, Jan 10, 2019 at 3:06 PM Sam Albers 
wrote:

> Hello all,
>
> I am experience some issues with building a package that we are
> hosting on GitHub. The package itself is quite large.  It is a data
> package with a bunch of spatial files stored as .rds files.
>
> The repo is located here: https://github.com/bcgov/bcmaps.rdata
>
> If we clone that package to local machine via:
> git clone https://github.com/bcgov/bcmaps.rdata
>
> The first oddity is that the package installs successfully using this:
>
> $ R CMD INSTALL "./bcmaps.rdata"
>
> But fails when I try to build the package:
>
> $ R CMD build "./bcmaps.rdata"
> * checking for file './bcmaps.rdata/DESCRIPTION' ... OK
> * preparing 'bcmaps.rdata':
> * checking DESCRIPTION meta-information ... OK
> * checking for LF line-endings in source and make files and shell scripts
> * checking for empty or unneeded directories
> * looking to see if a 'data/datalist' file should be added
> Warning in gzfile(file, "rb") :
>   cannot open compressed file 'bcmaps.rdata', probable reason
> 'Permission denied'
> Error in gzfile(file, "rb") : cannot open the connection
> Execution halted
>
>
> The second oddity is that if I remove the . from the Package name in
> the DESCRIPTION file, the build proceeds smoothly:
>
> $ R CMD build "./bcmaps.rdata"
> * checking for file './bcmaps.rdata/DESCRIPTION' ... OK
> * preparing 'bcmapsrdata':
> * checking DESCRIPTION meta-information ... OK
> * checking for LF line-endings in source and make files and shell scripts
> * checking for empty or unneeded directories
> * looking to see if a 'data/datalist' file should be added
> * building 'bcmapsrdata_0.2.0.tar.gz'
>
> I am assuming that R CMD install builds the package internally so I
> find it confusing that I am not able to build it myself. Similarly
> confusing is the lack of a . in the package name indicative of
> anything?
>
> Does anyone have any idea what's going on here? Am I missing something
> obvious?
>
> Thanks in advance,
>
> Sam
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2018-12-03 Thread Jeremie Juste
Hello,

Can you provide more information?
What is your operating system?
What is your database management system (sqlite, mySQL,...)
What package do you use to import the data in R from the database?
What is the default language on your computer?
Are the variables not in farsi fine?

My guess is that Rstudion is a front end and have nothing to do with
your problem. But to be sure you can open R directly and check from there.

Some lines of codes would be helpful.

Best regards,
Jeremie




> Hi,
> I have a question about R Studio. I have a database in SQL. now, I combined
> SQL and R Studio. the levels of a variable is in farsi. so when I want to
> read some variables, in R Studio are "???" . I want to show them in
> farsi. what should I do to have right words in R Studio?
> Thanks.

__
[email protected] 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] (no subject)

2018-12-02 Thread Jeff Newmiller
It is possible that this is not an RStudio-specific issue in spite of the 
initial phrasing. 

Mahboobe:
If when you use Rgui (Windows) or R.app (Mac) or plain R at the command line 
(any OS) you still have problems, then you may need to ask for help here or in 
R-sig-mac or R-sig-debian or R-sig-fedora. Follow the recommendations in the 
Posting Guide to help your helper reproduce your problem without depending on 
RStudio. You should also describe what steps you have already tried... in 
particular read about Locales  and Encoding in the R Data Import/Export  and 
Installation/Administration manuals and describe what you have done to follow 
the advice given there.

FWIW I am an English-only speaker so have very limited experience with locales 
and encodings... be sure to direct your questions to whichever mailing list is 
most specific to your operating system rather than me.

Also, if it is RStudio-specific, there is a good RStudio blog post [1] you can 
start with.

[1] https://support.rstudio.com/hc/en-us/articles/200532197-Character-Encoding


On December 2, 2018 12:45:28 PM PST, Duncan Murdoch  
wrote:
>On 02/12/2018 6:51 AM, mahboobe akhlaghi wrote:
>> Hi,
>> I have a question about R Studio. I have a database in SQL. now, I
>combined
>> SQL and R Studio. the levels of a variable is in farsi. so when I
>want to
>> read some variables, in R Studio are "???" . I want to show them
>in
>> farsi. what should I do to have right words in R Studio?
>
>You'll probably need to contact RStudio support about this.  This 
>mailing list is about R; RStudio is a separate project that provides a 
>front end to R.
>
>When you contact them, let them know details about your system:  are
>you 
>running Windows?  What version?  What locale?
>
>Duncan Murdoch
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2018-12-02 Thread Duncan Murdoch

On 02/12/2018 6:51 AM, mahboobe akhlaghi wrote:

Hi,
I have a question about R Studio. I have a database in SQL. now, I combined
SQL and R Studio. the levels of a variable is in farsi. so when I want to
read some variables, in R Studio are "???" . I want to show them in
farsi. what should I do to have right words in R Studio?


You'll probably need to contact RStudio support about this.  This 
mailing list is about R; RStudio is a separate project that provides a 
front end to R.


When you contact them, let them know details about your system:  are you 
running Windows?  What version?  What locale?


Duncan Murdoch

__
[email protected] 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] (no subject)

2018-10-22 Thread PIKAL Petr
Hi

first of all few comments

Does your email client have subject line? If yes please use it, if not, change 
the client.
Please do not post in HTML, such emails have big chance to be scrambled.

# this gives you 10 random numbers
x<-rnorm(10,0,1)

f<-fuction(u,x)  {exp(x- u)}
# you probably ment
f<-function(u,x)  {exp(x- u)}

for(i in 1:lenght(x) integrate(f,lower=1,upper=4)
# you probably ment
for(i in 1:length(x)) integrate(f,lower=1,upper=4)
..^^...^
but this gives you an error
> for(i in 1:length(x)) integrate(f,lower=1,upper=4)
Error in f(x, ...) : argument "x" is missing, with no default

The error message comes from your f function as you did not defined u

If you changed your f function somehow
f<-function(x, u=2)  {exp(x - u)}
for(i in 1:length(x)) integrate(f,lower=1,upper=4)
the error is gone but so do results.

You need either print your results explicitly or to assign them to some object.

But if you printed your results you would find that you get same repeated 
result length(x) times.
> for(i in 1:length(x)) print(integrate(f,lower=1,upper=4))
7.021177 with absolute error < 7.8e-14
7.021177 with absolute error < 7.8e-14
7.021177 with absolute error < 7.8e-14
7.021177 with absolute error < 7.8e-14
7.021177 with absolute error < 7.8e-14

AFAIK, integrate computes area below curve defined by function f between lower 
and upper and it has nothing to do with your x definition.

So you should reconsider what do you want to achieve and if you have some time 
you should read some introduction document(s) to understand how R operates with 
objects. R Intro should be good starting point.

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of malika yassa via R-
> help
> Sent: Saturday, October 20, 2018 3:04 PM
> To: [email protected]
> Subject: [R] (no subject)
>
> hello
> please you help mei have this functionx<-rnorm(10,0,1)f<-fuction(u,x)  
> {exp((x-
> u)}I want to calculate the integral of this function for each value of 
> x{for(i in
> 1:lenght(x)
> integrate(f,lower=1,upper=4)
>
> }but I can not find the vector of resulatwhere is the errorthinks
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
[email protected] 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] (no subject)

2018-10-20 Thread Bert Gunter
Jeremie's suggestion of course will fail if some of the off-diagonal
elements are the same as those on the diagonals.

The request doesn't make a lot of sense to me, but if "m" is the matrix,

 m[row(z) != col(z)]

reliably extracts the vector of non-diagonal entries, which can then be
dimensioned as desired.
Or upper.tri() and lower.tri() can be used to separately extract the upper
and lower triangle entries via logical indexing.

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 Sat, Oct 20, 2018 at 8:48 AM Jeremie Juste 
wrote:

>
>
> Hello,
>
> Be sure to include the mailing list, when you
> reply. In this way to improve your chances of obtaining a good answer
> and everyone benefits.
>
>
> May be something like this ?
>
> aa <- matrix(1:9,3,3)
> matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)
>
>  [,1] [,2] [,3]
> [1,]247
> [2,]368
>
> Hope it helps,
>
> Jeremie
>
> malika yassa  writes:
>
> >  hellow
> > yes i want to extract the non-diagonal part
> > for exampl
> > i have this matrix  [,1] [,2] [,3]
> > [1,]147
> > [2,]258
> > [3,]369the result
> >
> >   [,1] [,2] [,3]
> > [1,]247
> > [2,]368
> >
> > Le samedi 20 octobre 2018 à 15:21:53 UTC+2, Jeremie Juste <
> [email protected]> a écrit :
> >
> >  malika yassa via R-help  writes:
> >
> > Hello,
> >
> > Can you specify what you mean by deleting exactly?
> > Do you want to have zero in the diagonal or do you want to extract the
> > non-diagonal part?
> >
> > Besides your matrix is not a square matrix. Do you really want to
> > extract the non-diagonal part of a non square matrix?
> >
> > Best regards,
> >
> > Jeremie
> >
> >> hellowplease,do you help mei have this matrixm<-matrix(( 1:12, nrow = 3
> )
> >>
> >> I want to delete the diagonal values of this matrix
> >> can anyone do thisthinks
> >>
> >> [[alternative HTML version deleted]]
> >>
> >> __
> >> [email protected] 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.
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2018-10-20 Thread Jeremie Juste



Hello,

Be sure to include the mailing list, when you
reply. In this way to improve your chances of obtaining a good answer
and everyone benefits. 


May be something like this ?

aa <- matrix(1:9,3,3)
matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)

 [,1] [,2] [,3]
[1,]247
[2,]368

Hope it helps,

Jeremie

malika yassa  writes:

>  hellow
> yes i want to extract the non-diagonal part 
> for exampl
> i have this matrix  [,1] [,2] [,3]
> [1,]    1    4    7
> [2,]    2    5    8
> [3,]    3    6    9the result 
>
>   [,1] [,2] [,3]
> [1,]    2    4    7
> [2,]    3    6    8
>
> Le samedi 20 octobre 2018 à 15:21:53 UTC+2, Jeremie Juste 
>  a écrit :  
>
>  malika yassa via R-help  writes:
>
> Hello,
>
> Can you specify what you mean by deleting exactly?
> Do you want to have zero in the diagonal or do you want to extract the
> non-diagonal part?
>
> Besides your matrix is not a square matrix. Do you really want to
> extract the non-diagonal part of a non square matrix?
>
> Best regards,
>
> Jeremie
>
>> hellowplease,do you help mei have this matrixm<-matrix(( 1:12, nrow = 3 )
>>
>> I want to delete the diagonal values of this matrix
>> can anyone do thisthinks 
>>
>>     [[alternative HTML version deleted]]
>>
>> __
>> [email protected] 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.

__
[email protected] 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] (no subject)

2018-10-20 Thread Jeremie Juste
malika yassa via R-help  writes:

Hello,

Can you specify what you mean by deleting exactly?
Do you want to have zero in the diagonal or do you want to extract the
non-diagonal part?

Besides your matrix is not a square matrix. Do you really want to
extract the non-diagonal part of a non square matrix?


Best regards,

Jeremie






> hellowplease,do you help mei have this matrixm<-matrix(( 1:12, nrow = 3 )
>
> I want to delete the diagonal values of this matrix
> can anyone do thisthinks 
>
>   [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2018-08-07 Thread Jim Lemon
Hi malika,
You don't seem to have defined your functions correctly. For example:

H<-function(u,x1)

would define an empty function H if that command worked, but it doesn't

Jim


On Tue, Aug 7, 2018 at 3:51 PM, malika yassa via R-help
 wrote:
> hellothis is my programmeyou can help me, i cann't found a solution for H  
> and this  function i calculate for all value for x1thank you
>
>
> x<-rexp(N,2)
>
> z<-rnorm(0,1,n)
>
> g
> h=max(x)-min(x)
>
> n1=n^0.17
>
> h1=h/n1
>
> k=2
>
> x1<-seq(from=-2,to=2,by=0.1)
>
> s[i]=(x[i]+x[i+1])/2
>
> for(i in 1:N)
>
> fkS<-function(m,k){fkm=-m*(abs(Z-m)=k)-k*(Z-m<=-k)}
>
> k1<-function(u,x1){-1/(2*pi)exp((x1-u)/h1}
>
> for (i in 1:n)
>
> {k1(u,x1)=integrate(-1/(2*pi)exp((x1-u)/h1,lower=s[i-1],upper=s[i])}
>
>
>
>
>
> H<-function(u,x1)
>
> for (i in 1:n)
>
> {H(u,x1)=sum(g[i]*fkS*integrate(k1,lower=s[i-1],upper=s[i])
>
> }
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2018-07-30 Thread Bert Gunter
How can one possibly answer this without knowing the structure of your
dataset?

-- 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 Mon, Jul 30, 2018 at 8:24 AM, Baojun Sun 
wrote:

> The book "Introduction to Statistical Learning" gives R scripts for its
> labs. I found a script for ridge regression that works on the dataset the
> book uses but is unusable on other datasets I own unless I clean the data.
>
>
> I'm trying to understand the syntax for I need for data cleaning and am
> stuck. I want to learn to do ridge regression. I tried using my own data
> set on this script rather than the book example but get errors. If you use
> your own data set rather than the Hitters dataset, then you'll get errors
> unless you format your code. How do I change this script or clean any
> dataset so that this script for ridge regression useable for all datasets?
>
>
> library(ISLR)
>
> fix(Hitters)
>
> names(Hitters)
>
> dim(Hitters)
>
> sum(is.na(Hitters$Salary))
>
> Hitters=na.omit(Hitters)
>
> dim(Hitters)
>
> sum(is.na(Hitters))
>
> library(leaps)
>
>
>
> x=model.matrix(Salary~.,Hitters)[,-1]
>
> y=Hitters$Salary
>
>
>
> # Ridge Regression
>
>
>
> library(glmnet)
>
> grid=10^seq(10,-2,length=100)
>
> ridge.mod=glmnet(x,y,alpha=0,lambda=grid)
>
> dim(coef(ridge.mod))
>
> ridge.mod$lambda[50]
>
> coef(ridge.mod)[,50]
>
> sqrt(sum(coef(ridge.mod)[-1,50]^2))
>
> ridge.mod$lambda[60]
>
> coef(ridge.mod)[,60]
>
> sqrt(sum(coef(ridge.mod)[-1,60]^2))
>
> predict(ridge.mod,s=50,type="coefficients")[1:20,]
>
> set.seed(1)
>
> train=sample(1:nrow(x), nrow(x)/2)
>
> test=(-train)
>
> y.test=y[test]
>
> ridge.mod=glmnet(x[train,],y[train],alpha=0,lambda=grid, thresh=1e-12)
>
> ridge.pred=predict(ridge.mod,s=4,newx=x[test,])
>
> mean((ridge.pred-y.test)^2)
>
> mean((mean(y[train])-y.test)^2)
>
> ridge.pred=predict(ridge.mod,s=1e10,newx=x[test,])
>
> mean((ridge.pred-y.test)^2)
>
> ridge.pred=predict(ridge.mod,s=0,newx=x[test,],exact=T)
>
> mean((ridge.pred-y.test)^2)
>
> lm(y~x, subset=train)
>
> predict(ridge.mod,s=0,exact=T,type="coefficients")[1:20,]
>
> set.seed(1)
>
> cv.out=cv.glmnet(x[train,],y[train],alpha=0)
>
> plot(cv.out)
>
> bestlam=cv.out$lambda.min
>
> bestlam
>
> ridge.pred=predict(ridge.mod,s=bestlam,newx=x[test,])
>
> mean((ridge.pred-y.test)^2)
>
> out=glmnet(x,y,alpha=0)
>
> predict(out,type="coefficients",s=bestlam)[1:20
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2018-07-21 Thread Rui Barradas

Hello,

Please always write to r-help, not to me personally, even if I was able 
to be of assistance in the past.


As for your question, your code has several problems.

1) rowSums and colSums return vectors, not matrices. Even if they did, 
see point 3) below.


2) You define K = 0 then in

X[1]=1/(K*A[i,j]*c[1,1]+K*A[i,j]*c[1,2]+K*A[i,j]*c[1,3])

the denominator is zero because A[i,j] and c[] are multiplied by it.

3) What are the i,j in A[i,j] and P[i,j]?


Hope this helps,

Rui Barradas


Às 11:51 de 21-07-2018, Atanasio Alberto Tembe Tembe escreveu:

Dear Mr. Barradas,

Thank you for your attention.

Sorry for this personalized e-mail. I recently posted a query about 
while loop, but I did not get good feedback. I am a beginner in R and I 
wonder if you can me help again.


If I have two matrices such as: a<-matrix(1:9,nrow=3,ncol=3) and 
c<-matrix(1:9,nrow=3,ncol=3).


with defined variables:
K=0
A[i,j]=colSums(a)
P[i,j]=rowSums(a)
F[i,j]=c[i,j]^(-2 )
X[i]=A[i,j]*c[i,j]
X[j]=P[i,j]*c[i,j]

How to perform the following calculation with while loop so that it 
stops when a convergence between X and Y values is reached?.


X[1]=1/(K*A[i,j]*c[1,1]+K*A[i,j]*c[1,2]+K*A[i,j]*c[1,3])

Y[1]=1/(X[1]*P[i,j]*c[1,1]+[X1]*P[i,j]*c[1,2]+[X1]*P[i,j]*c[1,3])

X[2]=1/(Y[1]*A[i,j]*c[2,1]+Y[1]*A[i,j]*c[2,2]+Y[1]*A[i,j]*c[2,3])

Y[2]=1/(X[2]*P[i,j]*c[2,1]+X[2]*P[i,j]*c[2,2]+X[2]*P[i,j]*c[2,3])

X[3]=1/(Y[2]*A[i,j]*c[3,1]+Y[1]*A[i,j]*c[3,2]+Y[2]*A[i,j]*c[3,3])

Y[3]=1/(X[3]*P[3]*c[3,1]+X[3]*P[3]*c[3,2]+X[3]*P[3]*c[3,3])


Thank you very much.










On Mon, Jul 16, 2018 at 6:51 PM, Atanasio Alberto Tembe Tembe 
mailto:[email protected]>> wrote:


Hi Mr. Barradas,

Thank you for your kind support. I will your suggestions.

Best regards
Tembe


On Mon, Jul 16, 2018 at 6:22 PM, Rui Barradas mailto:[email protected]>> wrote:

Hello,

Please repost in plain text, NO HTML formating.

Also, you are missing an open parenthesis right after while:

while( sum(abs(Sb-D-Sc-t(Pi))>1E-5)){


Hope this helps,

Rui Barradas


Às 14:25 de 15-07-2018, Atanasio Alberto Tembe Tembe escreveu:

Hello!

Is there anyone who can help me to this the error bellow? Ijust
started using R recently. Thank you


while sum(abs(Sb-D-Sc-t(Pi))>1E-5{Error: unexpected symbol
in "while
sum">     >     k=K+1>     >     for(i in 1:nrow(c1)){+ 
    +
     for(j in 1:ncol(c1)){+             +   
  if(Sb!=0){+

           +                 T2=D*T/Sa+                 +
}else {+                 +                 T2=0       +
   +             }+             +             Sc=sum(t(T))+
+             if(Sc!=0){+                 +
T3=Pi*T2/Sc+                 +             }else {+ 
        +

                 T3=0+                 +             }+
Sb=sum(T)+             +         }+     }>     >     K[1] 0

         [[alternative HTML version deleted]]

__
[email protected]  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.




-- 
Atanasio Alberto Tembe (Mr)

Doctoral student
Graduate School of Urban Innovation
Transportation and Urban Engineering Laboratory
Yokohama National University
Tel: +81-(0)80-4605-1305 
  Mail: [email protected]

[email protected] 




--
Atanasio Alberto Tembe (Mr)
Doctoral student
Graduate School of Urban Innovation
Transportation and Urban Engineering Laboratory
Yokohama National University
Tel: +81-(0)80-4605-1305 
  Mail: [email protected] 
[email protected] 


__
[email protected] 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] (no subject)

2018-07-16 Thread Rui Barradas

Hello,

Please repost in plain text, NO HTML formating.

Also, you are missing an open parenthesis right after while:

while( sum(abs(Sb-D-Sc-t(Pi))>1E-5)){


Hope this helps,

Rui Barradas

Às 14:25 de 15-07-2018, Atanasio Alberto Tembe Tembe escreveu:

Hello!

Is there anyone who can help me to this the error bellow? Ijust
started using R recently. Thank you


while sum(abs(Sb-D-Sc-t(Pi))>1E-5{Error: unexpected symbol in "while
sum"> > k=K+1> > for(i in 1:nrow(c1)){+ +
for(j in 1:ncol(c1)){+ + if(Sb!=0){+
  + T2=D*T/Sa+ +
}else {+ + T2=0   +
  + }+ + Sc=sum(t(T))+
+ if(Sc!=0){+ +
T3=Pi*T2/Sc+ + }else {+ +
T3=0+ + }+
Sb=sum(T)+ + }+ }> > K[1] 0

[[alternative HTML version deleted]]

__
[email protected] 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.



__
[email protected] 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] (no subject)

2018-07-15 Thread Thierry Onkelinx
Dear Laura,

I came across the anipaths package
(https://cran.r-project.org/web/packages/anipaths/vignettes/anipaths.html)
It might be useful for you.

Best regards,


ir. Thierry Onkelinx
Statisticus / Statistician

Vlaamse Overheid / Government of Flanders
INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE
AND FOREST
Team Biometrie & Kwaliteitszorg / Team Biometrics & Quality Assurance
[email protected]
Havenlaan 88 bus 73, 1000 Brussel
www.inbo.be

///
To call in the statistician after the experiment is done may be no
more than asking him to perform a post-mortem examination: he may be
able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does
not ensure that a reasonable answer can be extracted from a given body
of data. ~ John Tukey
///




2018-07-09 14:13 GMT+02:00 Laura Steel :
> I am a beginner to R and I need to map some Atlantic puffin migration routes
> onto a map of the Northern Hemisphere. I have a latitude and longitude point
> per bird, per day. I would like to be able to plot the routes of all my
> birds on one map and ideally so that I can see at which date they are at
> each location.
>
> This is a shortened version of my data for one bird only.
>
> Bird Date  Latitude Longitude
> eb80976 16/07/2012  50.99   -5.85
> eb80976 17/07/2012  52.09   -4.58
> eb80976 18/07/2012  49.72   -5.56
> eb80976 19/07/2012  51.59   -3.17
> eb80976 20/07/2012  52.45   -2.03
> eb80976 21/07/2012  56.015  -10.51
>
> Any help would be much appreciated. I am not totally sure where to start!
> Many thanks.
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2018-07-15 Thread Jeff Newmiller
I think you are missing a parenthesis around your condition [1][2].

For future reference:
a) You should post the code you ran as well as the error message... it is 
unusual for the error message alone to be enough to figure out the problem. In 
fact, try to make a "reproducible example" [3][4][5]... you will increase your 
chances of getting an answer.
b) Your message was garbled... in some cases this can completely obscure your 
question. You can prevent that from happening by setting your email program to 
create a plain text email whenever you post here.
c) Remember to put a subject line on your email.

[1] https://stat.ethz.ch/R-manual/R-devel/library/base/html/Control.html
[2] 
https://www-r--bloggers-com.cdn.ampproject.org/v/s/www.r-bloggers.com/control-structures-loops-in-r/
[3] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[4] http://adv-r.had.co.nz/Reproducibility.html

[5] https://cran.r-project.org/web/packages/reprex/index.html (read the 
vignette) 


On July 15, 2018 6:25:43 AM PDT, Atanasio Alberto Tembe Tembe 
 wrote:
>Hello!
>
>Is there anyone who can help me to this the error bellow? Ijust
>started using R recently. Thank you
>
>
>while sum(abs(Sb-D-Sc-t(Pi))>1E-5{Error: unexpected symbol in "while
>sum"> > k=K+1> > for(i in 1:nrow(c1)){+ +
>   for(j in 1:ncol(c1)){+ + if(Sb!=0){+
> + T2=D*T/Sa+ +
>}else {+ + T2=0   +
> + }+ + Sc=sum(t(T))+
>+ if(Sc!=0){+ +
>T3=Pi*T2/Sc+ + }else {+ +
>   T3=0+ + }+
>Sb=sum(T)+ + }+ }> > K[1] 0
>
>   [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2018-07-11 Thread MacQueen, Don via R-help
Maybe I missed it, but I didn't see anyone suggest a visit to the CRAN Spatial 
task view. This would be a good place to start learning how to work with 
spatial data in R.

-Don

--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
Lab cell 925-724-7509
 
 

On 7/9/18, 5:13 AM, "R-help on behalf of Laura Steel" 
 wrote:

I am a beginner to R and I need to map some Atlantic puffin migration routes
onto a map of the Northern Hemisphere. I have a latitude and longitude point
per bird, per day. I would like to be able to plot the routes of all my
birds on one map and ideally so that I can see at which date they are at
each location.

This is a shortened version of my data for one bird only.

Bird Date  Latitude Longitude
eb80976 16/07/2012  50.99   -5.85
eb80976 17/07/2012  52.09   -4.58
eb80976 18/07/2012  49.72   -5.56
eb80976 19/07/2012  51.59   -3.17
eb80976 20/07/2012  52.45   -2.03
eb80976 21/07/2012  56.015  -10.51

Any help would be much appreciated. I am not totally sure where to start!
Many thanks.


[[alternative HTML version deleted]]

__
[email protected] 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.


__
[email protected] 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] (no subject)

2018-07-10 Thread Werning, Jan-Philipp

Hi,

thanks a lot! Now it works.

Yours

Jan

Am 10.07.2018 um 09:00 schrieb PIKAL Petr 
mailto:[email protected]>>:

Hi

see in line

-Original Message-
From: R-help [mailto:[email protected]] On Behalf Of Werning, Jan-
Philipp
Sent: Monday, July 9, 2018 9:42 PM
To: [email protected]
Subject: [R] (no subject)

Dear all,


In the end I try to run a system dynamics simulation in R using the package
deSolve.
Therefore I need an auxiliary list (auxs) the model can refer to when it the
functions need an auxiliary value.

I used a manual list:

auxs <- c( aSplitSN=0.4 , aSplitLN=0.6, aSplitSR1=0 , aSplitLR1=1, aSplitSR2=0 ,
aSplitLR2=1, aSplitSR3=0 , aSplitLR3=1, aSalesNR=0.92, aSalesRR=0.08, […])

This is vector not list.
auxs <- c( aSplitSN=0.4 , aSplitLN=0.6, aSplitSR1=0 , aSplitLR1=1, aSplitSR2=0)
is.vector(auxs)
[1] TRUE
is.list(auxs)
[1] FALSE


this way everything worked well.

Now I want to use a matrix with different values for each of the auxiliaries in
order to run different scenarios. Therefore I created a csv document wich I read
in:

csv1  <- read.csv("180713_Taguchi Robust Design Test_180709_1745.csv", sep
= ";")

list_csv <- csv1[1,]

which is probably data frame

test<-vec[1,]
is.vector(test)
[1] FALSE
is.list(test)
[1] TRUE
is.data.frame(test)
[1] TRUE



namesauxs <- names(list_csv)

auxs1 <- as.numeric(list_csv)

names(auxs1) <- namesauxs

auxs <- auxs1


Looking at the global environment section in R studio, now both are the same,
in the value section as "Numed num"

I do not know rstudio but you could check two objects by
?identical


Yet, the model will not run using these values ultimately coming from the csv.

I wonder why do you use as.numeric in the first instance. You coud use

auxs1 <- unlist(csv1[1,])
and you should get named numeric vector. Maybe there are problems when reading 
numbers from csv file. You could check it e.g. by

str(auxs1)


What am I doing wrong here?

It would be great if you could help.

Thanks a lot in advance

Yours

Jan





[[alternative HTML version deleted]]

__
[email protected] 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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/



[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2018-07-10 Thread PIKAL Petr
Hi

see in line

> -Original Message-
> From: R-help [mailto:[email protected]] On Behalf Of Werning, Jan-
> Philipp
> Sent: Monday, July 9, 2018 9:42 PM
> To: [email protected]
> Subject: [R] (no subject)
>
> Dear all,
>
>
> In the end I try to run a system dynamics simulation in R using the package
> deSolve.
> Therefore I need an auxiliary list (auxs) the model can refer to when it the
> functions need an auxiliary value.
>
> I used a manual list:
>
> auxs <- c( aSplitSN=0.4 , aSplitLN=0.6, aSplitSR1=0 , aSplitLR1=1, 
> aSplitSR2=0 ,
> aSplitLR2=1, aSplitSR3=0 , aSplitLR3=1, aSalesNR=0.92, aSalesRR=0.08, […])

This is vector not list.
> auxs <- c( aSplitSN=0.4 , aSplitLN=0.6, aSplitSR1=0 , aSplitLR1=1, 
> aSplitSR2=0)
> is.vector(auxs)
[1] TRUE
> is.list(auxs)
[1] FALSE
>
>
> this way everything worked well.
>
> Now I want to use a matrix with different values for each of the auxiliaries 
> in
> order to run different scenarios. Therefore I created a csv document wich I 
> read
> in:
>
> csv1  <- read.csv("180713_Taguchi Robust Design Test_180709_1745.csv", sep
> = ";")
>
> list_csv <- csv1[1,]

which is probably data frame

> test<-vec[1,]
> is.vector(test)
[1] FALSE
> is.list(test)
[1] TRUE
> is.data.frame(test)
[1] TRUE
>

>
> namesauxs <- names(list_csv)
>
>  auxs1 <- as.numeric(list_csv)
>
>  names(auxs1) <- namesauxs
>
>  auxs <- auxs1
>
>
> Looking at the global environment section in R studio, now both are the same,
> in the value section as "Numed num"

I do not know rstudio but you could check two objects by
?identical

>
> Yet, the model will not run using these values ultimately coming from the csv.

I wonder why do you use as.numeric in the first instance. You coud use

auxs1 <- unlist(csv1[1,])
and you should get named numeric vector. Maybe there are problems when reading 
numbers from csv file. You could check it e.g. by

str(auxs1)

>
> What am I doing wrong here?
>
> It would be great if you could help.
>
> Thanks a lot in advance
>
> Yours
>
> Jan
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
[email protected] 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] (no subject)

2018-07-09 Thread Jim Lemon
Hi Laura,
Here's a basic method:

lsdf<-read.table(text="Bird Date Latitude Longitude
eb80976 16/07/2012  50.99   -5.85
eb80976 17/07/2012  52.09   -4.58
eb80976 18/07/2012  49.72   -5.56
eb80976 19/07/2012  51.59   -3.17
eb80976 20/07/2012  52.45   -2.03
eb80976 21/07/2012  56.015  -10.51",
header=TRUE)
library(maps)
map("world",xlim=c(-20,10),ylim=c(45,60))
mtext(side=3,cex=1.5,text="Migration of puffin eb80976",line=2)
lines(lsdf$Longitude,lsdf$Latitude)
library(plotrix)
boxed.labels(lsdf$Longitude,lsdf$Latitude,lsdf$Date,border="white",cex=0.7)
box()
axis(1)
axis(2)

Jim


On Mon, Jul 9, 2018 at 10:13 PM, Laura Steel  wrote:
> I am a beginner to R and I need to map some Atlantic puffin migration routes
> onto a map of the Northern Hemisphere. I have a latitude and longitude point
> per bird, per day. I would like to be able to plot the routes of all my
> birds on one map and ideally so that I can see at which date they are at
> each location.
>
> This is a shortened version of my data for one bird only.
>
> Bird Date  Latitude Longitude
> eb80976 16/07/2012  50.99   -5.85
> eb80976 17/07/2012  52.09   -4.58
> eb80976 18/07/2012  49.72   -5.56
> eb80976 19/07/2012  51.59   -3.17
> eb80976 20/07/2012  52.45   -2.03
> eb80976 21/07/2012  56.015  -10.51
>
> Any help would be much appreciated. I am not totally sure where to start!
> Many thanks.
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2018-07-09 Thread Jeff Newmiller
perhaps geom_path rather than geom_line?

On July 9, 2018 12:40:15 PM PDT, Hasan Diwan  wrote:
>https://imgur.com/a/0f72Fsz results from the following code:
>
>ggplot()+borders("world", colour="gray50",
>fill="gray50")+geom_line(aes(x=Longitude, y=Latitude), birds)
>
>It's ugly, but it will give you a starting point. -- H
>On Mon, 9 Jul 2018 at 10:53, Laura Steel 
>wrote:
>>
>> I am a beginner to R and I need to map some Atlantic puffin migration
>routes
>> onto a map of the Northern Hemisphere. I have a latitude and
>longitude point
>> per bird, per day. I would like to be able to plot the routes of all
>my
>> birds on one map and ideally so that I can see at which date they are
>at
>> each location.
>>
>> This is a shortened version of my data for one bird only.
>>
>> Bird Date  Latitude Longitude
>> eb80976 16/07/2012  50.99   -5.85
>> eb80976 17/07/2012  52.09   -4.58
>> eb80976 18/07/2012  49.72   -5.56
>> eb80976 19/07/2012  51.59   -3.17
>> eb80976 20/07/2012  52.45   -2.03
>> eb80976 21/07/2012  56.015  -10.51
>>
>> Any help would be much appreciated. I am not totally sure where to
>start!
>> Many thanks.
>>
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> [email protected] 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.

-- 
Sent from my phone. Please excuse my brevity.

__
[email protected] 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] (no subject)

2018-07-09 Thread Hasan Diwan
https://imgur.com/a/0f72Fsz results from the following code:

ggplot()+borders("world", colour="gray50",
fill="gray50")+geom_line(aes(x=Longitude, y=Latitude), birds)

It's ugly, but it will give you a starting point. -- H
On Mon, 9 Jul 2018 at 10:53, Laura Steel  wrote:
>
> I am a beginner to R and I need to map some Atlantic puffin migration routes
> onto a map of the Northern Hemisphere. I have a latitude and longitude point
> per bird, per day. I would like to be able to plot the routes of all my
> birds on one map and ideally so that I can see at which date they are at
> each location.
>
> This is a shortened version of my data for one bird only.
>
> Bird Date  Latitude Longitude
> eb80976 16/07/2012  50.99   -5.85
> eb80976 17/07/2012  52.09   -4.58
> eb80976 18/07/2012  49.72   -5.56
> eb80976 19/07/2012  51.59   -3.17
> eb80976 20/07/2012  52.45   -2.03
> eb80976 21/07/2012  56.015  -10.51
>
> Any help would be much appreciated. I am not totally sure where to start!
> Many thanks.
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.



-- 
OpenPGP: https://sks-keyservers.net/pks/lookup?op=get&search=0xFEBAD7FFD041BBA1
If you wish to request my time, please do so using bit.ly/hd1AppointmentRequest.
Si vous voudrais faire connnaisance, allez a bit.ly/hd1AppointmentRequest.

Sent from my mobile device
Envoye de mon portable

__
[email protected] 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] (no subject)

2018-07-09 Thread Bert Gunter
Laura:

1. We generally do not do code for you; we expect you to show your efforts
first.

2. You might want to post this on the r-sig-geo list instead. They
specialize in such issues, so that you are more likely to find helpful
advice there.

3. There are many good R tutorials on the web. e.g. see here:
https://www.rstudio.com/online-learning/
As a "beginner," if you have not already done so, you should avail yourself
of them before posting further.


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 Mon, Jul 9, 2018 at 11:03 AM, Dylan Distasio  wrote:

> You'll probably get a more detailed reply from someone with more expertise,
> but have you looked at something like what this article proposes:
>
> https://medium.com/fastah-project/a-quick-start-to-maps-in-r-b9f221f44ff3
>
> On Mon, Jul 9, 2018 at 1:53 PM Laura Steel 
> wrote:
>
> > I am a beginner to R and I need to map some Atlantic puffin migration
> > routes
> > onto a map of the Northern Hemisphere. I have a latitude and longitude
> > point
> > per bird, per day. I would like to be able to plot the routes of all my
> > birds on one map and ideally so that I can see at which date they are at
> > each location.
> >
> > This is a shortened version of my data for one bird only.
> >
> > Bird Date  Latitude Longitude
> > eb80976 16/07/2012  50.99   -5.85
> > eb80976 17/07/2012  52.09   -4.58
> > eb80976 18/07/2012  49.72   -5.56
> > eb80976 19/07/2012  51.59   -3.17
> > eb80976 20/07/2012  52.45   -2.03
> > eb80976 21/07/2012  56.015  -10.51
> >
> > Any help would be much appreciated. I am not totally sure where to start!
> > Many thanks.
> >
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > [email protected] 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]]
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2018-07-09 Thread Dylan Distasio
You'll probably get a more detailed reply from someone with more expertise,
but have you looked at something like what this article proposes:

https://medium.com/fastah-project/a-quick-start-to-maps-in-r-b9f221f44ff3

On Mon, Jul 9, 2018 at 1:53 PM Laura Steel 
wrote:

> I am a beginner to R and I need to map some Atlantic puffin migration
> routes
> onto a map of the Northern Hemisphere. I have a latitude and longitude
> point
> per bird, per day. I would like to be able to plot the routes of all my
> birds on one map and ideally so that I can see at which date they are at
> each location.
>
> This is a shortened version of my data for one bird only.
>
> Bird Date  Latitude Longitude
> eb80976 16/07/2012  50.99   -5.85
> eb80976 17/07/2012  52.09   -4.58
> eb80976 18/07/2012  49.72   -5.56
> eb80976 19/07/2012  51.59   -3.17
> eb80976 20/07/2012  52.45   -2.03
> eb80976 21/07/2012  56.015  -10.51
>
> Any help would be much appreciated. I am not totally sure where to start!
> Many thanks.
>
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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]]

__
[email protected] 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] (no subject)

2018-05-13 Thread David Winsemius

> On May 13, 2018, at 9:35 AM, David Winsemius  wrote:
> 
> 
>> On May 12, 2018, at 9:42 AM, malika yassa via R-help  
>> wrote:
>> 
>> 
>> hello
>> for exampl, i have this programme
>> # Generating data which are right truncated
>> library(DTDA)
>> library(splines)
>> library(survival)
>> n<-25
>> X<-runif(n,0,1)
>> V<-runif(n,0.75,1)
>> for (i in 1:n){
>> while (X[i]>V[i]){
>> X[i]<-runif(1,0,1)
>> V[i]<-runif(1,0.75,1)
>> }}
>> res<-lynden(X=X,U=NA, V=V, boot=TRUE)
>> attach(res)
>> temps = time
>> M_i = n.event
>> L_t = res
>> F_t=1-L_t  
> 
>> F_t=1-L_t 
> Error in 1 - L_t : non-numeric argument to binary operator
> 
> L_t is a list. You cannot subtract a list (at least in R). I'm not sure what 
> you think F_t is supposed to be and you don't seem to use it. If you are 
> attempting to calculate the Hazard function, it's just:
> 
> str(L_t) # note the hazard component of that list.
> 
> res$hazard
> 
> [1] 0.03958 0.04121 0.04299 0.04492 0.04703 0.04935 0.05191 0.05476
> [9] 0.05793 0.06149 0.06552 0.07011 0.07540 0.08155 0.08879 0.09744
> [17] 0.10795 0.12102 0.13768 0.15966 0.19000 0.23457 0.30645 0.44186
> [25] 1.0
> 
> For some interpretations of your question, this may be what you are seeking. 
> It's the Pr( X > t )

 Wrong. It's Pr( X < t)

Sorry;
David.
> 
>> 
>> par(mfrow=c(1,1))
>> plot(L_t$time,L_t$survival,type="s",lty=2:3,lwd=2,las=1,cex.lab=1.1,font.lab=2,col="red",xlab="temps",ylab="L(t)",main="Esitmation
>>  de la Fonction de Survie L(t)")
>> 
>> 
>> i need to calculate the probability p(X>V)
> 
> As I see it the probability of X>V is:
> 
> sum(X > V)
> [1] 0
> 
> And I see this as a matter of definition. I'm guessing you wanted the 
> estimated Hazard. If I'm wrong, I wonder if you can rephrase the question so 
> it makes more sense to a general statistical audience. What is the subject 
> matter of the investigation?
> 
> 
> -- 
> David
>> 
>>   Le jeudi 10 mai 2018 à 17:15:06 UTC+2, John Kane  a 
>> écrit :  
>> 
>> We need some idea of the problem.
>> 
>> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
>> 
>> 
>> http://adv-r.had.co.nz/Reproducibility.html
>> 
>> 
>> 
>>   On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help 
>>  wrote:  
>> 
>> 
>> Hello 
>> 
>> Do You help me, i have the problem in the package DTDA for  find the 
>> probability of truncation  (alpha)
>> thank you
>> 
>>[[alternative HTML version deleted]]
>> 
>> __
>> [email protected] 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]]
>> 
>> __
>> [email protected] 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.
> 
> David Winsemius
> Alameda, CA, USA
> 
> 'Any technology distinguishable from magic is insufficiently advanced.'   
> -Gehm's Corollary to Clarke's Third Law
> 
> __
> [email protected] 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
[email protected] 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] (no subject)

2018-05-13 Thread David Winsemius

> On May 12, 2018, at 9:42 AM, malika yassa via R-help  
> wrote:
> 
> 
> hello
> for exampl, i have this programme
> # Generating data which are right truncated
> library(DTDA)
> library(splines)
> library(survival)
> n<-25
> X<-runif(n,0,1)
> V<-runif(n,0.75,1)
> for (i in 1:n){
> while (X[i]>V[i]){
> X[i]<-runif(1,0,1)
> V[i]<-runif(1,0.75,1)
> }}
> res<-lynden(X=X,U=NA, V=V, boot=TRUE)
> attach(res)
> temps = time
> M_i = n.event
> L_t = res
> F_t=1-L_t  

> F_t=1-L_t 
Error in 1 - L_t : non-numeric argument to binary operator

L_t is a list. You cannot subtract a list (at least in R). I'm not sure what 
you think F_t is supposed to be and you don't seem to use it. If you are 
attempting to calculate the Hazard function, it's just:

str(L_t) # note the hazard component of that list.

 res$hazard

 [1] 0.03958 0.04121 0.04299 0.04492 0.04703 0.04935 0.05191 0.05476
 [9] 0.05793 0.06149 0.06552 0.07011 0.07540 0.08155 0.08879 0.09744
[17] 0.10795 0.12102 0.13768 0.15966 0.19000 0.23457 0.30645 0.44186
[25] 1.0

For some interpretations of your question, this may be what you are seeking. 
It's the Pr( X > t )

>   
> par(mfrow=c(1,1))
> plot(L_t$time,L_t$survival,type="s",lty=2:3,lwd=2,las=1,cex.lab=1.1,font.lab=2,col="red",xlab="temps",ylab="L(t)",main="Esitmation
>  de la Fonction de Survie L(t)")
> 
> 
> i need to calculate the probability p(X>V)

As I see it the probability of X>V is:

sum(X > V)
[1] 0

And I see this as a matter of definition. I'm guessing you wanted the estimated 
Hazard. If I'm wrong, I wonder if you can rephrase the question so it makes 
more sense to a general statistical audience. What is the subject matter of the 
investigation?


-- 
David
> 
>Le jeudi 10 mai 2018 à 17:15:06 UTC+2, John Kane  a 
> écrit :  
> 
> We need some idea of the problem.
> 
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> 
> 
> http://adv-r.had.co.nz/Reproducibility.html
> 
> 
> 
>On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help 
>  wrote:  
> 
> 
> Hello 
> 
> Do You help me, i have the problem in the package DTDA for  find the 
> probability of truncation  (alpha)
> thank you
> 
> [[alternative HTML version deleted]]
> 
> __
> [email protected] 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]]
> 
> __
> [email protected] 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

__
[email protected] 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] (no subject)

2018-05-12 Thread John Kane via R-help
 Thanks I think that may help but it is outside my small area of knowledge. 
With any luck, someone will be along soon to give some help.
Why are using attach(res)? I don't see the need.
Good luck.

On Saturday, May 12, 2018, 12:50:24 p.m. EDT, malika yassa 
 wrote:  
 
  
hello
for exampl, i have this programme
# Generating data which are right truncated
library(DTDA)
library(splines)
library(survival)
n<-25
X<-runif(n,0,1)
V<-runif(n,0.75,1)
for (i in 1:n){
while (X[i]>V[i]){
X[i]<-runif(1,0,1)
V[i]<-runif(1,0.75,1)
}}
res<-lynden(X=X,U=NA, V=V, boot=TRUE)
attach(res)
temps = time
M_i = n.event
L_t = res
F_t=1-L_t     
par(mfrow=c(1,1))
plot(L_t$time,L_t$survival,type="s",lty=2:3,lwd=2,las=1,cex.lab=1.1,font.lab=2,col="red",xlab="temps",ylab="L(t)",main="Esitmation
 de la Fonction de Survie L(t)")


i need to calculate the probability p(X>V)
Le jeudi 10 mai 2018 à 17:15:06 UTC+2, John Kane  a 
écrit :  
 
 We need some idea of the problem.

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


http://adv-r.had.co.nz/Reproducibility.html

 

On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help 
 wrote:  
 
 
Hello 

Do You help me, i have the problem in the package DTDA for  find the 
probability of truncation  (alpha)
thank you

    [[alternative HTML version deleted]]

__
[email protected] 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]]

__
[email protected] 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] (no subject)

2018-05-12 Thread malika yassa via R-help
 
hello
for exampl, i have this programme
# Generating data which are right truncated
library(DTDA)
library(splines)
library(survival)
n<-25
X<-runif(n,0,1)
V<-runif(n,0.75,1)
for (i in 1:n){
while (X[i]>V[i]){
X[i]<-runif(1,0,1)
V[i]<-runif(1,0.75,1)
}}
res<-lynden(X=X,U=NA, V=V, boot=TRUE)
attach(res)
temps = time
M_i = n.event
L_t = res
F_t=1-L_t     
par(mfrow=c(1,1))
plot(L_t$time,L_t$survival,type="s",lty=2:3,lwd=2,las=1,cex.lab=1.1,font.lab=2,col="red",xlab="temps",ylab="L(t)",main="Esitmation
 de la Fonction de Survie L(t)")


i need to calculate the probability p(X>V)
Le jeudi 10 mai 2018 à 17:15:06 UTC+2, John Kane  a 
écrit :  
 
 We need some idea of the problem.

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


http://adv-r.had.co.nz/Reproducibility.html

 

On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help 
 wrote:  
 
 
Hello 

Do You help me, i have the problem in the package DTDA for  find the 
probability of truncation  (alpha)
thank you

    [[alternative HTML version deleted]]

__
[email protected] 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]]

__
[email protected] 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] (no subject)

2018-05-10 Thread John Kane via R-help
We need some idea of the problem.

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


http://adv-r.had.co.nz/Reproducibility.html

 

On Thursday, May 10, 2018, 11:07:30 a.m. EDT, malika yassa via R-help 
 wrote:  
 
 
Hello 

Do You help me, i have the problem in the package DTDA for  find the 
probability of truncation  (alpha)
thank you

    [[alternative HTML version deleted]]

__
[email protected] 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]]

__
[email protected] 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] (no subject)

2017-09-13 Thread David Brayford

Hi Duncan,

The output of gsl-config --version
2.3

The output of gsl-config --cflags
-I/lrz/sys/libraries/gsl/2.3/include

The output of gsl-config --libs
-L/lrz/sys/libraries/gsl/2.3/lib -lgsl -lgslcblas -lm

gsl_version.h cat output
#define GSL_VERSION "2.3"
#define GSL_MAJOR_VERSION 2
#define GSL_MINOR_VERSION 3

It's puzzling.

David

On 09/13/2017 02:57 PM, Duncan Murdoch wrote:

On 13/09/2017 5:23 AM, Brayford, David wrote:
When I try to install gsl in R I get the error Need GSL version >= 
1.12 . However, I have version 2.3 of gsl installed on the system, 
which is picked up earlier in the configure process (see below). Is 
it possible for someone to fix this error in the configure script?


checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.12
ERROR: configuration failed for package �gsl�




As Berend said, this should be talked about with the maintainer. It 
would be helpful if you could show more detail of the test that failed.


For example, what does

/lrz/sys/libraries/gsl/2.3/bin/gsl-config --version --cflags

print?  For me, the second line from gsl-config is

-I/usr/local/Cellar/gsl/1.16/include

and I can see using

less /usr/local/Cellar/gsl/1.16/include/gsl/gsl_version.h

that the macros are defined as

#define GSL_VERSION "1.16"
#define GSL_MAJOR_VERSION 1
#define GSL_MINOR_VERSION 16

Presumably you'll get something else...

Duncan Murdoch



__
[email protected] 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] (no subject)

2017-09-13 Thread Peter Dalgaard

> On 13 Sep 2017, at 16:01 , Duncan Murdoch  wrote:
> 
> On 13/09/2017 9:10 AM, David Brayford wrote:
>> Hi Duncan,
>> The output of gsl-config --version
>> 2.3
>> The output of gsl-config --cflags
>> -I/lrz/sys/libraries/gsl/2.3/include
>> The output of gsl-config --libs
>> -L/lrz/sys/libraries/gsl/2.3/lib -lgsl -lgslcblas -lm
>> gsl_version.h cat output
>> #define GSL_VERSION "2.3"
>> #define GSL_MAJOR_VERSION 2
>> #define GSL_MINOR_VERSION 3
>> It's puzzling.
> 
> Sure is.  I can't see what would be going wrong.


Two ideas: 

1. The include file might be there but not the actual library (or a different 
version gets picked up via an -L setting)
2. The error message can be spurious and reflect a completely different 
problem. It looks a little odd that the ERROR does not appear immediately after 
"checking if GSL version >= 1.12..." (is some sort of parallel make going on, 
perchance?)

If push comes to shove, you may have to learn how to decipher config.log etc. 
to see exactly which test is failing and why.

-pd


> 
> Duncan Murdoch
> 
>> David
>> On 09/13/2017 02:57 PM, Duncan Murdoch wrote:
>>> On 13/09/2017 5:23 AM, Brayford, David wrote:
 When I try to install gsl in R I get the error Need GSL version >=
 1.12 . However, I have version 2.3 of gsl installed on the system,
 which is picked up earlier in the configure process (see below). Is
 it possible for someone to fix this error in the configure script?
 
 checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
 checking if GSL version >= 1.12... checking for gcc... gcc
 checking for C compiler default output file name... a.out
 checking whether the C compiler works... yes
 checking whether we are cross compiling... no
 checking for suffix of executables...
 checking for suffix of object files... o
 checking whether we are using the GNU C compiler... yes
 checking whether gcc accepts -g... yes
 checking for gcc option to accept ISO C89... none needed
 configure: error: Need GSL version >= 1.12
 ERROR: configuration failed for package �gsl�
 
>>> 
>>> 
>>> As Berend said, this should be talked about with the maintainer. It
>>> would be helpful if you could show more detail of the test that failed.
>>> 
>>> For example, what does
>>> 
>>> /lrz/sys/libraries/gsl/2.3/bin/gsl-config --version --cflags
>>> 
>>> print?  For me, the second line from gsl-config is
>>> 
>>> -I/usr/local/Cellar/gsl/1.16/include
>>> 
>>> and I can see using
>>> 
>>> less /usr/local/Cellar/gsl/1.16/include/gsl/gsl_version.h
>>> 
>>> that the macros are defined as
>>> 
>>> #define GSL_VERSION "1.16"
>>> #define GSL_MAJOR_VERSION 1
>>> #define GSL_MINOR_VERSION 16
>>> 
>>> Presumably you'll get something else...
>>> 
>>> Duncan Murdoch
>>> 
>> 
> 
> __
> [email protected] 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [email protected]  Priv: [email protected]

__
[email protected] 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] (no subject)

2017-09-13 Thread Duncan Murdoch

On 13/09/2017 9:10 AM, David Brayford wrote:

Hi Duncan,

The output of gsl-config --version
2.3

The output of gsl-config --cflags
-I/lrz/sys/libraries/gsl/2.3/include

The output of gsl-config --libs
-L/lrz/sys/libraries/gsl/2.3/lib -lgsl -lgslcblas -lm

gsl_version.h cat output
#define GSL_VERSION "2.3"
#define GSL_MAJOR_VERSION 2
#define GSL_MINOR_VERSION 3

It's puzzling.


Sure is.  I can't see what would be going wrong.

Duncan Murdoch



David

On 09/13/2017 02:57 PM, Duncan Murdoch wrote:

On 13/09/2017 5:23 AM, Brayford, David wrote:

When I try to install gsl in R I get the error Need GSL version >=
1.12 . However, I have version 2.3 of gsl installed on the system,
which is picked up earlier in the configure process (see below). Is
it possible for someone to fix this error in the configure script?

checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.12
ERROR: configuration failed for package �gsl�




As Berend said, this should be talked about with the maintainer. It
would be helpful if you could show more detail of the test that failed.

For example, what does

/lrz/sys/libraries/gsl/2.3/bin/gsl-config --version --cflags

print?  For me, the second line from gsl-config is

-I/usr/local/Cellar/gsl/1.16/include

and I can see using

less /usr/local/Cellar/gsl/1.16/include/gsl/gsl_version.h

that the macros are defined as

#define GSL_VERSION "1.16"
#define GSL_MAJOR_VERSION 1
#define GSL_MINOR_VERSION 16

Presumably you'll get something else...

Duncan Murdoch





__
[email protected] 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] (no subject)

2017-09-13 Thread Duncan Murdoch

On 13/09/2017 5:23 AM, Brayford, David wrote:

When I try to install gsl in R I get the error Need GSL version >= 1.12 . 
However, I have version 2.3 of gsl installed on the system, which is picked up 
earlier in the configure process (see below). Is it possible for someone to fix 
this error in the configure script?

checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
checking if GSL version >= 1.12... checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
configure: error: Need GSL version >= 1.12
ERROR: configuration failed for package �gsl�




As Berend said, this should be talked about with the maintainer.  It 
would be helpful if you could show more detail of the test that failed.


For example, what does

/lrz/sys/libraries/gsl/2.3/bin/gsl-config --version --cflags

print?  For me, the second line from gsl-config is

-I/usr/local/Cellar/gsl/1.16/include

and I can see using

less /usr/local/Cellar/gsl/1.16/include/gsl/gsl_version.h

that the macros are defined as

#define GSL_VERSION "1.16"
#define GSL_MAJOR_VERSION 1
#define GSL_MINOR_VERSION 16

Presumably you'll get something else...

Duncan Murdoch

__
[email protected] 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] (no subject)

2017-09-13 Thread Suzen, Mehmet
Hello David,

As error message says you have a version dependency not satisfied.
"error: Need GSL version >= 1.12". If you are using Ubuntu for example
you could do;
sudo apt-get install libgsl2

Or you can compile by yourself, I am sure there are people in LRZ can
help you on this:)

Best,
Mehmet

On 13 September 2017 at 11:23, Brayford, David  wrote:
> When I try to install gsl in R I get the error Need GSL version >= 1.12 . 
> However, I have version 2.3 of gsl installed on the system, which is picked 
> up earlier in the configure process (see below). Is it possible for someone 
> to fix this error in the configure script?
>
> checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
> checking if GSL version >= 1.12... checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> configure: error: Need GSL version >= 1.12
> ERROR: configuration failed for package ‘gsl’
>
>
> David
>
>
> [[alternative HTML version deleted]]
>
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2017-09-13 Thread Berend Hasselman

> On 13 Sep 2017, at 11:23, Brayford, David  wrote:
> 
> When I try to install gsl in R I get the error Need GSL version >= 1.12 . 
> However, I have version 2.3 of gsl installed on the system, which is picked 
> up earlier in the configure process (see below). Is it possible for someone 
> to fix this error in the configure script?
> 
> checking for gsl-config... /lrz/sys/libraries/gsl/2.3/bin/gsl-config
> checking if GSL version >= 1.12... checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ISO C89... none needed
> configure: error: Need GSL version >= 1.12
> ERROR: configuration failed for package �gsl�
> 

Why don't you send an email to the maintainer of the package?


Berend Hasselman

__
[email protected] 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] (no subject)

2017-06-17 Thread Jeff Newmiller
You desperately need to read the Posting Guide...

A) There is a no homework policy on this list. If this is for a class, stop now 
and go use the assistance resources offered by your educational institution. 

B) This is a plain text mailing list so the table formatting you saw when you 
sent this email got stripped leaving a mess for us to be confused by. Use plain 
text and R code to assemble your question (one useful function for sending data 
is dput).

C) This is the R-help list, not the R-do-my-work-for-me mailing list. You show 
us a _small_ example of code with data that gets you part of the way to your 
desired result or shows what error messages you encountered and clearly 
describe to us what result you want, and we help you over your hurdle. Some 
help with reproducible examples [1][2][3]

D) I suspect that you should show us what you have done with data for one 
year... "initialize the value" is unclear; why you would want to remove values 
is unclear. The other issue is applying this to multiple years, which should be 
addressed later. 

Do not assume that reading these highlights absolves you of your obligation to 
read the Posting Guide. See the footer below. 

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html

[3] https://cran.r-project.org/web/packages/reprex/index.html

-- 
Sent from my phone. Please excuse my brevity.

On June 17, 2017 7:15:43 AM PDT, "Sharma, Sonisa"  wrote:
>I have 4 years of data and for each year, I have initialize the value
>so now for fitting the model, I want to remove the initial value and
>get the model based on remaining data set. Could anyone can help on
>this?
>I want to get linear model based on fourth column and 13th column but
>need to remove the initial value for each year and each treatment ( the
>second column I have 1:36) .
>
>Thank you,
>
>Sonisa
>
>
>
>1
>
>1
>
>2012-05-24
>
>3120.0
>
>0.253
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>2
>
>1
>
>2012-05-24
>
>1789.85870
>
>0.143
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>3
>
>1
>
>2012-05-24
>
>1391.48108
>
>0.143
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>4
>
>1
>
>2012-05-24
>
>2080.0
>
>0.227
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>5
>
>1
>
>2012-05-24
>
>1640.0
>
>0.223
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>6
>
>1
>
>2012-05-24
>
>3662.57591
>
>0.290
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>7
>
>1
>
>2012-05-24
>
>1280.0
>
>0.187
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-1
>
>8
>
>1
>
>2012-05-24
>
>2031.31522
>
>0.250
>
>1
>
>2
>
>1
>
>2.1
>
>0
>
>2.18
>
>1260
>
>275
>
>4125
>
>1
>
>0
>
>0
>
>3144
>
>1535
>
>0
>
>0
>
>0
>
>0
>
>0
>
>0.000
>
>0.000
>
>0.000
>
>0
>
>3.13
>
>0
>
>0
>
>0
>
>0
>
>173.1
>
>0.0
>
>0.02
>
>0
>
>0.85
>
>2.76
>
>2.80
>
>2.93
>
>2.93
>
>2.93
>
>2.85
>
>2.84
>
>2.82
>
>2.80
>
>0
>
>7965
>
>6264
>
>1701
>
>8
>
>2012 Pasture 9-

Re: [R] (no subject)

2017-06-15 Thread David Winsemius

> On Jun 15, 2017, at 3:05 PM, oussama bouldjedri  
> wrote:
> 
> Hi every one I am working on shiny app using bnlearn for Bayesian networks 
> and using r studio I get a fatal error and when I use R GUI I get this error
> 
> ** caught segfault ***
> 
> address 0xfffc0fcd6248, cause 'memory not mapped' Traceback: 1:
> .Call("mappred", node = node, fitted = fitted, data = data, n =
> as.integer(n), from = from, prob = prob, debug = debug) 2:
> map.prediction(node = node, fitted = object, data = data, n =
> extra.args$n, from = extra.args$from, prob = prob, debug = debug) 3:
> predict.bn.fit(values10$fitted, input$targetvariables, combn2, prob =
> TRUE, method = "bayes-lw") 4: predict(values10$fitted,
> input$targetvariables, combn2, prob = TRUE, method = "bayes-lw") 5:
> t(attr(predict(values10$fitted, input$targetvariables, combn2, prob =
> TRUE, method = "bayes-lw"), "prob")) 6: observeEventHandler(...) 7:
> ..stacktraceon..(observeEventHandler(...)) 8: handlerFunc() 9:
> ..stacktraceon..(expr) 10: contextFunc() 11: env$runWith(self, func)
> 12: withReactiveDomain(.domain, { env <- .getReactiveEnvironment()
> .graphEnterContext(id) on.exit(.graphExitContext(id), add = TRUE)
> env$runWith(self, func)}). ..
> 
> 
> I tried to get the latest version of R and rstudio but it still happens
> 
> is it my computer memory that is small ?? or something else

As I already told you on SO, you should send a reproducible example to the 
maintainer.

> 
> thanks in advance
> 
> 
> 
> best regards
> 
>   [[alternative HTML version deleted]]

I did not suggest cross-posting to Rhelp, but if you are going to do so in the 
future, could you please read the posting guide and set up your email client to 
post in plain text?

(I doubt this error is due to RStudio or R. Shiny ... perhaps. "bnlearn" ... 
most probably.)

> 
> __
> [email protected] 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.

David Winsemius
Alameda, CA, USA

__
[email protected] 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] (no subject)

2017-05-30 Thread David Winsemius

> On May 30, 2017, at 11:18 AM, Pedro páramo  wrote:
> 
> I have seen that the vector of dates could be:
> 
> itemizeDates(startDate="12-30-11", endDate="1-4-12")
> 
> How can I say "today" without having to declare the endDate?
> 
> Finally, if you can help mi with the plot would be very helpfull

Look at:

?Sys.Date
# And
?axis

--

David.

> 
> 
> 
> 2017-05-30 19:41 GMT+02:00 Pedro páramo :
> 
>> Hi all,
>> 
>> I get started with R till many time ago.
>> 
>> I want to make a function that makes a plot with several inputs.
>> 
>> First of all, the first input is a date 01/01/2014.
>> 
>> I make a plot of a calculated series from 01/01/2014 till TODAY.
>> 
>> How can I make this vector authomatically without calculating in Excel?
>> 
>> Then I have a value for instance 6 and then a value 30.000
>> 
>> So each day the associated vector minorates 6.
>> 
>> the final matrix will be somenting like this
>> 
>> result
>> 
>> 01/01/2014 3
>> 02/01/2014  29994
>> 03/01/2014 29988
>> ...
>> 
>> 30/05/2017 (today)
>> 
>> Finally I want to plot the series but with left and right axis on de Y
>> (the horizontal axes is time)
>> 
>> Can you guide me?
>> 
>> I´m reading manual but I need it urgently so please receive my apologuises
>> if it is not very clever to ask help for you.
>> 
>> I´m sure I will achive but if you can guide me I will earn time to learn
>> what I need.
>> 
>> Many thanks in advance
>> 
>> 
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> [email protected] 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.

David Winsemius
Alameda, CA, USA

__
[email protected] 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] (no subject)

2017-05-30 Thread Pedro páramo
I have seen that the vector of dates could be:

itemizeDates(startDate="12-30-11", endDate="1-4-12")

How can I say "today" without having to declare the endDate?

Finally, if you can help mi with the plot would be very helpfull



2017-05-30 19:41 GMT+02:00 Pedro páramo :

> Hi all,
>
> I get started with R till many time ago.
>
> I want to make a function that makes a plot with several inputs.
>
> First of all, the first input is a date 01/01/2014.
>
> I make a plot of a calculated series from 01/01/2014 till TODAY.
>
> How can I make this vector authomatically without calculating in Excel?
>
> Then I have a value for instance 6 and then a value 30.000
>
> So each day the associated vector minorates 6.
>
> the final matrix will be somenting like this
>
> result
>
> 01/01/2014 3
> 02/01/2014  29994
> 03/01/2014 29988
> ...
> 
> 30/05/2017 (today)
>
> Finally I want to plot the series but with left and right axis on de Y
> (the horizontal axes is time)
>
> Can you guide me?
>
> I´m reading manual but I need it urgently so please receive my apologuises
> if it is not very clever to ask help for you.
>
> I´m sure I will achive but if you can guide me I will earn time to learn
> what I need.
>
> Many thanks in advance
>
>
>

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2017-03-24 Thread Bert Gunter
Please read and follow the directions at the bottom of your email.

-- 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 Thu, Mar 23, 2017 at 9:55 AM, munevver kaya  wrote:
> Dear Sir/Madam,
> I do not want to receive any email by r-help. Can you delete me in your
> mail list? Thank you.
>
> Sincerely,
> Munevver Basman
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2017-03-23 Thread Jim Lemon
Hi Munevver,

Go here:

https://stat.ethz.ch/mailman/listinfo/r-help

which is probably where you subscribed, and

UNSUBSCRIBE

Jim

On Fri, Mar 24, 2017 at 3:55 AM, munevver kaya  wrote:
> Dear Sir/Madam,
> I do not want to receive any email by r-help. Can you delete me in your
> mail list? Thank you.
>
> Sincerely,
> Munevver Basman
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2017-03-23 Thread Peter Dalgaard
The recipe for unsubscribing is in the footer of every r-help message. General 
readers of the list can not do it for you.

-pd

> On 23 Mar 2017, at 17:55 , munevver kaya  wrote:
> 
> Dear Sir/Madam,
> I do not want to receive any email by r-help. Can you delete me in your
> mail list? Thank you.
> 
> Sincerely,
> Munevver Basman
> 
>   [[alternative HTML version deleted]]
> 
> __
> [email protected] 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [email protected]  Priv: [email protected]

__
[email protected] 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] (no subject)

2017-03-05 Thread Bert Gunter
Well, this is your 3rd post to appear here with no replies. At what
point will you stop posting and realize that no one here is able or
willing to answer your almost incomprehensible post?

However, you might try to contact the package maintainer to see if
this is a bug ( -- you **have the latest version of the package**, do
you not?).

As for providing free consulting help  lots of luck with that!
Read the posting guide to learn what sort of help you can expect here.

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 Sat, Mar 4, 2017 at 9:59 AM, Nikhil Raj  wrote:
> hello Team R,
> i have been using R for statistical analysis of phylogeny and i have
> installed the required packages phangorn and phytools but whenever i give
> the command "pml.fit" the program stops and it appears thatb r for windows
> GUI has stopped etc..
> previously i thought it was a fault in my computer but it appears to happen
> the same when i give the command in any other computer.
> can i get a solution for this i have tried it on windows 10 and older
> versions can it be fixed?
> and also can you please send me the the commands for performing SH test of
> phylogeny using phangorn if possible.
> please do reply
>
> thank you
>
> [[alternative HTML version deleted]]
>
> __
> [email protected] 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.

__
[email protected] 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] (no subject)

2017-01-31 Thread PIKAL Petr
Hi

Of course you have fewer values than in original data.

> x<-1:21

> length(rowSums(embed(x,3)))
[1] 19
> length(x)
[1] 21

> embed(x,3)
  [,1] [,2] [,3]
[1,]321
[2,]432
[3,]543
[4,]654
[5,]765
[6,]876
[7,]987
[8,]   1098
[9,]   11   109
[10,]   12   11   10
[11,]   13   12   11
[12,]   14   13   12
[13,]   15   14   13
[14,]   16   15   14
[15,]   17   16   15
[16,]   18   17   16
[17,]   19   18   17
[18,]   20   19   18
[19,]   21   20   19

You need to prepend or append 2 NA values if you want to add newly computed 
values to old data.

or extend your original vector by 2 values

length(rowSums(embed(c(NA, NA, x),3), na.rm=T))
[1] 21

Cheers
Petr


From: Kwesi Quagraine [mailto:[email protected]]
Sent: Monday, January 30, 2017 6:29 PM
To: PIKAL Petr 
Cc: Jeff Newmiller ; [email protected]
Subject: Re: [R] (no subject)

Upon trying this method, I get an error ;

Error in `$<-.data.frame`(`*tmp*`, "MEImeans", value = c(0.313162987462034,  :
  replacement has 442 rows, data has 444
Any thoughts?
Kwesi

On Mon, Jan 30, 2017 at 5:37 PM, PIKAL Petr 
mailto:[email protected]>> wrote:
Hi

Probably just a small correction.

d3 <- embed( dta$MEI, 3)

Cheers
Petr

> -Original Message-
> From: R-help 
> [mailto:[email protected]<mailto:[email protected]>] On 
> Behalf Of Jeff
> Newmiller
> Sent: Monday, January 30, 2017 4:19 PM
> To: [email protected]<mailto:[email protected]>; Kwesi Quagraine 
> mailto:[email protected]>>
> Subject: Re: [R] (no subject)
>
> How you proceed depends on how consistent the data are and on what you
> want to do with those sets of three months after you have identified them.
>
> One approach is to create a matrix where each row contains the values
> corresponding to the "second previous", "previous", and "current" months
> data, respectively using the embed() function. The first two rows would be
> incomplete because the earlier data are missing there:
>
> d3 <- embed( dta$MEI )
>
> with which you could compute whatever metric you wanted. For example
> you could compute rolling means:
>
> dta$MEImeans <- rowMeans( d3 )
>
> If your data have missing rows you might need to use the aggregate or
> merge functions instead.
>
> For specific layouts of data or metrics you can find specialized functions in
> various packages. You might want to search using the R "sos" package or
> Google for your analysis method of choice.
> --
> Sent from my phone. Please excuse my brevity.
>
> On January 30, 2017 6:11:48 AM PST, Kwesi Quagraine
> mailto:[email protected]>> wrote:
> >Hello, I have a data with two variables nodes and index, I want to
> >extract
> >3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc
> >to OND. Was wondering how to go about it. Kindly find data sample
> >below, data is in csv format.
> >Any help will be appreciated.
> >
> >My data sample;
> >
> >  era...1.Node_freq   MEI
> >1   1980-01-01 -0.389855332  0.3394196488
> >2 1980-02-01 -0.728019153  
> >0.2483738232
> >3   1980-03-01 -1.992457784  0.3516954904
> >4   1980-04-01  0.222760284  0.5736836269
> >5   1980-05-01  0.972601798  0.6289249144
> >6   1980-06-01  0.570725954  0.5736836269
> >7   1980-07-01 -0.977966324  0.4120517119
> >8   1980-08-01  0.056128836 -0.0104418383
> >9   1980-09-01  0.987304573 -0.0687520861
> >10  1980-10-01  1.188242495 -0.1403611624
> >11  1980-11-01  1.693037763 -0.0963727298
> >12  1980-12-01  1.173539720 -0.2539126977
> >13  1981-01-01  0.423698206 -0.6140040528
> >14  1981-02-01 -2.208098481 -0.5209122536
> >15  1981-03-01 -0.786830252  0.1133395650
> >16  1981-04-01 -0.110502611  0.3302127675
> >17  1981-05-01 -1.272021820 -0.1894645290
> >18  1981-06-01  0.394292656 -0.3736021538
> >19  1981-07-01  1.452892441 -0.4032687711
> >20  1981-08-01  0.698150002 -0.4441882433
> >21  1981-09-01  0.997106423 -0.1720737534
> >22  1981-10-01  0.247264908 -0.2436828296
> >23  1981-11-01  0.771663876 -0.3909929295
> >24  1981-12-01 -0.316341458 -0.4943145967
> >
> >Regards,
> >​Kwesi​
> >
> >--
> >Try not to become a man of success but rather a man of value-Albert
> >Einstein
> >
> >University of Cape Coast|College of Agriculture and Natural
> >Sciences|Department
> >of Physics|
> >Team Leader|Recycle Up! Ghana|Technology Without Borders| Other
> emails:
> >[email protected]<mailto:kwesi.quagra...@u

Re: [R] (no subject)

2017-01-30 Thread Jeff Newmiller
Try

d3 <- embed( c( NA, NA, dta$MEI ), 3)

-- 
Sent from my phone. Please excuse my brevity.

On January 30, 2017 9:28:52 AM PST, Kwesi Quagraine  
wrote:
>Upon trying this method, I get an error ;
>
>Error in `$<-.data.frame`(`*tmp*`, "MEImeans", value =
>c(0.313162987462034,  :
>  replacement has 442 rows, data has 444
>
>Any thoughts?
>
>Kwesi
>
>On Mon, Jan 30, 2017 at 5:37 PM, PIKAL Petr 
>wrote:
>
>> Hi
>>
>> Probably just a small correction.
>>
>> d3 <- embed( dta$MEI, 3)
>>
>> Cheers
>> Petr
>>
>> > -Original Message-
>> > From: R-help [mailto:[email protected]] On Behalf Of
>Jeff
>> > Newmiller
>> > Sent: Monday, January 30, 2017 4:19 PM
>> > To: [email protected]; Kwesi Quagraine 
>> > Subject: Re: [R] (no subject)
>> >
>> > How you proceed depends on how consistent the data are and on what
>you
>> > want to do with those sets of three months after you have
>identified
>> them.
>> >
>> > One approach is to create a matrix where each row contains the
>values
>> > corresponding to the "second previous", "previous", and "current"
>months
>> > data, respectively using the embed() function. The first two rows
>would
>> be
>> > incomplete because the earlier data are missing there:
>> >
>> > d3 <- embed( dta$MEI )
>> >
>> > with which you could compute whatever metric you wanted. For
>example
>> > you could compute rolling means:
>> >
>> > dta$MEImeans <- rowMeans( d3 )
>> >
>> > If your data have missing rows you might need to use the aggregate
>or
>> > merge functions instead.
>> >
>> > For specific layouts of data or metrics you can find specialized
>> functions in
>> > various packages. You might want to search using the R "sos"
>package or
>> > Google for your analysis method of choice.
>> > --
>> > Sent from my phone. Please excuse my brevity.
>> >
>> > On January 30, 2017 6:11:48 AM PST, Kwesi Quagraine
>> >  wrote:
>> > >Hello, I have a data with two variables nodes and index, I want to
>> > >extract
>> > >3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA
>etc
>> > >to OND. Was wondering how to go about it. Kindly find data sample
>> > >below, data is in csv format.
>> > >Any help will be appreciated.
>> > >
>> > >My data sample;
>> > >
>> > >  era...1.Node_freq   MEI
>> > >1   1980-01-01 -0.389855332  0.3394196488
>> > >2 1980-02-01 -0.728019153  0.2483738232
>> > >3   1980-03-01 -1.992457784  0.3516954904
>> > >4   1980-04-01  0.222760284  0.5736836269
>> > >5   1980-05-01  0.972601798  0.6289249144
>> > >6   1980-06-01  0.570725954  0.5736836269
>> > >7   1980-07-01 -0.977966324  0.4120517119
>> > >8   1980-08-01  0.056128836 -0.0104418383
>> > >9   1980-09-01  0.987304573 -0.0687520861
>> > >10  1980-10-01  1.188242495 -0.1403611624
>> > >11  1980-11-01  1.693037763 -0.0963727298
>> > >12  1980-12-01  1.173539720 -0.2539126977
>> > >13  1981-01-01  0.423698206 -0.6140040528
>> > >14  1981-02-01 -2.208098481 -0.5209122536
>> > >15  1981-03-01 -0.786830252  0.1133395650
>> > >16  1981-04-01 -0.110502611  0.3302127675
>> > >17  1981-05-01 -1.272021820 -0.1894645290
>> > >18  1981-06-01  0.394292656 -0.3736021538
>> > >19  1981-07-01  1.452892441 -0.4032687711
>> > >20  1981-08-01  0.698150002 -0.4441882433
>> > >21  1981-09-01  0.997106423 -0.1720737534
>> > >22  1981-10-01  0.247264908 -0.2436828296
>> > >23  1981-11-01  0.771663876 -0.3909929295
>> > >24  1981-12-01 -0.316341458 -0.4943145967
>> > >
>> > >Regards,
>> > >​Kwesi​
>> > >
>> > >--
>> > >Try not to become a man of success but rather a man of
>value-Albert
>> > >Einstein
>> > >
>> > >University of Cape Coast|College of Agriculture and Natural
>> > >Sciences|Department
>> > >of Physics|
>> > >Team Leader|Recycle Up! Ghana|Technology Without Borders| Other
>> > emails:
>> > >[email protected]|[email protected]|
>> > >Mobile: +233266173582
>> > >Skype: quagraine_cwasi
>&g

Re: [R] (no subject)

2017-01-30 Thread Kwesi Quagraine
Thanks for your suggestion. I am much grateful.

Kwesi

On Mon, Jan 30, 2017 at 4:23 PM, Robert Sherry  wrote:

> Here is one thought. Assign each month a value of 0, 1 or 2. Then do a
> simple linear regression analysis where the value of the month
> is the independent variable. You can also do multiple linear regression
> with the value you assigned to the month plus the other factors that
> you believe are causing a change to your data. Time is the one that comes
> to my mind. You can do this with the standard R function lm.
>
> I hope this helps.
>
> Bob
>
>
> On 1/30/2017 9:11 AM, Kwesi Quagraine wrote:
>
>> Hello, I have a data with two variables nodes and index, I want to extract
>> 3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc to
>> OND. Was wondering how to go about it. Kindly find data sample below, data
>> is in csv format.
>> Any help will be appreciated.
>>
>> My data sample;
>>
>>era...1.Node_freq   MEI
>> 1   1980-01-01 -0.389855332  0.3394196488
>> 2 1980-02-01 -0.728019153  0.2483738232
>> 3 1980-03-01 -1.992457784  0.3516954904
>> 4 1980-04-01 0.222760284  0.5736836269
>> 5 1980-05-01 0.972601798 0.6289249144
>> 6 1980-06-01 0.570725954 0.5736836269
>> 7 1980-07-01 -0.977966324  0.4120517119
>> 8 1980-08-01 0.056128836 -0.0104418383
>> 9 1980-09-01 0.987304573 -0.0687520861
>> 10  1980-10-01  1.188242495 -0.1403611624
>> 11  1980-11-01  1.693037763 -0.0963727298
>> 12 1980-12-01 1.173539720 -0.2539126977
>> 13 1981-01-01 0.423698206 -0.6140040528
>> 14 1981-02-01 -2.208098481 -0.5209122536
>> 15 1981-03-01 -0.786830252 0.1133395650
>> 16 1981-04-01 -0.110502611  0.3302127675
>> 17 1981-05-01 -1.272021820 -0.1894645290
>> 18 1981-06-01 0.394292656 -0.3736021538
>> 19 1981-07-01 1.452892441 -0.4032687711
>> 20  1981-08-01  0.698150002 -0.4441882433
>> 21  1981-09-01  0.997106423 -0.1720737534
>> 22  1981-10-01  0.247264908 -0.2436828296
>> 23  1981-11-01  0.771663876 -0.3909929295
>> 24  1981-12-01 -0.316341458 -0.4943145967
>>
>> Regards,
>> ​Kwesi​
>>
>>
> __
> [email protected] 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/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Try not to become a man of success but rather a man of value-Albert Einstein

University of Cape Coast|College of Agriculture and Natural Sciences|Department
of Physics|
Team Leader|Recycle Up! Ghana|Technology Without Borders|
Other emails: [email protected]|[email protected]|
Mobile: +233266173582
Skype: quagraine_cwasi
Twitter: @Pkdilly

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2017-01-30 Thread Kwesi Quagraine
Upon trying this method, I get an error ;

Error in `$<-.data.frame`(`*tmp*`, "MEImeans", value =
c(0.313162987462034,  :
  replacement has 442 rows, data has 444

Any thoughts?

Kwesi

On Mon, Jan 30, 2017 at 5:37 PM, PIKAL Petr  wrote:

> Hi
>
> Probably just a small correction.
>
> d3 <- embed( dta$MEI, 3)
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:[email protected]] On Behalf Of Jeff
> > Newmiller
> > Sent: Monday, January 30, 2017 4:19 PM
> > To: [email protected]; Kwesi Quagraine 
> > Subject: Re: [R] (no subject)
> >
> > How you proceed depends on how consistent the data are and on what you
> > want to do with those sets of three months after you have identified
> them.
> >
> > One approach is to create a matrix where each row contains the values
> > corresponding to the "second previous", "previous", and "current" months
> > data, respectively using the embed() function. The first two rows would
> be
> > incomplete because the earlier data are missing there:
> >
> > d3 <- embed( dta$MEI )
> >
> > with which you could compute whatever metric you wanted. For example
> > you could compute rolling means:
> >
> > dta$MEImeans <- rowMeans( d3 )
> >
> > If your data have missing rows you might need to use the aggregate or
> > merge functions instead.
> >
> > For specific layouts of data or metrics you can find specialized
> functions in
> > various packages. You might want to search using the R "sos" package or
> > Google for your analysis method of choice.
> > --
> > Sent from my phone. Please excuse my brevity.
> >
> > On January 30, 2017 6:11:48 AM PST, Kwesi Quagraine
> >  wrote:
> > >Hello, I have a data with two variables nodes and index, I want to
> > >extract
> > >3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc
> > >to OND. Was wondering how to go about it. Kindly find data sample
> > >below, data is in csv format.
> > >Any help will be appreciated.
> > >
> > >My data sample;
> > >
> > >  era...1.Node_freq   MEI
> > >1   1980-01-01 -0.389855332  0.3394196488
> > >2 1980-02-01 -0.728019153  0.2483738232
> > >3   1980-03-01 -1.992457784  0.3516954904
> > >4   1980-04-01  0.222760284  0.5736836269
> > >5   1980-05-01  0.972601798  0.6289249144
> > >6   1980-06-01  0.570725954  0.5736836269
> > >7   1980-07-01 -0.977966324  0.4120517119
> > >8   1980-08-01  0.056128836 -0.0104418383
> > >9   1980-09-01  0.987304573 -0.0687520861
> > >10  1980-10-01  1.188242495 -0.1403611624
> > >11  1980-11-01  1.693037763 -0.0963727298
> > >12  1980-12-01  1.173539720 -0.2539126977
> > >13  1981-01-01  0.423698206 -0.6140040528
> > >14  1981-02-01 -2.208098481 -0.5209122536
> > >15  1981-03-01 -0.786830252  0.1133395650
> > >16  1981-04-01 -0.110502611  0.3302127675
> > >17  1981-05-01 -1.272021820 -0.1894645290
> > >18  1981-06-01  0.394292656 -0.3736021538
> > >19  1981-07-01  1.452892441 -0.4032687711
> > >20  1981-08-01  0.698150002 -0.4441882433
> > >21  1981-09-01  0.997106423 -0.1720737534
> > >22  1981-10-01  0.247264908 -0.2436828296
> > >23  1981-11-01  0.771663876 -0.3909929295
> > >24  1981-12-01 -0.316341458 -0.4943145967
> > >
> > >Regards,
> > >​Kwesi​
> > >
> > >--
> > >Try not to become a man of success but rather a man of value-Albert
> > >Einstein
> > >
> > >University of Cape Coast|College of Agriculture and Natural
> > >Sciences|Department
> > >of Physics|
> > >Team Leader|Recycle Up! Ghana|Technology Without Borders| Other
> > emails:
> > >[email protected]|[email protected]|
> > >Mobile: +233266173582
> > >Skype: quagraine_cwasi
> > >Twitter: @Pkdilly
> > >
> > > [[alternative HTML version deleted]]
> > >
> > >__
> > >[email protected] 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.
> >
> > __
> > [email protected] mailing list -- To UNSUBSCRIBE and more, see
&g

Re: [R] (no subject)

2017-01-30 Thread Kwesi Quagraine
Hello Eric, thanks for the code, it seems to do something closer to what I
want. I generate JFM, FMA and so on, but it does not create the DJF at the
beginning. Any thoughts on that?

Kwesi

On Mon, Jan 30, 2017 at 6:01 PM, Erich Subscriptions <
[email protected]> wrote:

> Using dplyr and magrittr you could do the following
>
>
> -=-=-=-=-
> library(dplyr)
> library(magrittr)
>
> mydata  <- read.table(text="
>  era...1.Node_freq   MEI
> 1   1980-01-01 -0.389855332  0.3394196488
> 2 1980-02-01 -0.728019153  0.2483738232
> 3   1980-03-01 -1.992457784  0.3516954904
> 4   1980-04-01  0.222760284  0.5736836269
> 5   1980-05-01  0.972601798  0.6289249144
> 6   1980-06-01  0.570725954  0.5736836269
> 7   1980-07-01 -0.977966324  0.4120517119
> 8   1980-08-01  0.056128836 -0.0104418383
> 9   1980-09-01  0.987304573 -0.0687520861
> 10  1980-10-01  1.188242495 -0.1403611624
> 11  1980-11-01  1.693037763 -0.0963727298
> 12  1980-12-01  1.173539720 -0.2539126977
> 13  1981-01-01  0.423698206 -0.6140040528
> 14  1981-02-01 -2.208098481 -0.5209122536
> 15  1981-03-01 -0.786830252  0.1133395650
> 16  1981-04-01 -0.110502611  0.3302127675
> 17  1981-05-01 -1.272021820 -0.1894645290
> 18  1981-06-01  0.394292656 -0.3736021538
> 19  1981-07-01  1.452892441 -0.4032687711
> 20  1981-08-01  0.698150002 -0.4441882433
> 21  1981-09-01  0.997106423 -0.1720737534
> 22  1981-10-01  0.247264908 -0.2436828296
> 23  1981-11-01  0.771663876 -0.3909929295
> 24  1981-12-01 -0.316341458 -0.4943145967
> ")
>
> mydata %<>% mutate(Node_freq2=lead(Node_freq,1),Node_freq3=lead(Node_
> freq,2),MEI1=lead(MEI,1),MEI2=lead(MEI,3)) %>%
>   select(1,2,4,5,3,6,7)
>
> -=-==-=
>
> check if mydata ist what you want
>
>
>
>
>
>


-- 
Try not to become a man of success but rather a man of value-Albert Einstein

University of Cape Coast|College of Agriculture and Natural Sciences|Department
of Physics|
Team Leader|Recycle Up! Ghana|Technology Without Borders|
Other emails: [email protected]|[email protected]|
Mobile: +233266173582
Skype: quagraine_cwasi
Twitter: @Pkdilly

[[alternative HTML version deleted]]

__
[email protected] 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] (no subject)

2017-01-30 Thread Erich Subscriptions
Using dplyr and magrittr you could do the following


-=-=-=-=-
library(dplyr)
library(magrittr)

mydata  <- read.table(text="
 era...1.Node_freq   MEI
1   1980-01-01 -0.389855332  0.3394196488
2   1980-02-01 -0.728019153  0.2483738232
3   1980-03-01 -1.992457784  0.3516954904
4   1980-04-01  0.222760284  0.5736836269
5   1980-05-01  0.972601798  0.6289249144
6   1980-06-01  0.570725954  0.5736836269
7   1980-07-01 -0.977966324  0.4120517119
8   1980-08-01  0.056128836 -0.0104418383
9   1980-09-01  0.987304573 -0.0687520861
10  1980-10-01  1.188242495 -0.1403611624
11  1980-11-01  1.693037763 -0.0963727298
12  1980-12-01  1.173539720 -0.2539126977
13  1981-01-01  0.423698206 -0.6140040528
14  1981-02-01 -2.208098481 -0.5209122536
15  1981-03-01 -0.786830252  0.1133395650
16  1981-04-01 -0.110502611  0.3302127675
17  1981-05-01 -1.272021820 -0.1894645290
18  1981-06-01  0.394292656 -0.3736021538
19  1981-07-01  1.452892441 -0.4032687711
20  1981-08-01  0.698150002 -0.4441882433
21  1981-09-01  0.997106423 -0.1720737534
22  1981-10-01  0.247264908 -0.2436828296
23  1981-11-01  0.771663876 -0.3909929295
24  1981-12-01 -0.316341458 -0.4943145967
") 

mydata %<>% 
mutate(Node_freq2=lead(Node_freq,1),Node_freq3=lead(Node_freq,2),MEI1=lead(MEI,1),MEI2=lead(MEI,3))
 %>%
  select(1,2,4,5,3,6,7)

-=-==-=

check if mydata ist what you want

__
[email protected] 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] (no subject)

2017-01-30 Thread PIKAL Petr
Hi

Probably just a small correction.

d3 <- embed( dta$MEI, 3)

Cheers
Petr

> -Original Message-
> From: R-help [mailto:[email protected]] On Behalf Of Jeff
> Newmiller
> Sent: Monday, January 30, 2017 4:19 PM
> To: [email protected]; Kwesi Quagraine 
> Subject: Re: [R] (no subject)
>
> How you proceed depends on how consistent the data are and on what you
> want to do with those sets of three months after you have identified them.
>
> One approach is to create a matrix where each row contains the values
> corresponding to the "second previous", "previous", and "current" months
> data, respectively using the embed() function. The first two rows would be
> incomplete because the earlier data are missing there:
>
> d3 <- embed( dta$MEI )
>
> with which you could compute whatever metric you wanted. For example
> you could compute rolling means:
>
> dta$MEImeans <- rowMeans( d3 )
>
> If your data have missing rows you might need to use the aggregate or
> merge functions instead.
>
> For specific layouts of data or metrics you can find specialized functions in
> various packages. You might want to search using the R "sos" package or
> Google for your analysis method of choice.
> --
> Sent from my phone. Please excuse my brevity.
>
> On January 30, 2017 6:11:48 AM PST, Kwesi Quagraine
>  wrote:
> >Hello, I have a data with two variables nodes and index, I want to
> >extract
> >3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc
> >to OND. Was wondering how to go about it. Kindly find data sample
> >below, data is in csv format.
> >Any help will be appreciated.
> >
> >My data sample;
> >
> >  era...1.Node_freq   MEI
> >1   1980-01-01 -0.389855332  0.3394196488
> >2   1980-02-01 -0.728019153  0.2483738232
> >3   1980-03-01 -1.992457784  0.3516954904
> >4   1980-04-01  0.222760284  0.5736836269
> >5   1980-05-01  0.972601798  0.6289249144
> >6   1980-06-01  0.570725954  0.5736836269
> >7   1980-07-01 -0.977966324  0.4120517119
> >8   1980-08-01  0.056128836 -0.0104418383
> >9   1980-09-01  0.987304573 -0.0687520861
> >10  1980-10-01  1.188242495 -0.1403611624
> >11  1980-11-01  1.693037763 -0.0963727298
> >12  1980-12-01  1.173539720 -0.2539126977
> >13  1981-01-01  0.423698206 -0.6140040528
> >14  1981-02-01 -2.208098481 -0.5209122536
> >15  1981-03-01 -0.786830252  0.1133395650
> >16  1981-04-01 -0.110502611  0.3302127675
> >17  1981-05-01 -1.272021820 -0.1894645290
> >18  1981-06-01  0.394292656 -0.3736021538
> >19  1981-07-01  1.452892441 -0.4032687711
> >20  1981-08-01  0.698150002 -0.4441882433
> >21  1981-09-01  0.997106423 -0.1720737534
> >22  1981-10-01  0.247264908 -0.2436828296
> >23  1981-11-01  0.771663876 -0.3909929295
> >24  1981-12-01 -0.316341458 -0.4943145967
> >
> >Regards,
> >​Kwesi​
> >
> >--
> >Try not to become a man of success but rather a man of value-Albert
> >Einstein
> >
> >University of Cape Coast|College of Agriculture and Natural
> >Sciences|Department
> >of Physics|
> >Team Leader|Recycle Up! Ghana|Technology Without Borders| Other
> emails:
> >[email protected]|[email protected]|
> >Mobile: +233266173582
> >Skype: quagraine_cwasi
> >Twitter: @Pkdilly
> >
> > [[alternative HTML version deleted]]
> >
> >__
> >[email protected] 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.
>
> __
> [email protected] 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.


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail s

Re: [R] (no subject)

2017-01-30 Thread Jeff Newmiller
How you proceed depends on how consistent the data are and on what you want to 
do with those sets of three months after you have identified them.

One approach is to create a matrix where each row contains the values 
corresponding to the "second previous", "previous", and "current" months data, 
respectively using the embed() function. The first two rows would be incomplete 
because the earlier data are missing there:

d3 <- embed( dta$MEI )

with which you could compute whatever metric you wanted. For example you could 
compute rolling means:

dta$MEImeans <- rowMeans( d3 )

If your data have missing rows you might need to use the aggregate or merge 
functions instead. 

For specific layouts of data or metrics you can find specialized functions in 
various packages. You might want to search using the R "sos" package or Google 
for your analysis method of choice. 
-- 
Sent from my phone. Please excuse my brevity.

On January 30, 2017 6:11:48 AM PST, Kwesi Quagraine  
wrote:
>Hello, I have a data with two variables nodes and index, I want to
>extract
>3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc
>to
>OND. Was wondering how to go about it. Kindly find data sample below,
>data
>is in csv format.
>Any help will be appreciated.
>
>My data sample;
>
>  era...1.Node_freq   MEI
>1   1980-01-01 -0.389855332  0.3394196488
>2   1980-02-01 -0.728019153  0.2483738232
>3   1980-03-01 -1.992457784  0.3516954904
>4   1980-04-01  0.222760284  0.5736836269
>5   1980-05-01  0.972601798  0.6289249144
>6   1980-06-01  0.570725954  0.5736836269
>7   1980-07-01 -0.977966324  0.4120517119
>8   1980-08-01  0.056128836 -0.0104418383
>9   1980-09-01  0.987304573 -0.0687520861
>10  1980-10-01  1.188242495 -0.1403611624
>11  1980-11-01  1.693037763 -0.0963727298
>12  1980-12-01  1.173539720 -0.2539126977
>13  1981-01-01  0.423698206 -0.6140040528
>14  1981-02-01 -2.208098481 -0.5209122536
>15  1981-03-01 -0.786830252  0.1133395650
>16  1981-04-01 -0.110502611  0.3302127675
>17  1981-05-01 -1.272021820 -0.1894645290
>18  1981-06-01  0.394292656 -0.3736021538
>19  1981-07-01  1.452892441 -0.4032687711
>20  1981-08-01  0.698150002 -0.4441882433
>21  1981-09-01  0.997106423 -0.1720737534
>22  1981-10-01  0.247264908 -0.2436828296
>23  1981-11-01  0.771663876 -0.3909929295
>24  1981-12-01 -0.316341458 -0.4943145967
>
>Regards,
>​Kwesi​
>
>-- 
>Try not to become a man of success but rather a man of value-Albert
>Einstein
>
>University of Cape Coast|College of Agriculture and Natural
>Sciences|Department
>of Physics|
>Team Leader|Recycle Up! Ghana|Technology Without Borders|
>Other emails: [email protected]|[email protected]|
>Mobile: +233266173582
>Skype: quagraine_cwasi
>Twitter: @Pkdilly
>
>   [[alternative HTML version deleted]]
>
>__
>[email protected] 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.

__
[email protected] 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] (no subject)

2017-01-30 Thread Robert Sherry
Here is one thought. Assign each month a value of 0, 1 or 2. Then do a 
simple linear regression analysis where the value of the month
is the independent variable. You can also do multiple linear regression 
with the value you assigned to the month plus the other factors that
you believe are causing a change to your data. Time is the one that 
comes to my mind. You can do this with the standard R function lm.


I hope this helps.

Bob

On 1/30/2017 9:11 AM, Kwesi Quagraine wrote:

Hello, I have a data with two variables nodes and index, I want to extract
3 months seasons, with a shift of 1 month, that is, DJF, JFM, FMA etc to
OND. Was wondering how to go about it. Kindly find data sample below, data
is in csv format.
Any help will be appreciated.

My data sample;

   era...1.Node_freq   MEI
1   1980-01-01 -0.389855332  0.3394196488
2   1980-02-01 -0.728019153  0.2483738232
3   1980-03-01 -1.992457784  0.3516954904
4   1980-04-01  0.222760284  0.5736836269
5   1980-05-01  0.972601798  0.6289249144
6   1980-06-01  0.570725954  0.5736836269
7   1980-07-01 -0.977966324  0.4120517119
8   1980-08-01  0.056128836 -0.0104418383
9   1980-09-01  0.987304573 -0.0687520861
10  1980-10-01  1.188242495 -0.1403611624
11  1980-11-01  1.693037763 -0.0963727298
12  1980-12-01  1.173539720 -0.2539126977
13  1981-01-01  0.423698206 -0.6140040528
14  1981-02-01 -2.208098481 -0.5209122536
15  1981-03-01 -0.786830252  0.1133395650
16  1981-04-01 -0.110502611  0.3302127675
17  1981-05-01 -1.272021820 -0.1894645290
18  1981-06-01  0.394292656 -0.3736021538
19  1981-07-01  1.452892441 -0.4032687711
20  1981-08-01  0.698150002 -0.4441882433
21  1981-09-01  0.997106423 -0.1720737534
22  1981-10-01  0.247264908 -0.2436828296
23  1981-11-01  0.771663876 -0.3909929295
24  1981-12-01 -0.316341458 -0.4943145967

Regards,
​Kwesi​



__
[email protected] 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] (no subject)

2016-12-06 Thread John Kane via R-help
No attachment.  R-help; is very fussy about the type of file it will accept. 
Try a text document with .txt extention or just put the code and the sample 
data in the actual email. Use dput(), see ?dput for details, to provide the 
data.
 

On Tuesday, December 6, 2016 6:51 AM, michael tsagris via R-help 
 wrote:
 

 Hello, I have encountered a problem when running a glm with the inverse 
gaussian as distribution and the log as a link function. 
Do you think this could be a bug, or something else?Attached is a document to 
run the example. I have written my own functions and they seem to work fine. 
__
[email protected] 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]]

__
[email protected] 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] (no subject)

2016-10-13 Thread Jim Lemon
The crucial thing is probably:

"... they are translated to UTF-8 before comparison."

Although the first 127 characters seem to be identical to ASCII, in
which punctuation marks sorted before digits or letters, the encoding
to UTF-8 may make that impractical.

Jim


On Thu, Oct 13, 2016 at 8:55 PM, Bob O'Hara  wrote:
> Yes, thanks. That seems to be it:
>
> thing <- c("M1", "M2", "M.1", "M.2")
>> sort(thing)
> [1] "M1"  "M.1" "M2"  "M.2"
>
> The only documentation I can find is from ?Comparison:
> "Collation of non-letters (spaces, punctuation signs, hyphens,
> fractions and so on) is even more problematic."
>
> Indeed.
>
> Bob
>
> On 13 October 2016 at 11:26, PIKAL Petr  wrote:
>> Hi
>>
>> Just a wild guess. Dot is ignored and the output is alphabetically sorted.
>>
>> You could try sort it yourself by
>>
>> sort(ls())
>>
>> Cheers
>> Petr
>>
>>> -Original Message-
>>> From: R-help [mailto:[email protected]] On Behalf Of Bob
>>> O'Hara
>>> Sent: Thursday, October 13, 2016 10:29 AM
>>> To: r-help 
>>> Subject: [R] (no subject)
>>>
>>> I've just come across an odd problem with sorting in ls(): it doesn't seem 
>>> to
>>> order the object names correctly. If I do the following, the order isn't 
>>> what I
>>> expect:
>>>
>>> > ls(sorted=TRUE)
>>>  [1] "AridData"  "AridDataToBUGS""Arid.df"
>>> "Arid.hpd"  "AridPrecip.sd" "Break.df"
>>>  [7] "Break.hpd" "Cols"  "Data"
>>> "DataFrames""DataToBUGS""DataToBUGS.nonlog"
>>> [13] "FitBRugs"  "Fixed.df"  "Fixed.hpd"
>>> "FormatData""GetCol""GetHPD"
>>> [19] "GetMCMC"   "GetRow""HPDIs"
>>> "Int.alpha12"   "Int.alpha21"   "ModisData"
>>> [25] "ModisDataToBUGS"   "Modis.df"  "ModisFixed.df"
>>> "ModisFixed.hpd""Modis.hpd" "ModisPrecip.sd"
>>> [31] "ModisShrink.df""ModisShrink.hpd"   "ModisYears"
>>> "OrigData"  "OrigDataToBUGS""Orig.df"
>>> [37] "Orig.hpd"  "OrigPrecip.sd" "OrigYears"
>>> "PlotChecks""PlotEff"   "plothpd"
>>> [43] "ProvinceNames" "ResNames"  "ResNamesOrder"
>>> "Shrink.df" "Shrink.hpd""SimInits"
>>>
>>> Specifically, the Modis* objects are sorted like this:
>>>
>>> > ls(sorted=TRUE)[26:30]
>>> [1] "Modis.df"   "ModisFixed.df"  "ModisFixed.hpd" "Modis.hpd"
>>>  "ModisPrecip.sd"
>>>
>>> With Modis.* coming both before and after ModisF*. I can't see why there
>>> would be any odd problems with character sets changing (this was all done
>>> on a single computer with no weird locale switching), and the objects are 
>>> all
>>> created within a single R session:
>>>
>>> > sessionInfo()
>>> R version 3.2.5 (2016-04-14)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: Ubuntu 16.04.1 LTS
>>>
>>> locale:
>>>  [1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
>>> LC_TIME=en_GB.UTF-8LC_COLLATE=en_US.UTF-8
>>>  [5] LC_MONETARY=en_GB.UTF-8LC_MESSAGES=en_US.UTF-8
>>> LC_PAPER=en_GB.UTF-8   LC_NAME=C
>>>  [9] LC_ADDRESS=C   LC_TELEPHONE=C
>>> LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats graphics  grDevices utils datasets  methods   base
>>>
>>> other attached packages:
>>> [1] MCMCglmm_2.22.1ape_3.5Matrix_1.2-7.1
>>> RColorBrewer_1.1-2 plyr_1.8.4 coda_0.18-1
>>>
>>> loaded via a namespace (and not attached):
>>> [1] cubature_1.1-2  corpcor_1.6.8   tools_3.2.5 Rcpp_0.12.7
>>> nlme_3.1-128grid_3.2.5  knitr_1.14
>>> [8] tensorA_0.36lattice_0.20-34
>>>
>>> Can anyone explain what's going on?
>>>
>>> Bob
>>>
>>> --
>>> Bob O'Hara
>>>
>>> Biodiversity and Climate Research Centre Senckenberganlage 25
>>> D-60325 Frankfurt am Main,
>>> Germany
>>>
>>> Tel: +49 69 798 40226
>>> Mobile: +49 1515 888 5440
>>> WWW:   http://www.bik-f.de/root/index.php?page_id=219
>>> Blog: http://occamstypewriter.org/boboh/
>>> Journal of Negative Results - EEB: www.jnr-eeb.org
>>>
>>> __
>>> [email protected] 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.
>>
>> 
>> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou 
>> určeny pouze jeho adresátům.
>> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
>> jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
>> svého systému.
>> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
>> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
>> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
>> zpožděním přenosu e-mailu.
>>
>> V případě, že je tento e-mail součástí obchodního jednání:
>> - v

  1   2   3   4   5   6   >