[R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command with 
a random seed of 123. I get different results. Advice appreciated.
Steven Yen

 > # Run under R-3.6.0
 > x<-1:500
 > set.seed(12345671)
 > j<-sample(1:length(x),size=60); y<-x[j]
 > summary(y)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
    26.0   134.2   240.0   249.8   368.0   500.0

 > # Run under R-3.5.3.patched
 > x<-1:500
 > set.seed(12345671)
 > j<-sample(1:length(x),size=60); y<-x[j]
 > summary(y)
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
     9.0   122.2   205.0   236.1   364.2   493.0

-- 
st...@ntu.edu.tw (S.T. Yen)


[[alternative HTML version deleted]]

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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Uwe Ligges

See the NEWS, the RNG has been changed, use RNGversion

On 21.06.2019 18:10, Steven Yen wrote:

Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command with
a random seed of 123. I get different results. Advice appreciated.
Steven Yen

  > # Run under R-3.6.0
  > x<-1:500
  > set.seed(12345671)
  > j<-sample(1:length(x),size=60); y<-x[j]
  > summary(y)
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
     26.0   134.2   240.0   249.8   368.0   500.0

  > # Run under R-3.5.3.patched
  > x<-1:500
  > set.seed(12345671)
  > j<-sample(1:length(x),size=60); y<-x[j]
  > summary(y)
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      9.0   122.2   205.0   236.1   364.2   493.0




Under R-3.6.0  use, e.g.
RNGversion("3.5.2")
to get reproducible results from the older RNG.

Best,
Uwe Ligges

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


Re: [R] Regarding R doubt

2019-06-21 Thread shr...@outlook.com
library(ltm)
library(psych)

setwd("C:/Users/Admin/Desktop/IRT_CatSim")

irtdat<-read.csv("Fresh_r_2pl.csv",header=F)
head(irtdat)
PL2.rasch<-ltm(irtdat~z1)
summary(PL2.rasch)

plot(PL2.rasch,type=c("ICC"))
plot(PL2.rasch,type=c("IIC"))


Above is the code,When I run summary(PL2.rasch) I will get the following table 
directly:
Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
�
Discrm.V1   -1.3585   3.2062 -0.4237
Discrm.V1   -1.00328649.3103 -0.0001
�

Working on Item response theory and I�m struggling at calculating above values 
manually.
You will get this difficulty and discrimination values directly, I just want 
the simple formulas to calculate item difficulty and item discrimination.
Also how they have calculated theta(ability) and scores at the backend of the 
code.


Sent from Mail for Windows 10


From: Richard O'Keefe 
Sent: Thursday, June 20, 2019 2:18:26 AM
To: shr...@outlook.com
Cc: r-help@r-project.org
Subject: Re: [R] Regarding R doubt

You did not say what your doubt about R was.
PL2.rasch has some class.
> class(PL2.rasch)
[1] 'Grofnigtz'   # or whatever
The summary function is really just a dispatcher.
> summary.Grofnigtz
... a listing comes out here ...

Or you could look in the source code of whatever package you are usin.


On Thu, 20 Jun 2019 at 00:25, shr...@outlook.com 
mailto:shr...@outlook.com>> wrote:
Hello Team,
I hope you are doing well.
I have one doubt about backend functioning of R command.
Currently I'm working on IRT analysis in python but this function is 
implemented in R and in R they have direct rasch model library but no such 
library in the Python.

So I wanted to know that is there any way to find the math or formula behind 
the specific command of R language.
for eg, summary(PL2.rasch)
after this command you will directly get difficulty and discrimination values 
like mentioned below:

Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
Dffclt.V3   -1.3585   3.2062 -0.4237
Dffclt.V4   -1.00328649.3103 -0.0001
Dffclt.V50.04001350.8452  0.

So is there any way to find out the math behind this summary command ?

Thanks,
Shreepad



[[alternative HTML version deleted]]

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

[[alternative HTML version deleted]]

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


Re: [R] Regarding R doubt

2019-06-21 Thread shr...@outlook.com
Thank you so much for the help !

Sent from Mail for Windows 10


From: Richard O'Keefe 
Sent: Thursday, June 20, 2019 10:41:49 AM
To: shr...@outlook.com
Cc: r-help@r-project.org
Subject: Re: [R] Regarding R doubt

And PL.rasch has what class?
The manual for the 'ltm' package says that 'summary'
"[s]ummarizes the fit of either grm, ltm, rasch or tpm objects."

Download the sources from 
https://cran.r-project.org/src/contrib/ltm_1.1-1.tar.gz
Unpack the sources.  Look at ltm/R/summary.rasch.R
as that *computes* the summary and ltm/R/print.summ.rasch.R
as that *prints* the summary.

R is a wonderful wonderful tool with a great community and many fine 
statisticians
contributing code.  Statisticians are not software engineers, so it is no
reflection on the professional competence of the author to say that neither of
these files has any comments.  On the other hand, the code is not very complex.
The files are about one page each.

On Thu, 20 Jun 2019 at 15:49, shr...@outlook.com 
mailto:shr...@outlook.com>> wrote:
library(ltm)
library(psych)

setwd("C:/Users/Admin/Desktop/IRT_CatSim")

irtdat<-read.csv("Fresh_r_2pl.csv",header=F)
head(irtdat)
PL2.rasch<-ltm(irtdat~z1)
summary(PL2.rasch)

plot(PL2.rasch,type=c("ICC"))
plot(PL2.rasch,type=c("IIC"))


Above is the code,When I run summary(PL2.rasch) I will get the following table 
directly:
Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
�
Discrm.V1   -1.3585   3.2062 -0.4237
Discrm.V1   -1.00328649.3103 -0.0001
�

Working on Item response theory and I�m struggling at calculating above values 
manually.
You will get this difficulty and discrimination values directly, I just want 
the simple formulas to calculate item difficulty and item discrimination.
Also how they have calculated theta(ability) and scores at the backend of the 
code.


Sent from Mail for Windows 10


From: Richard O'Keefe mailto:rao...@gmail.com>>
Sent: Thursday, June 20, 2019 2:18:26 AM
To: shr...@outlook.com
Cc: r-help@r-project.org
Subject: Re: [R] Regarding R doubt

You did not say what your doubt about R was.
PL2.rasch has some class.
> class(PL2.rasch)
[1] 'Grofnigtz'   # or whatever
The summary function is really just a dispatcher.
> summary.Grofnigtz
... a listing comes out here ...

Or you could look in the source code of whatever package you are usin.


On Thu, 20 Jun 2019 at 00:25, shr...@outlook.com 
mailto:shr...@outlook.com>> wrote:
Hello Team,
I hope you are doing well.
I have one doubt about backend functioning of R command.
Currently I'm working on IRT analysis in python but this function is 
implemented in R and in R they have direct rasch model library but no such 
library in the Python.

So I wanted to know that is there any way to find the math or formula behind 
the specific command of R language.
for eg, summary(PL2.rasch)
after this command you will directly get difficulty and discrimination values 
like mentioned below:

Coefficients:
 value   std.err   z.vals
Dffclt.V13.1135   9.8208  0.3170
Dffclt.V2   -0.5157   0.8941 -0.5768
Dffclt.V3   -1.3585   3.2062 -0.4237
Dffclt.V4   -1.00328649.3103 -0.0001
Dffclt.V50.04001350.8452  0.

So is there any way to find out the math behind this summary command ?

Thanks,
Shreepad



[[alternative HTML version deleted]]

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

[[alternative HTML version deleted]]

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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
Thanks. Somewhat of a mystery. The older version I had was R-3.5.3patched.
I cannot get the RNGversion command to run. Can you help? Thanks.

On 6/22/2019 12:25 AM, Uwe Ligges wrote:
> See the NEWS, the RNG has been changed, use RNGversion
>
> On 21.06.2019 18:10, Steven Yen wrote:
>> Dear all,
>> I did all this work with older R (R-3.5.3.patched and older)
>> but now with R3.6 I cannot replicate the results.
>> Below I sample 60 observations from 1:500 using the sample command with
>> a random seed of 123. I get different results. Advice appreciated.
>> Steven Yen
>>
>>   > # Run under R-3.6.0
>>   > x<-1:500
>>   > set.seed(12345671)
>>   > j<-sample(1:length(x),size=60); y<-x[j]
>>   > summary(y)
>>      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>      26.0   134.2   240.0   249.8   368.0   500.0
>>
>>   > # Run under R-3.5.3.patched
>>   > x<-1:500
>>   > set.seed(12345671)
>>   > j<-sample(1:length(x),size=60); y<-x[j]
>>   > summary(y)
>>      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>       9.0   122.2   205.0   236.1   364.2   493.0
>>
>
>
> Under R-3.6.0  use, e.g.
> RNGversion("3.5.2")
> to get reproducible results from the older RNG.
>
> Best,
> Uwe Ligges
>
>

-- 
st...@ntu.edu.tw (S.T. Yen)


[[alternative HTML version deleted]]

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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Uwe Ligges

What does not work?


For me it works under R-3.6.0:

 x<-1:500
 set.seed(12345671)
 j<-sample(1:length(x),size=60); y<-x[j]
 summary(j)

 RNGversion("3.5.3")
 set.seed(12345671)
 j<-sample(1:length(x),size=60); y<-x[j]
 summary(j)


Now I get the results you got udner the old R.

Best,
Uwe Ligges



On 21.06.2019 18:39, Steven Yen wrote:

Thanks. Somewhat of a mystery. The older version I had was R-3.5.3patched.
I cannot get the RNGversion command to run. Can you help? Thanks.

On 6/22/2019 12:25 AM, Uwe Ligges wrote:

See the NEWS, the RNG has been changed, use RNGversion

On 21.06.2019 18:10, Steven Yen wrote:

Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command with
a random seed of 123. I get different results. Advice appreciated.
Steven Yen

  > # Run under R-3.6.0
  > x<-1:500
  > set.seed(12345671)
  > j<-sample(1:length(x),size=60); y<-x[j]
  > summary(y)
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
     26.0   134.2   240.0   249.8   368.0   500.0

  > # Run under R-3.5.3.patched
  > x<-1:500
  > set.seed(12345671)
  > j<-sample(1:length(x),size=60); y<-x[j]
  > summary(y)
     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      9.0   122.2   205.0   236.1   364.2   493.0




Under R-3.6.0  use, e.g.
RNGversion("3.5.2")
to get reproducible results from the older RNG.

Best,
Uwe Ligges




--
st...@ntu.edu.tw  (S.T. Yen)



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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
Now I see that results were replicated but running RNGversion
I get a warning message. Isn't there a way to do this clean?

> RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister", 
"Inversion", "Rounding") : non-uniform 'Rounding' sampler used


On 6/22/2019 1:03 AM, Uwe Ligges wrote:
> What does not work?
>
>
> For me it works under R-3.6.0:
>
>  x<-1:500
>  set.seed(12345671)
>  j<-sample(1:length(x),size=60); y<-x[j]
>  summary(j)
>
>  RNGversion("3.5.3")
>  set.seed(12345671)
>  j<-sample(1:length(x),size=60); y<-x[j]
>  summary(j)
>
>
> Now I get the results you got udner the old R.
>
> Best,
> Uwe Ligges
>
>
>
> On 21.06.2019 18:39, Steven Yen wrote:
>> Thanks. Somewhat of a mystery. The older version I had was 
>> R-3.5.3patched.
>> I cannot get the RNGversion command to run. Can you help? Thanks.
>>
>> On 6/22/2019 12:25 AM, Uwe Ligges wrote:
>>> See the NEWS, the RNG has been changed, use RNGversion
>>>
>>> On 21.06.2019 18:10, Steven Yen wrote:
 Dear all,
 I did all this work with older R (R-3.5.3.patched and older)
 but now with R3.6 I cannot replicate the results.
 Below I sample 60 observations from 1:500 using the sample command 
 with
 a random seed of 123. I get different results. Advice appreciated.
 Steven Yen

   > # Run under R-3.6.0
   > x<-1:500
   > set.seed(12345671)
   > j<-sample(1:length(x),size=60); y<-x[j]
   > summary(y)
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      26.0   134.2   240.0   249.8   368.0   500.0

   > # Run under R-3.5.3.patched
   > x<-1:500
   > set.seed(12345671)
   > j<-sample(1:length(x),size=60); y<-x[j]
   > summary(y)
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
       9.0   122.2   205.0   236.1   364.2   493.0

>>>
>>>
>>> Under R-3.6.0  use, e.g.
>>> RNGversion("3.5.2")
>>> to get reproducible results from the older RNG.
>>>
>>> Best,
>>> Uwe Ligges
>>>
>>>
>>
>> -- 
>> st...@ntu.edu.tw  (S.T. Yen)
>>
>

-- 
st...@ntu.edu.tw (S.T. Yen)


[[alternative HTML version deleted]]

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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Uwe Ligges




On 21.06.2019 19:09, Steven Yen wrote:

Now I see that results were replicated but running RNGversion
I get a warning message. Isn't there a way to do this clean?


Well, the old RNG is known to be not optimal, hence we give a warning if 
you choose the old one. This is the clean way if you really want to get 
the old (slightly buggy) behaviour.


Best,
Uwe Ligges




RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister",

"Inversion", "Rounding") : non-uniform 'Rounding' sampler used


On 6/22/2019 1:03 AM, Uwe Ligges wrote:

What does not work?


For me it works under R-3.6.0:

  x<-1:500
  set.seed(12345671)
  j<-sample(1:length(x),size=60); y<-x[j]
  summary(j)

  RNGversion("3.5.3")
  set.seed(12345671)
  j<-sample(1:length(x),size=60); y<-x[j]
  summary(j)


Now I get the results you got udner the old R.

Best,
Uwe Ligges



On 21.06.2019 18:39, Steven Yen wrote:

Thanks. Somewhat of a mystery. The older version I had was
R-3.5.3patched.
I cannot get the RNGversion command to run. Can you help? Thanks.

On 6/22/2019 12:25 AM, Uwe Ligges wrote:

See the NEWS, the RNG has been changed, use RNGversion

On 21.06.2019 18:10, Steven Yen wrote:

Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command
with
a random seed of 123. I get different results. Advice appreciated.
Steven Yen

   > # Run under R-3.6.0
   > x<-1:500
   > set.seed(12345671)
   > j<-sample(1:length(x),size=60); y<-x[j]
   > summary(y)
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      26.0   134.2   240.0   249.8   368.0   500.0

   > # Run under R-3.5.3.patched
   > x<-1:500
   > set.seed(12345671)
   > j<-sample(1:length(x),size=60); y<-x[j]
   > summary(y)
      Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
       9.0   122.2   205.0   236.1   364.2   493.0




Under R-3.6.0  use, e.g.
RNGversion("3.5.2")
to get reproducible results from the older RNG.

Best,
Uwe Ligges




--
st...@ntu.edu.tw  (S.T. Yen)







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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Steven Yen
Unhappy but thanks.
Steven

On 6/22/2019 1:13 AM, Uwe Ligges wrote:
>
>
> On 21.06.2019 19:09, Steven Yen wrote:
>> Now I see that results were replicated but running RNGversion
>> I get a warning message. Isn't there a way to do this clean?
>
> Well, the old RNG is known to be not optimal, hence we give a warning 
> if you choose the old one. This is the clean way if you really want to 
> get the old (slightly buggy) behaviour.
>
> Best,
> Uwe Ligges
>
>>
>>> RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister",
>> "Inversion", "Rounding") : non-uniform 'Rounding' sampler used
>>
>>
>> On 6/22/2019 1:03 AM, Uwe Ligges wrote:
>>> What does not work?
>>>
>>>
>>> For me it works under R-3.6.0:
>>>
>>>   x<-1:500
>>>   set.seed(12345671)
>>>   j<-sample(1:length(x),size=60); y<-x[j]
>>>   summary(j)
>>>
>>>   RNGversion("3.5.3")
>>>   set.seed(12345671)
>>>   j<-sample(1:length(x),size=60); y<-x[j]
>>>   summary(j)
>>>
>>>
>>> Now I get the results you got udner the old R.
>>>
>>> Best,
>>> Uwe Ligges
>>>
>>>
>>>
>>> On 21.06.2019 18:39, Steven Yen wrote:
 Thanks. Somewhat of a mystery. The older version I had was
 R-3.5.3patched.
 I cannot get the RNGversion command to run. Can you help? Thanks.

 On 6/22/2019 12:25 AM, Uwe Ligges wrote:
> See the NEWS, the RNG has been changed, use RNGversion
>
> On 21.06.2019 18:10, Steven Yen wrote:
>> Dear all,
>> I did all this work with older R (R-3.5.3.patched and older)
>> but now with R3.6 I cannot replicate the results.
>> Below I sample 60 observations from 1:500 using the sample command
>> with
>> a random seed of 123. I get different results. Advice appreciated.
>> Steven Yen
>>
>>    > # Run under R-3.6.0
>>    > x<-1:500
>>    > set.seed(12345671)
>>    > j<-sample(1:length(x),size=60); y<-x[j]
>>    > summary(y)
>>       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>       26.0   134.2   240.0   249.8   368.0   500.0
>>
>>    > # Run under R-3.5.3.patched
>>    > x<-1:500
>>    > set.seed(12345671)
>>    > j<-sample(1:length(x),size=60); y<-x[j]
>>    > summary(y)
>>       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>        9.0   122.2   205.0   236.1   364.2   493.0
>>
>
>
> Under R-3.6.0  use, e.g.
> RNGversion("3.5.2")
> to get reproducible results from the older RNG.
>
> Best,
> Uwe Ligges
>
>

 -- 
 st...@ntu.edu.tw  (S.T. Yen)

>>>
>>
>

-- 
st...@ntu.edu.tw (S.T. Yen)


[[alternative HTML version deleted]]

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


Re: [R] [External] Re: Problem with random numbers/seed

2019-06-21 Thread Tierney, Luke
Maybe looking at ?suppressWarnings will make you feel better.

Best,

luke

On Fri, 21 Jun 2019, Steven Yen wrote:

> Unhappy but thanks.
> Steven
>
> On 6/22/2019 1:13 AM, Uwe Ligges wrote:
>>
>>
>> On 21.06.2019 19:09, Steven Yen wrote:
>>> Now I see that results were replicated but running RNGversion
>>> I get a warning message. Isn't there a way to do this clean?
>>
>> Well, the old RNG is known to be not optimal, hence we give a warning
>> if you choose the old one. This is the clean way if you really want to
>> get the old (slightly buggy) behaviour.
>>
>> Best,
>> Uwe Ligges
>>
>>>
 RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister",
>>> "Inversion", "Rounding") : non-uniform 'Rounding' sampler used
>>>
>>>
>>> On 6/22/2019 1:03 AM, Uwe Ligges wrote:
 What does not work?


 For me it works under R-3.6.0:

   x<-1:500
   set.seed(12345671)
   j<-sample(1:length(x),size=60); y<-x[j]
   summary(j)

   RNGversion("3.5.3")
   set.seed(12345671)
   j<-sample(1:length(x),size=60); y<-x[j]
   summary(j)


 Now I get the results you got udner the old R.

 Best,
 Uwe Ligges



 On 21.06.2019 18:39, Steven Yen wrote:
> Thanks. Somewhat of a mystery. The older version I had was
> R-3.5.3patched.
> I cannot get the RNGversion command to run. Can you help? Thanks.
>
> On 6/22/2019 12:25 AM, Uwe Ligges wrote:
>> See the NEWS, the RNG has been changed, use RNGversion
>>
>> On 21.06.2019 18:10, Steven Yen wrote:
>>> Dear all,
>>> I did all this work with older R (R-3.5.3.patched and older)
>>> but now with R3.6 I cannot replicate the results.
>>> Below I sample 60 observations from 1:500 using the sample command
>>> with
>>> a random seed of 123. I get different results. Advice appreciated.
>>> Steven Yen
>>>
>>>    > # Run under R-3.6.0
>>>    > x<-1:500
>>>    > set.seed(12345671)
>>>    > j<-sample(1:length(x),size=60); y<-x[j]
>>>    > summary(y)
>>>       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>>       26.0   134.2   240.0   249.8   368.0   500.0
>>>
>>>    > # Run under R-3.5.3.patched
>>>    > x<-1:500
>>>    > set.seed(12345671)
>>>    > j<-sample(1:length(x),size=60); y<-x[j]
>>>    > summary(y)
>>>       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
>>>        9.0   122.2   205.0   236.1   364.2   493.0
>>>
>>
>>
>> Under R-3.6.0  use, e.g.
>> RNGversion("3.5.2")
>> to get reproducible results from the older RNG.
>>
>> Best,
>> Uwe Ligges
>>
>>
>
> --
> st...@ntu.edu.tw  (S.T. Yen)
>

>>>
>>
>
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem witth nnet:multinom

2019-06-21 Thread Tom Woolman
I am using R with the nnet package to perform a multinomial logistic  
regression on a training dataset with ~5800 training dataset records  
and 45 predictor variables in that training data. Predictor variables  
were chosen as a subset of all ~120 available variables based on PCA  
analysis. My target variable is a factor with 10 items.

All predictor variable are numeric (type "dbl").

My command in R is as follows:

model <- nnet:multinom(frmla, data = training_set, maxit = 1000,  
na.action = na.omit)


#note that the frmla string is a value of "Target_Variable ~ v1 + v2 +  
v3, etc."
Output of this command is as follows (I will truncate to save a little  
space after the first few rows):


# weights: 360 (308 variable)
initial value 10912.909211

iter 10 value 9194.608309

iter 20 value 9142.608309

iter 30 value 9128.737991

iter 40 value 9093.899887
.
.
.
iter 420 value 8077.803755

final value 8077.800112
converged
Error in nnet:multinom(frmla, data = training_set, maxit = 1000, :
NA/NaN argument

In addition: Warning message:

In nnet:multinom(frmla, data= training_set, maxit = 1000, :
numerical expression has 26 elements: only the first used

So that's my issue. I can't figure out the meaning behind both the  
error message and the warning message above. There are no NA values in  
my data set. I've also tried reducing the number of predictor  
variables, but I get the same issue (just a different number of  
iterations).


Thanks in advance.

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


[R] How to filter data in R based on first column ID

2019-06-21 Thread Yogesh Gupta
Hi,

I do need to filter data based on first column could you please suggest ,
How I can do it in R.







head(data)



Root-1.S35.L001 Root-10.S75.L001 Root-13.S5.L001 Root-14.S16.L001
Root-17.S26.L001
719e20e1e3d19fbc5dd50844c6d29a8f 0.049304262 0 0 0 0.033765858
bfffa74c0971b30ccf3b19f65911801f 0 0 0.017210717 0 0
80087a003188288a9b0e3990d72113e3 0 0 0 0.010248632 0
aed34f36d535976c247278bec289fd12 0.580694642 0.113445793 0.56221674
0.06764097 0.525782644
42df8f30203380e9a604cb5c4000411b 0 0 0 0.004099453 0
d47199c9d9c5417c7cb82ff4159cf497 0 0.019729703 0 0 0
6272cdc38bd517a77ba3887619c36b9f 0 0 0 0.016397811 0.019294776
62a5c6f5e0adda662739a7ac521ea790 0.076695519 0 0.271546861 0.254166069
0.463074623
3b5d8860f6a03668df80d364e9591bab 0.125999781 0.019729703 0.061193659
0.038944801 0.02411847

I need to extract data for the below IDs

head(ID.list)

719e20e1e3d19fbc5dd50844c6d29a8f
bfffa74c0971b30ccf3b19f65911801f
62a5c6f5e0adda662739a7ac521ea790

I will be tankful for your help.

Thanks
Yogesh

*Yogesh Gupta*
*Research Fellow*
*Institute for Global Food Security*
*Queen's University*
*Belfast, UK*

[[alternative HTML version deleted]]

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


Re: [R] How to filter data in R based on first column ID

2019-06-21 Thread Rui Barradas

Hello,

Please don't post in HTML like the posting guide asks you to, the data 
is unreadable.


Not tested:

i <- data[[1]] %in% ID.list
data[i, ]


That's it.

Hope this helps,

Rui Barradas

Às 21:09 de 21/06/19, Yogesh Gupta escreveu:

Hi,

I do need to filter data based on first column could you please suggest ,
How I can do it in R.







head(data)



Root-1.S35.L001 Root-10.S75.L001 Root-13.S5.L001 Root-14.S16.L001
Root-17.S26.L001
719e20e1e3d19fbc5dd50844c6d29a8f 0.049304262 0 0 0 0.033765858
bfffa74c0971b30ccf3b19f65911801f 0 0 0.017210717 0 0
80087a003188288a9b0e3990d72113e3 0 0 0 0.010248632 0
aed34f36d535976c247278bec289fd12 0.580694642 0.113445793 0.56221674
0.06764097 0.525782644
42df8f30203380e9a604cb5c4000411b 0 0 0 0.004099453 0
d47199c9d9c5417c7cb82ff4159cf497 0 0.019729703 0 0 0
6272cdc38bd517a77ba3887619c36b9f 0 0 0 0.016397811 0.019294776
62a5c6f5e0adda662739a7ac521ea790 0.076695519 0 0.271546861 0.254166069
0.463074623
3b5d8860f6a03668df80d364e9591bab 0.125999781 0.019729703 0.061193659
0.038944801 0.02411847

I need to extract data for the below IDs

head(ID.list)

719e20e1e3d19fbc5dd50844c6d29a8f
bfffa74c0971b30ccf3b19f65911801f
62a5c6f5e0adda662739a7ac521ea790

I will be tankful for your help.

Thanks
Yogesh

*Yogesh Gupta*
*Research Fellow*
*Institute for Global Food Security*
*Queen's University*
*Belfast, UK*

[[alternative HTML version deleted]]

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



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


[R] Recovering former projects on R

2019-06-21 Thread Spencer Brackett
Good evening,

  I am revisiting a project I had saved to R studio and after working with
it for a little, with loaded data and environments shown just as I left
them when I stopped working on the project, my console and the tabs opened
went blank. I believe I accidentally activated q() and quit the project. I
tried to re-access the same file with all of the work I’ve done for this
project saved onto it, and I got the following...


 load("~/R/GBM P-EXP/GBM P-EXP.Rproj")
Error in load("~/R/GBM P-EXP/GBM P-EXP.Rproj") :
  bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘GBM P-EXP.Rproj’ has magic number 'Versi'
  Use of save versions prior to 2 is deprecated

Does this mean that I lost all of my previous work, or is there another way
to recover all the coding and loaded environments that I had saved to this
file?  For context, I also tried accessing the project through a desktop
version of the file saved on my desktop through R Studio, but this also
just generated a blank terminal with no loaded environments.

Any advice would be greatly appreciated!

Best,

Spencer Brackett

[[alternative HTML version deleted]]

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


Re: [R] Recovering former projects on R

2019-06-21 Thread William Dunlap via R-help
You should ask someone at RStudio about this, but *.Rproj files are not
something R itself knows about.  load() reads files made by save(), which
usually have the extension ".Rdata" or ".rda".

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 21, 2019 at 1:43 PM Spencer Brackett <
spbracket...@saintjosephhs.com> wrote:

> Good evening,
>
>   I am revisiting a project I had saved to R studio and after working with
> it for a little, with loaded data and environments shown just as I left
> them when I stopped working on the project, my console and the tabs opened
> went blank. I believe I accidentally activated q() and quit the project. I
> tried to re-access the same file with all of the work I’ve done for this
> project saved onto it, and I got the following...
>
>
>  load("~/R/GBM P-EXP/GBM P-EXP.Rproj")
> Error in load("~/R/GBM P-EXP/GBM P-EXP.Rproj") :
>   bad restore file magic number (file may be corrupted) -- no data loaded
> In addition: Warning message:
> file ‘GBM P-EXP.Rproj’ has magic number 'Versi'
>   Use of save versions prior to 2 is deprecated
>
> Does this mean that I lost all of my previous work, or is there another way
> to recover all the coding and loaded environments that I had saved to this
> file?  For context, I also tried accessing the project through a desktop
> version of the file saved on my desktop through R Studio, but this also
> just generated a blank terminal with no loaded environments.
>
> Any advice would be greatly appreciated!
>
> Best,
>
> Spencer Brackett
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Recovering former projects on R

2019-06-21 Thread Spencer Brackett
Thank you, I called them but was able to load what appears to be a reprex
of my Rhistory. If I remember correctly, there is a way to to reimplement
this history into your console so to regenerate previous work. How is this
done?

Best,

Spencer

On Fri, Jun 21, 2019 at 4:51 PM William Dunlap  wrote:

> You should ask someone at RStudio about this, but *.Rproj files are not
> something R itself knows about.  load() reads files made by save(), which
> usually have the extension ".Rdata" or ".rda".
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Fri, Jun 21, 2019 at 1:43 PM Spencer Brackett <
> spbracket...@saintjosephhs.com> wrote:
>
>> Good evening,
>>
>>   I am revisiting a project I had saved to R studio and after working with
>> it for a little, with loaded data and environments shown just as I left
>> them when I stopped working on the project, my console and the tabs opened
>> went blank. I believe I accidentally activated q() and quit the project. I
>> tried to re-access the same file with all of the work I’ve done for this
>> project saved onto it, and I got the following...
>>
>>
>>  load("~/R/GBM P-EXP/GBM P-EXP.Rproj")
>> Error in load("~/R/GBM P-EXP/GBM P-EXP.Rproj") :
>>   bad restore file magic number (file may be corrupted) -- no data loaded
>> In addition: Warning message:
>> file ‘GBM P-EXP.Rproj’ has magic number 'Versi'
>>   Use of save versions prior to 2 is deprecated
>>
>> Does this mean that I lost all of my previous work, or is there another
>> way
>> to recover all the coding and loaded environments that I had saved to this
>> file?  For context, I also tried accessing the project through a desktop
>> version of the file saved on my desktop through R Studio, but this also
>> just generated a blank terminal with no loaded environments.
>>
>> Any advice would be greatly appreciated!
>>
>> Best,
>>
>> Spencer Brackett
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

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


Re: [R] Recovering former projects on R

2019-06-21 Thread David Winsemius



On 6/21/19 2:34 PM, Spencer Brackett wrote:

Thank you, I called them but was able to load what appears to be a reprex
of my Rhistory. If I remember correctly, there is a way to to reimplement
this history into your console so to regenerate previous work. How is this
done?



Assuming you still have teh data files stored in the same locations as 
they were when the history was recorded you should be able to use teh 
`source` function. Or you could create an *.R file and execute it from 
your OS file viewer if you have the R extension associated with the R 
executable.



?source

--

David.




Best,

Spencer

On Fri, Jun 21, 2019 at 4:51 PM William Dunlap  wrote:


You should ask someone at RStudio about this, but *.Rproj files are not
something R itself knows about.  load() reads files made by save(), which
usually have the extension ".Rdata" or ".rda".

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 21, 2019 at 1:43 PM Spencer Brackett <
spbracket...@saintjosephhs.com> wrote:


Good evening,

   I am revisiting a project I had saved to R studio and after working with
it for a little, with loaded data and environments shown just as I left
them when I stopped working on the project, my console and the tabs opened
went blank. I believe I accidentally activated q() and quit the project. I
tried to re-access the same file with all of the work I’ve done for this
project saved onto it, and I got the following...


  load("~/R/GBM P-EXP/GBM P-EXP.Rproj")
Error in load("~/R/GBM P-EXP/GBM P-EXP.Rproj") :
   bad restore file magic number (file may be corrupted) -- no data loaded
In addition: Warning message:
file ‘GBM P-EXP.Rproj’ has magic number 'Versi'
   Use of save versions prior to 2 is deprecated

Does this mean that I lost all of my previous work, or is there another
way
to recover all the coding and loaded environments that I had saved to this
file?  For context, I also tried accessing the project through a desktop
version of the file saved on my desktop through R Studio, but this also
just generated a blank terminal with no loaded environments.

Any advice would be greatly appreciated!

Best,

Spencer Brackett

 [[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


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


[R] Problem with reading file saved in directory

2019-06-21 Thread Spencer Brackett
Good evening,

I set up a working directory to read the indicated desktop file, but
implementation of the read.file function produced the following error...

>meth = read.table(file = "~/Vakul's GBM code/mapper.txt", sep  ="\t",
header = T, row.names = 1)
Error in read.table(file = "~/Vakul's GBM code/mapper.txt", sep = "\t",  :
duplicate 'row.names' are not allowed
In addition: Warning message:
In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
  EOF within quoted string

What does it mean by "duplicate row names are not allowed" ? is the file I
am attempting to access somehow not compatible? Also, how do I address the
second part of the warning referring to what was found "In scan" ?

Best,

Spencer

[[alternative HTML version deleted]]

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


Re: [R] How to filter data in R based on first column ID

2019-06-21 Thread Jeff Newmiller
Open the "Introduction to R" document that comes with R and search for "subset".

Oh, and read the Posting Guide mentioned in the footer of this and every 
message on the list for advice on communicating successfully on the R mailing 
lists. One problem with your post was that it was sent with HTML formatting, 
which rendered it quite unlike what you thought we would see, which really 
makes it difficult to help you.

On June 21, 2019 3:09:18 PM CDT, Yogesh Gupta  wrote:
>Hi,
>
>I do need to filter data based on first column could you please suggest
>,
>How I can do it in R.
>
>
>
>
>
>
>
>head(data)
>
>
>
>Root-1.S35.L001 Root-10.S75.L001 Root-13.S5.L001 Root-14.S16.L001
>Root-17.S26.L001
>719e20e1e3d19fbc5dd50844c6d29a8f 0.049304262 0 0 0 0.033765858
>bfffa74c0971b30ccf3b19f65911801f 0 0 0.017210717 0 0
>80087a003188288a9b0e3990d72113e3 0 0 0 0.010248632 0
>aed34f36d535976c247278bec289fd12 0.580694642 0.113445793 0.56221674
>0.06764097 0.525782644
>42df8f30203380e9a604cb5c4000411b 0 0 0 0.004099453 0
>d47199c9d9c5417c7cb82ff4159cf497 0 0.019729703 0 0 0
>6272cdc38bd517a77ba3887619c36b9f 0 0 0 0.016397811 0.019294776
>62a5c6f5e0adda662739a7ac521ea790 0.076695519 0 0.271546861 0.254166069
>0.463074623
>3b5d8860f6a03668df80d364e9591bab 0.125999781 0.019729703 0.061193659
>0.038944801 0.02411847
>
>I need to extract data for the below IDs
>
>head(ID.list)
>
>719e20e1e3d19fbc5dd50844c6d29a8f
>bfffa74c0971b30ccf3b19f65911801f
>62a5c6f5e0adda662739a7ac521ea790
>
>I will be tankful for your help.
>
>Thanks
>Yogesh
>
>*Yogesh Gupta*
>*Research Fellow*
>*Institute for Global Food Security*
>*Queen's University*
>*Belfast, UK*
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Problem with random numbers/seed

2019-06-21 Thread Rolf Turner



On 22/06/19 5:21 AM, Steven Yen wrote:


Unhappy but thanks.
Steven


Well, if you're *really* unhappy (???) you could always do

suppressWarnings(RNGversion("3.5.3"))

Does that make you happier?

cheers,

Rolf



On 6/22/2019 1:13 AM, Uwe Ligges wrote:



On 21.06.2019 19:09, Steven Yen wrote:

Now I see that results were replicated but running RNGversion
I get a warning message. Isn't there a way to do this clean?


Well, the old RNG is known to be not optimal, hence we give a warning
if you choose the old one. This is the clean way if you really want to
get the old (slightly buggy) behaviour.

Best,
Uwe Ligges




RNGversion("3.5.3") Warning message: In RNGkind("Mersenne-Twister",

"Inversion", "Rounding") : non-uniform 'Rounding' sampler used


On 6/22/2019 1:03 AM, Uwe Ligges wrote:

What does not work?


For me it works under R-3.6.0:

   x<-1:500
   set.seed(12345671)
   j<-sample(1:length(x),size=60); y<-x[j]
   summary(j)

   RNGversion("3.5.3")
   set.seed(12345671)
   j<-sample(1:length(x),size=60); y<-x[j]
   summary(j)


Now I get the results you got udner the old R.

Best,
Uwe Ligges



On 21.06.2019 18:39, Steven Yen wrote:

Thanks. Somewhat of a mystery. The older version I had was
R-3.5.3patched.
I cannot get the RNGversion command to run. Can you help? Thanks.

On 6/22/2019 12:25 AM, Uwe Ligges wrote:

See the NEWS, the RNG has been changed, use RNGversion

On 21.06.2019 18:10, Steven Yen wrote:

Dear all,
I did all this work with older R (R-3.5.3.patched and older)
but now with R3.6 I cannot replicate the results.
Below I sample 60 observations from 1:500 using the sample command
with
a random seed of 123. I get different results. Advice appreciated.
Steven Yen

    > # Run under R-3.6.0
    > x<-1:500
    > set.seed(12345671)
    > j<-sample(1:length(x),size=60); y<-x[j]
    > summary(y)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
       26.0   134.2   240.0   249.8   368.0   500.0

    > # Run under R-3.5.3.patched
    > x<-1:500
    > set.seed(12345671)
    > j<-sample(1:length(x),size=60); y<-x[j]
    > summary(y)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
        9.0   122.2   205.0   236.1   364.2   493.0




Under R-3.6.0  use, e.g.
RNGversion("3.5.2")
to get reproducible results from the older RNG.

Best,
Uwe Ligges




--
st...@ntu.edu.tw  (S.T. Yen)











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


Re: [R] Problem with reading file saved in directory

2019-06-21 Thread Jeff Newmiller
My psychic powers are telling me you don't know what is in that file. Perhaps 
you should look, with an eye toward counting the number of fields on each line 
and on having properly-quoted fields. My psychic powers are not strong enough 
to tell you what problems you will find in that file.

On June 21, 2019 5:55:30 PM CDT, Spencer Brackett 
 wrote:
>Good evening,
>
>I set up a working directory to read the indicated desktop file, but
>implementation of the read.file function produced the following
>error...
>
>>meth = read.table(file = "~/Vakul's GBM code/mapper.txt", sep  ="\t",
>header = T, row.names = 1)
>Error in read.table(file = "~/Vakul's GBM code/mapper.txt", sep = "\t",
> :
>duplicate 'row.names' are not allowed
>In addition: Warning message:
>In scan(file = file, what = what, sep = sep, quote = quote, dec = dec, 
>:
>  EOF within quoted string
>
>What does it mean by "duplicate row names are not allowed" ? is the
>file I
>am attempting to access somehow not compatible? Also, how do I address
>the
>second part of the warning referring to what was found "In scan" ?
>
>Best,
>
>Spencer
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Problem with reading file saved in directory

2019-06-21 Thread William Dunlap via R-help
Reading the file with row.names=1 meant to make rownames out of the first
column in the text file.  Duplicate row names are not accepted.  To
diagnose, read it with row.names=NULL and see what is in the first column
(e.g., use the table function on it).

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Jun 21, 2019 at 3:56 PM Spencer Brackett <
spbracket...@saintjosephhs.com> wrote:

> Good evening,
>
> I set up a working directory to read the indicated desktop file, but
> implementation of the read.file function produced the following error...
>
> >meth = read.table(file = "~/Vakul's GBM code/mapper.txt", sep  ="\t",
> header = T, row.names = 1)
> Error in read.table(file = "~/Vakul's GBM code/mapper.txt", sep = "\t",  :
> duplicate 'row.names' are not allowed
> In addition: Warning message:
> In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
>   EOF within quoted string
>
> What does it mean by "duplicate row names are not allowed" ? is the file I
> am attempting to access somehow not compatible? Also, how do I address the
> second part of the warning referring to what was found "In scan" ?
>
> Best,
>
> Spencer
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Problem with reading file saved in directory

2019-06-21 Thread Spencer Brackett
Thank you Mr. Dunlap, that was very helpful!

On Fri, Jun 21, 2019 at 8:01 PM William Dunlap  wrote:

> Reading the file with row.names=1 meant to make rownames out of the first
> column in the text file.  Duplicate row names are not accepted.  To
> diagnose, read it with row.names=NULL and see what is in the first column
> (e.g., use the table function on it).
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
>
> On Fri, Jun 21, 2019 at 3:56 PM Spencer Brackett <
> spbracket...@saintjosephhs.com> wrote:
>
>> Good evening,
>>
>> I set up a working directory to read the indicated desktop file, but
>> implementation of the read.file function produced the following error...
>>
>> >meth = read.table(file = "~/Vakul's GBM code/mapper.txt", sep  ="\t",
>> header = T, row.names = 1)
>> Error in read.table(file = "~/Vakul's GBM code/mapper.txt", sep = "\t",  :
>> duplicate 'row.names' are not allowed
>> In addition: Warning message:
>> In scan(file = file, what = what, sep = sep, quote = quote, dec = dec,  :
>>   EOF within quoted string
>>
>> What does it mean by "duplicate row names are not allowed" ? is the file I
>> am attempting to access somehow not compatible? Also, how do I address the
>> second part of the warning referring to what was found "In scan" ?
>>
>> Best,
>>
>> Spencer
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>

[[alternative HTML version deleted]]

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


[R] Output for pasting multiple vectors

2019-06-21 Thread Spencer Brackett
Hello,

I am attempting to paste multiple vectors using the paste() function for a
dataset that  I'm working with. Shouldn't I be receiving some kind of
output as a result of the following?

 meth=as.matrix(meth)
> colnames(meth) = sapply(colnames(meth), function(i){
+ c1 = strsplit(i,split ='.', fixed = T)[[1]]
+ c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
 "")
+ paste(c1,collapse = ".")
+ {

Best,

Spencer Brackett

[[alternative HTML version deleted]]

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


Re: [R] Output for pasting multiple vectors

2019-06-21 Thread Spencer Brackett
Would output <-paste() be part of the solution perhaps? Reading up on the
matter now.

Best,

Spencer

On Fri, Jun 21, 2019 at 9:11 PM Spencer Brackett <
spbracket...@saintjosephhs.com> wrote:

> Hello,
>
> I am attempting to paste multiple vectors using the paste() function for a
> dataset that  I'm working with. Shouldn't I be receiving some kind of
> output as a result of the following?
>
>  meth=as.matrix(meth)
> > colnames(meth) = sapply(colnames(meth), function(i){
> + c1 = strsplit(i,split ='.', fixed = T)[[1]]
> + c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
>  "")
> + paste(c1,collapse = ".")
> + {
>
> Best,
>
> Spencer Brackett
>

[[alternative HTML version deleted]]

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


Re: [R] Output for pasting multiple vectors

2019-06-21 Thread Spencer Brackett
My apologies. Is there a way to edit this within R?

On Fri, Jun 21, 2019 at 9:47 PM David Winsemius 
wrote:

> All the +-signs are telling you that the expression is not complete.
> Please read the posting guide. I’m pretty sure you’ve already been warned
> NOT to use html.
>
> —
> David.
>
> Sent from my iPhone
>
> > On Jun 21, 2019, at 6:11 PM, Spencer Brackett <
> spbracket...@saintjosephhs.com> wrote:
> >
> > Hello,
> >
> > I am attempting to paste multiple vectors using the paste() function for
> a
> > dataset that  I'm working with. Shouldn't I be receiving some kind of
> > output as a result of the following?
> >
> > meth=as.matrix(meth)
> >> colnames(meth) = sapply(colnames(meth), function(i){
> > + c1 = strsplit(i,split ='.', fixed = T)[[1]]
> > + c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
> > "")
> > + paste(c1,collapse = ".")
> > + {
> >
> > Best,
> >
> > Spencer Brackett
> >
> >[[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>

[[alternative HTML version deleted]]

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


Re: [R] Output for pasting multiple vectors

2019-06-21 Thread David Winsemius
All the +-signs are telling you that the expression is not complete. Please 
read the posting guide. I’m pretty sure you’ve already been warned NOT to use 
html. 

— 
David. 

Sent from my iPhone

> On Jun 21, 2019, at 6:11 PM, Spencer Brackett 
>  wrote:
> 
> Hello,
> 
> I am attempting to paste multiple vectors using the paste() function for a
> dataset that  I'm working with. Shouldn't I be receiving some kind of
> output as a result of the following?
> 
> meth=as.matrix(meth)
>> colnames(meth) = sapply(colnames(meth), function(i){
> + c1 = strsplit(i,split ='.', fixed = T)[[1]]
> + c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
> "")
> + paste(c1,collapse = ".")
> + {
> 
> Best,
> 
> Spencer Brackett
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Output for pasting multiple vectors

2019-06-21 Thread David Winsemius



Sent from my iPhone

> On Jun 21, 2019, at 6:48 PM, Spencer Brackett 
>  wrote:
> 
> My apologies. Is there a way to edit this within R? 

Most people use an editor or an IDE to work on their code. The code you 
presented didn’t seem be doing what you were describing. You should put 
together a small example and the show what your goals are. 

— 
David. 
>> On Fri, Jun 21, 2019 at 9:47 PM David Winsemius  
>> wrote:
>> All the +-signs are telling you that the expression is not complete. Please 
>> read the posting guide. I’m pretty sure you’ve already been warned NOT to 
>> use html. 
>> 
>> — 
>> David. 
>> 
>> Sent from my iPhone
>> 
>> > On Jun 21, 2019, at 6:11 PM, Spencer Brackett 
>> >  wrote:
>> > 
>> > Hello,
>> > 
>> > I am attempting to paste multiple vectors using the paste() function for a
>> > dataset that  I'm working with. Shouldn't I be receiving some kind of
>> > output as a result of the following?
>> > 
>> > meth=as.matrix(meth)
>> >> colnames(meth) = sapply(colnames(meth), function(i){
>> > + c1 = strsplit(i,split ='.', fixed = T)[[1]]
>> > + c1[4] = paste(strsplit(c1[4],split = "",fixed = T)[[1]][1:2],collapse =
>> > "")
>> > + paste(c1,collapse = ".")
>> > + {
>> > 
>> > Best,
>> > 
>> > Spencer Brackett
>> > 
>> >[[alternative HTML version deleted]]
>> > 
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide 
>> > http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>> 

[[alternative HTML version deleted]]

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


Re: [R] Output for pasting multiple vectors

2019-06-21 Thread Jeff Newmiller
Note that just editing in R (or RStudio, or Notepad, or whatever) will not 
solve the problem... you MUST learn how to use your email client to set the 
format to send at least your R-help emails in plain text. If you don't do that, 
the email program will just screw up your hard work.

I do think using the reprex package to test your example for reproducibility 
will improve the clarity of your questions.

On June 21, 2019 9:10:53 PM PDT, David Winsemius  wrote:
>
>
>Sent from my iPhone
>
>> On Jun 21, 2019, at 6:48 PM, Spencer Brackett
> wrote:
>> 
>> My apologies. Is there a way to edit this within R? 
>
>Most people use an editor or an IDE to work on their code. The code you
>presented didn’t seem be doing what you were describing. You should put
>together a small example and the show what your goals are. 
>
>— 
>David. 
>>> On Fri, Jun 21, 2019 at 9:47 PM David Winsemius
> wrote:
>>> All the +-signs are telling you that the expression is not complete.
>Please read the posting guide. I’m pretty sure you’ve already been
>warned NOT to use html. 
>>> 
>>> — 
>>> David. 
>>> 
>>> Sent from my iPhone
>>> 
>>> > On Jun 21, 2019, at 6:11 PM, Spencer Brackett
> wrote:
>>> > 
>>> > Hello,
>>> > 
>>> > I am attempting to paste multiple vectors using the paste()
>function for a
>>> > dataset that  I'm working with. Shouldn't I be receiving some kind
>of
>>> > output as a result of the following?
>>> > 
>>> > meth=as.matrix(meth)
>>> >> colnames(meth) = sapply(colnames(meth), function(i){
>>> > + c1 = strsplit(i,split ='.', fixed = T)[[1]]
>>> > + c1[4] = paste(strsplit(c1[4],split = "",fixed =
>T)[[1]][1:2],collapse =
>>> > "")
>>> > + paste(c1,collapse = ".")
>>> > + {
>>> > 
>>> > Best,
>>> > 
>>> > Spencer Brackett
>>> > 
>>> >[[alternative HTML version deleted]]
>>> > 
>>> > __
>>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> > PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>>> > and provide commented, minimal, self-contained, reproducible code.
>>> 
>
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Find the max entry in column 2 - that satisfies a condition given a fixed entry in column 1

2019-06-21 Thread Richard O'Keefe
I have read your message four times in the last couple of days,
but I still have very little idea what you want.
Let's try some things I've gleaned.
You have a matrix with 9 rows and 2 columns, and there is a 2
somewhere in column 1.
> m <- matrix(1:18, nrow=9, ncol=2)
> m[c(4,7,8),1] <- 2
> m
  [,1] [,2]
 [1,]1   10
 [2,]2   11
 [3,]3   12
 [4,]2   13
 [5,]5   14
 [6,]6   15
 [7,]2   16
 [8,]2   17
 [9,]9   18
You want to select rows where column 1 is 2.
> m[,1] == 2
[1] FALSE  TRUE FALSE  TRUE FALSE FALSE  TRUE  TRUE FALSE
You want to select the corresponding elements from column 2.
> m[m[,1] == 2, 2]
[1] 11 13 16 17
You want the maximum of these elements.
> max(m[m[,1] == 2, 2])
[1] 17

You can do pretty amazing things with indexing in R without any extra
packages.

Of course, I have almost certainly misunderstood you.
Perhaps you can ask again, maybe with an example?

On Fri, 21 Jun 2019 at 11:50, Vangelis Litos 
wrote:

> I am using R and I created based on a vector x, a grid (named: plain) -
> where zero is included. This gives me a 9x2 ``matrix''.
>
> > x_t = cbind(c(1),c(2));
> > x = t(x_t);
>
> > plain = expand.grid (sort (unique (c (0, x))), sort (unique (c (0, x;
>
> My aim is to focus on column 1 and take i.e the first entry (then the
> second, the third entry etc through a loop) of the unique (c (0, x)) vector
> (==0) [rows 1, 4 and 7] and find the maximum value (entry) in the second
> column of the matrix that satisfies a condition.
>
> Let say that the condition is satisfied when at column 2 the value is 2.
> That is I want row 7 to be selected
>
> Then I want to create a column vector b (9x1) that has zero everywhere
> apart from row 7.
>
> Can anybody help me with this?
>
> Thank you in advance.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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