Re: [R] Word-Wrapper Library/Package?

2021-09-28 Thread Andrew Simmons
'strwrap' should wrap at the target column, so I think it's behaving
correctly. You could do + 1 if you're expecting it to wrap immediately
after the target column.

As far as splitting while trying to minimize a penalty, I don't think
strwrap can do that, and I don't know of any packages that do such a thing.
If such a thing exists in another language, there's probably an R package
with a similar name containing ports of such functions, that might be your
best bet. I hope this helps.

On Tue, Sep 28, 2021, 23:51 Leonard Mada  wrote:

> Thank you Andrew.
>
>
> I will explore this function more, although I am struggling to get it to
> work properly:
>
> strwrap("Abc. B. Defg", 7)
> # [1] "Abc." "B."   "Defg"
>
> # both "Abc. B." and "B. Defg" are 7 characters long.
>
> strwrap(paste0(rep("ab", 7), collapse=""), 7)
> # [1] "ababababababab"
>
>
> Can I set an absolute maximum width?
>
> It would be nice to have an algorithm that computes a penalty for the
> split and selects the split with the smallest penalty (when no obvious
> split is possible).
>
>
> Sincerely,
>
>
> Leonard
>
>
>
> On 9/29/2021 6:30 AM, Andrew Simmons wrote:
>
> I think what you're looking for is 'strwrap', it's in package base.
>
> On Tue, Sep 28, 2021, 22:26 Leonard Mada via R-help 
> wrote:
>
>> Dear R-Users,
>>
>>
>> Does anyone know any package or library that implements functions for
>> word wrapping?
>>
>>
>> I did implement a very rudimentary one (Github link below), but would
>> like to avoid to reinvent the wheel. Considering that word-wrapping is a
>> very common task, it should be available even in base R (e.g. in a
>> "format" module/package).
>>
>>
>> Sincerely,
>>
>>
>> Leonard
>>
>> ===
>>
>> The latest versions of the functions are on Github:
>>
>> https://github.com/discoleo/R/blob/master/Stat/Tools.CRAN.R
>> # Note:
>> # - the function implementing word wrapping: split.N.line(...);
>> # - for the example below: the functions defined in Tools.CRAN.R are
>> required;
>>
>>
>> Examples:
>> ### Search CRAN
>> library(pkgsearch)
>>
>> searchCran = function(s, from=1, len=60, len.print=20, extend="*",
>>  sep=" ", sep.h="-") {
>>  if( ! is.null(extend)) s = paste0(s, extend);
>>  x = advanced_search(s, size=len, from=from);
>>  if(length(x$package_data) == 0) {
>>  cat("No packages found!", sep="\n");
>>  } else {
>>  scroll.pkg(x, len=len.print, sep=sep, sep.h=sep.h);
>>  }
>>  invisible(x)
>> }
>>
>> # with nice formatting & printing:
>> x = searchCran("text", from=60, sep.h="-")
>>
>> scroll.pkg(x, start=20, len=21, sep.h = "-*")
>> # test of sep.h=NULL vs ...
>>
>>
>> Notes:
>>
>> 1.) split.N.line:
>>
>> - was implemented to output a pre-specified number of lines (kind of
>> "maxLines"), but this is not required from an actual word-wrapper;
>>
>> - it was an initial design decision when implementing the format.lines()
>> function; but I plan to implement a 1-pass exact algorithm during the
>> next few days anyway;
>>
>> 2.) Refactoring
>>
>> - I will also move the formatting code to a new file: probably
>> Tools.Formatting.R;
>>
>> - the same applies for the formatting code for ftable (currently in file
>> Tools.Data.R);
>>
>> 3.) Package gridtext
>>
>> - seems to have some word-wrapping functionality, but does not seem to
>> expose it;
>>
>> - I am also currently focused on character-based word wrapping (e.g. for
>> RConsole);
>>
>>
>>
>> [[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] Word-Wrapper Library/Package?

2021-09-28 Thread Leonard Mada via R-help
Thank you Andrew.


I will explore this function more, although I am struggling to get it to 
work properly:

strwrap("Abc. B. Defg", 7)
# [1] "Abc." "B."   "Defg"

# both "Abc. B." and "B. Defg" are 7 characters long.

strwrap(paste0(rep("ab", 7), collapse=""), 7)
# [1] "ababababababab"


Can I set an absolute maximum width?

It would be nice to have an algorithm that computes a penalty for the 
split and selects the split with the smallest penalty (when no obvious 
split is possible).


Sincerely,


Leonard



On 9/29/2021 6:30 AM, Andrew Simmons wrote:
> I think what you're looking for is 'strwrap', it's in package base.
>
> On Tue, Sep 28, 2021, 22:26 Leonard Mada via R-help 
> mailto:r-help@r-project.org>> wrote:
>
> Dear R-Users,
>
>
> Does anyone know any package or library that implements functions for
> word wrapping?
>
>
> I did implement a very rudimentary one (Github link below), but would
> like to avoid to reinvent the wheel. Considering that
> word-wrapping is a
> very common task, it should be available even in base R (e.g. in a
> "format" module/package).
>
>
> Sincerely,
>
>
> Leonard
>
> ===
>
> The latest versions of the functions are on Github:
>
> https://github.com/discoleo/R/blob/master/Stat/Tools.CRAN.R
> 
> # Note:
> # - the function implementing word wrapping: split.N.line(...);
> # - for the example below: the functions defined in Tools.CRAN.R are
> required;
>
>
> Examples:
> ### Search CRAN
> library(pkgsearch)
>
> searchCran = function(s, from=1, len=60, len.print=20, extend="*",
>      sep=" ", sep.h="-") {
>  if( ! is.null(extend)) s = paste0(s, extend);
>  x = advanced_search(s, size=len, from=from);
>  if(length(x$package_data) == 0) {
>      cat("No packages found!", sep="\n");
>  } else {
>      scroll.pkg(x, len=len.print, sep=sep, sep.h=sep.h);
>  }
>  invisible(x)
> }
>
> # with nice formatting & printing:
> x = searchCran("text", from=60, sep.h="-")
>
> scroll.pkg(x, start=20, len=21, sep.h = "-*")
> # test of sep.h=NULL vs ...
>
>
> Notes:
>
> 1.) split.N.line:
>
> - was implemented to output a pre-specified number of lines (kind of
> "maxLines"), but this is not required from an actual word-wrapper;
>
> - it was an initial design decision when implementing the
> format.lines()
> function; but I plan to implement a 1-pass exact algorithm during the
> next few days anyway;
>
> 2.) Refactoring
>
> - I will also move the formatting code to a new file: probably
> Tools.Formatting.R;
>
> - the same applies for the formatting code for ftable (currently
> in file
> Tools.Data.R);
>
> 3.) Package gridtext
>
> - seems to have some word-wrapping functionality, but does not
> seem to
> expose it;
>
> - I am also currently focused on character-based word wrapping
> (e.g. for
> RConsole);
>
>
>
>         [[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] Word-Wrapper Library/Package?

2021-09-28 Thread Andrew Simmons
I think what you're looking for is 'strwrap', it's in package base.

On Tue, Sep 28, 2021, 22:26 Leonard Mada via R-help 
wrote:

> Dear R-Users,
>
>
> Does anyone know any package or library that implements functions for
> word wrapping?
>
>
> I did implement a very rudimentary one (Github link below), but would
> like to avoid to reinvent the wheel. Considering that word-wrapping is a
> very common task, it should be available even in base R (e.g. in a
> "format" module/package).
>
>
> Sincerely,
>
>
> Leonard
>
> ===
>
> The latest versions of the functions are on Github:
>
> https://github.com/discoleo/R/blob/master/Stat/Tools.CRAN.R
> # Note:
> # - the function implementing word wrapping: split.N.line(...);
> # - for the example below: the functions defined in Tools.CRAN.R are
> required;
>
>
> Examples:
> ### Search CRAN
> library(pkgsearch)
>
> searchCran = function(s, from=1, len=60, len.print=20, extend="*",
>  sep=" ", sep.h="-") {
>  if( ! is.null(extend)) s = paste0(s, extend);
>  x = advanced_search(s, size=len, from=from);
>  if(length(x$package_data) == 0) {
>  cat("No packages found!", sep="\n");
>  } else {
>  scroll.pkg(x, len=len.print, sep=sep, sep.h=sep.h);
>  }
>  invisible(x)
> }
>
> # with nice formatting & printing:
> x = searchCran("text", from=60, sep.h="-")
>
> scroll.pkg(x, start=20, len=21, sep.h = "-*")
> # test of sep.h=NULL vs ...
>
>
> Notes:
>
> 1.) split.N.line:
>
> - was implemented to output a pre-specified number of lines (kind of
> "maxLines"), but this is not required from an actual word-wrapper;
>
> - it was an initial design decision when implementing the format.lines()
> function; but I plan to implement a 1-pass exact algorithm during the
> next few days anyway;
>
> 2.) Refactoring
>
> - I will also move the formatting code to a new file: probably
> Tools.Formatting.R;
>
> - the same applies for the formatting code for ftable (currently in file
> Tools.Data.R);
>
> 3.) Package gridtext
>
> - seems to have some word-wrapping functionality, but does not seem to
> expose it;
>
> - I am also currently focused on character-based word wrapping (e.g. for
> RConsole);
>
>
>
> [[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] Word-Wrapper Library/Package?

2021-09-28 Thread Leonard Mada via R-help
Dear R-Users,


Does anyone know any package or library that implements functions for 
word wrapping?


I did implement a very rudimentary one (Github link below), but would 
like to avoid to reinvent the wheel. Considering that word-wrapping is a 
very common task, it should be available even in base R (e.g. in a 
"format" module/package).


Sincerely,


Leonard

===

The latest versions of the functions are on Github:

https://github.com/discoleo/R/blob/master/Stat/Tools.CRAN.R
# Note:
# - the function implementing word wrapping: split.N.line(...);
# - for the example below: the functions defined in Tools.CRAN.R are 
required;


Examples:
### Search CRAN
library(pkgsearch)

searchCran = function(s, from=1, len=60, len.print=20, extend="*",
         sep=" ", sep.h="-") {
     if( ! is.null(extend)) s = paste0(s, extend);
     x = advanced_search(s, size=len, from=from);
     if(length(x$package_data) == 0) {
         cat("No packages found!", sep="\n");
     } else {
         scroll.pkg(x, len=len.print, sep=sep, sep.h=sep.h);
     }
     invisible(x)
}

# with nice formatting & printing:
x = searchCran("text", from=60, sep.h="-")

scroll.pkg(x, start=20, len=21, sep.h = "-*")
# test of sep.h=NULL vs ...


Notes:

1.) split.N.line:

- was implemented to output a pre-specified number of lines (kind of 
"maxLines"), but this is not required from an actual word-wrapper;

- it was an initial design decision when implementing the format.lines() 
function; but I plan to implement a 1-pass exact algorithm during the 
next few days anyway;

2.) Refactoring

- I will also move the formatting code to a new file: probably 
Tools.Formatting.R;

- the same applies for the formatting code for ftable (currently in file 
Tools.Data.R);

3.) Package gridtext

- seems to have some word-wrapping functionality, but does not seem to 
expose it;

- I am also currently focused on character-based word wrapping (e.g. for 
RConsole);



[[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] Rdversion ???

2021-09-28 Thread Bill Dunlap
tools:::prepare2_Rd contains the lines
## FIXME: we no longer make any use of \Rdversion
version <- which(sections == "\\Rdversion")
if (length(version) > 1L)
stopRd(Rd[[version[2L]]], Rdfile,
   "Only one \\Rdversion declaration is allowed")
so I am guessing you can ignore any \Rdversion declarations.

-Bill


On Tue, Sep 28, 2021 at 2:57 PM Rolf Turner  wrote:

>
> I just noticed that a help file in one of my packages contains,
> as the second line (just after the \name{ }  macro), the line
>
> > \Rdversion{1.1}
>
> I have no idea how it got there.  I can find no reference to this
> macro in WRE, but by doing some groping, err, grepping around I have
> discovered its presence in a number of help files for other packages.
>
> Can anyone explain to me what it's for, and what its provenance is?
>
> Is it important?
>
> Thanks for any enlightenment.
>
> cheers,
>
> Rolf Turner
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[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] Rdversion ???

2021-09-28 Thread Rolf Turner


I just noticed that a help file in one of my packages contains,
as the second line (just after the \name{ }  macro), the line

> \Rdversion{1.1}

I have no idea how it got there.  I can find no reference to this
macro in WRE, but by doing some groping, err, grepping around I have
discovered its presence in a number of help files for other packages.

Can anyone explain to me what it's for, and what its provenance is?

Is it important?

Thanks for any enlightenment.

cheers,

Rolf Turner

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

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


Re: [ESS] why a release from time to time would be nice

2021-09-28 Thread Toby Hocking via ESS-help
Hi Rodney,
Just a point of clarification, it is completely OK for R-GSOC students to
write non-R code, and that happens every year (most common other languages
are probably FORTRAN/C/C++ and JavaScript but ESS/elisp should be fine
too). See non-R languages column in last year's coding projects table,
https://github.com/rstats-gsoc/gsoc2021/wiki/table%20of%20proposed%20coding%20projects
Also for the vast majority of other GSOC projects (all of them in my
experience) there is no problem with copyright. I'm not a copyright expert,
but maybe that is because the students are not being paid by their
universities to participate in GSOC? (google pays them a stipend, with the
purpose of encouraging them to contribute to free/open source software).
Toby

On Tue, Sep 28, 2021 at 8:38 AM Sparapani, Rodney via ESS-help <
ess-help@r-project.org> wrote:

> Hi Toby:
>
> Well that is very generous.  But ESS is not written in R.
> So I don’t think this would work.  Also getting another
> person to file FSF paper work can be painful.  For
> example, the student’s employer is likely a university
> who would own their code.  Typically you have to
> get them to give your copyright back which is not
> always easily accomplished.  Thanks
>
> --
> Rodney Sparapani, Associate Professor of Biostatistics
> Chair ISBA Section on Biostatistics and Pharmaceutical Statistics
> Institute for Health and Equity, Division of Biostatistics
> Medical College of Wisconsin, Milwaukee Campus
>
>
> [[alternative HTML version deleted]]
>
> __
> ESS-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help
>

[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [ESS] why a release from time to time would be nice

2021-09-28 Thread Sparapani, Rodney via ESS-help
Hi Toby:

Well that is very generous.  But ESS is not written in R.
So I don’t think this would work.  Also getting another
person to file FSF paper work can be painful.  For
example, the student’s employer is likely a university
who would own their code.  Typically you have to
get them to give your copyright back which is not
always easily accomplished.  Thanks

--
Rodney Sparapani, Associate Professor of Biostatistics
Chair ISBA Section on Biostatistics and Pharmaceutical Statistics
Institute for Health and Equity, Division of Biostatistics
Medical College of Wisconsin, Milwaukee Campus


[[alternative HTML version deleted]]

__
ESS-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/ess-help


Re: [R] Issue about eRM package

2021-09-28 Thread Michael Dewey
I do not know that package so cannot help with that but the dataset did 
not come through. This mailing list is quite restrictive in what sorts 
of attachment it allows so I suggest trying something like a .csv file 
or a .txt file.


Michael

On 28/09/2021 10:37, 宋启发 wrote:

  I am using your excellent R package eRM to solve a questionaire survey data. 
I meet a strange issue when using RSM function. This RSM runs well using sample 
data.

There is a test data like this:

'data.frame':   1669 obs. of  7 variables:

  $ X1: num  2 2 3 3 2 3 4 4 3 2 ...

  $ X2: num  4 3 3 2 3 4 4 4 3 3 ...

  $ X3: num  4 3 3 4 3 3 4 4 3 0 ...

  $ X4: num  2 3 2 4 1 2 3 3 3 1 ...

  $ X5: num  4 4 3 3 3 4 4 4 3 3 ...

  $ X6: num  4 4 4 3 3 4 4 4 3 3 ...

  $ X7: num  4 2 3 4 3 3 4 4 3 3 ...

  


###

RSM(test)

Warning in sqrt(diag(solve(parest$hessian))) : NaNs produced

Warning in sqrt(diag(lres$W %*% solve(parest$hessian) %*% t(lres$W))) :

   NaNs produced

  


Results of RSM estimation:

  


Call:  RSM(X = test)

  


Conditional log-likelihood: 13768080

Number of iterations: 5

Number of parameters: 9

  


Item (Category) Difficulty Parameters (eta):

 X2X3   X4X5X6X7 Cat 2  
   Cat 3   Cat 4

Estimate -700.9534 -456.4338 901.4649 -1322.033 -1256.828 -673.2412 -231.5791 
-3979.953 1911.748203

Std.ErrNaN   NaN  NaN   NaN   NaN   NaN   NaN   
NaN1.036215

  


###

So, I use a shortened data, run like this:

RSM(test[1:283,])

Results of RSM estimation:

  


Call:  RSM(X = test[1:283, ])

  


Conditional log-likelihood: -1015.388

Number of iterations: 29

Number of parameters: 9

  


Item (Category) Difficulty Parameters (eta):

  X2 X3X4 X5 X6 X7 
Cat 2 Cat 3Cat 4

Estimate -0.0739008 0.05655997 1.2203061 -1.1212188 -0.7547957 -0.0378593 
1.2020940 3.2657449 8.501760

Std.Err   0.1018267 0.10026033 0.1003035  0.1195827  0.1125677  0.1013739 
0.4387487 0.8161754 1.226057

  


###

However, when I add one record, from 283 to 284,

RSM(test[1:284,])

Warning in sqrt(diag(solve(parest$hessian))) : NaNs produced

Warning in sqrt(diag(lres$W %*% solve(parest$hessian) %*% t(lres$W))) :

   NaNs produced

  


Results of RSM estimation:

  


Call:  RSM(X = test[1:284, ])

  


Conditional log-likelihood: 3369344

Number of iterations: 6

Number of parameters: 9

  


Item (Category) Difficulty Parameters (eta):

 X2X3 X4X5X6X7 Cat 
2 Cat 3   Cat 4

Estimate -670.9137 -554.6215 527.789997 -1359.721 -1127.137 -626.1859 -126.7199 
-4753.367 2134.408482

Std.Err  2152.9823 1679.2875   2.377241   NaN   NaN 3394.5180  562.6800 
11045.9353.526018

  


I can’t find any special values in the data list

X1 X2 X3 X4 X5 X6 X7

270  4  4  4  3  4  4  4
271  3  3  3  1  3  3  3
272  4  3  4  1  4  4  4

273  3  3  3  3  3  3  3

274  3  3  4  4  3  3  4

275  3  3  3  3  3  3  3

276  1  3  3  3  3  3  3

277  3  3  3  2  4  4  4

278  2  3  2  1  3  3  3

279  3  3  3  2  3  3  3

280  3  3  2  2  3  3  3

281  3  4  4  3  4  3  3

282  2  2  2  2  2  2  2

283  3  4  3  1  4  3  3

284  2  4  2  1  4  3  2

285  3  3  3  3  3  3  3

286  4  4  3  4  4  4  4

287  4  3  4  0  3  4  4

288  0  3  4  0  4  4  1

289  4  4  4  4  4  4  4

290  3  3  3  3  3  3  2

  


If I input many different numbers of data, the results often become strange.

The data is appended at the letter. No na values in all data.

  


Great thanks



 all data  is in the appended file







__
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.




--
Michael
http://www.dewey.myzen.co.uk/home.html

__
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] Issue about eRM package

2021-09-28 Thread 宋启发
 I am using your excellent R package eRM to solve a questionaire survey data. I 
meet a strange issue when using RSM function. This RSM runs well using sample 
data.

There is a test data like this:

'data.frame':   1669 obs. of  7 variables:

 $ X1: num  2 2 3 3 2 3 4 4 3 2 ...

 $ X2: num  4 3 3 2 3 4 4 4 3 3 ...

 $ X3: num  4 3 3 4 3 3 4 4 3 0 ...

 $ X4: num  2 3 2 4 1 2 3 3 3 1 ...

 $ X5: num  4 4 3 3 3 4 4 4 3 3 ...

 $ X6: num  4 4 4 3 3 4 4 4 3 3 ...

 $ X7: num  4 2 3 4 3 3 4 4 3 3 ...

 

###

RSM(test)

Warning in sqrt(diag(solve(parest$hessian))) : NaNs produced

Warning in sqrt(diag(lres$W %*% solve(parest$hessian) %*% t(lres$W))) :

  NaNs produced

 

Results of RSM estimation:

 

Call:  RSM(X = test)

 

Conditional log-likelihood: 13768080

Number of iterations: 5

Number of parameters: 9

 

Item (Category) Difficulty Parameters (eta):

X2X3   X4X5X6X7 Cat 2   
  Cat 3   Cat 4

Estimate -700.9534 -456.4338 901.4649 -1322.033 -1256.828 -673.2412 -231.5791 
-3979.953 1911.748203

Std.ErrNaN   NaN  NaN   NaN   NaN   NaN   NaN   
NaN1.036215

 

###

So, I use a shortened data, run like this:

RSM(test[1:283,])

Results of RSM estimation:

 

Call:  RSM(X = test[1:283, ])

 

Conditional log-likelihood: -1015.388

Number of iterations: 29

Number of parameters: 9

 

Item (Category) Difficulty Parameters (eta):

 X2 X3X4 X5 X6 X7 
Cat 2 Cat 3Cat 4

Estimate -0.0739008 0.05655997 1.2203061 -1.1212188 -0.7547957 -0.0378593 
1.2020940 3.2657449 8.501760

Std.Err   0.1018267 0.10026033 0.1003035  0.1195827  0.1125677  0.1013739 
0.4387487 0.8161754 1.226057

 

###

However, when I add one record, from 283 to 284,

RSM(test[1:284,])

Warning in sqrt(diag(solve(parest$hessian))) : NaNs produced

Warning in sqrt(diag(lres$W %*% solve(parest$hessian) %*% t(lres$W))) :

  NaNs produced

 

Results of RSM estimation:

 

Call:  RSM(X = test[1:284, ])

 

Conditional log-likelihood: 3369344

Number of iterations: 6

Number of parameters: 9

 

Item (Category) Difficulty Parameters (eta):

X2X3 X4X5X6X7 Cat 2 
Cat 3   Cat 4

Estimate -670.9137 -554.6215 527.789997 -1359.721 -1127.137 -626.1859 -126.7199 
-4753.367 2134.408482

Std.Err  2152.9823 1679.2875   2.377241   NaN   NaN 3394.5180  562.6800 
11045.9353.526018

 

I can’t find any special values in the data list

   X1 X2 X3 X4 X5 X6 X7

270  4  4  4  3  4  4  4
271  3  3  3  1  3  3  3
272  4  3  4  1  4  4  4

273  3  3  3  3  3  3  3

274  3  3  4  4  3  3  4

275  3  3  3  3  3  3  3

276  1  3  3  3  3  3  3

277  3  3  3  2  4  4  4

278  2  3  2  1  3  3  3

279  3  3  3  2  3  3  3

280  3  3  2  2  3  3  3

281  3  4  4  3  4  3  3

282  2  2  2  2  2  2  2

283  3  4  3  1  4  3  3

284  2  4  2  1  4  3  2

285  3  3  3  3  3  3  3

286  4  4  3  4  4  4  4

287  4  3  4  0  3  4  4

288  0  3  4  0  4  4  1

289  4  4  4  4  4  4  4

290  3  3  3  3  3  3  2

 

If I input many different numbers of data, the results often become strange.

The data is appended at the letter. No na values in all data.

 

Great thanks



 all data  is in the appended file







__
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-es] Reemplazar NA's

2021-09-28 Thread Proyecto R-UCA
Buenas

Si el data.frame, o cualquier otro objeto con dos dimensiones es d, 
d$Localidad[is.na(d$Localidad)] <- d$Provincia[is.na(d$Localidad]]

O bien en dos pasos:
index <- is.na(d$Localidad)
d$Localidad[index] <- d$Provinica[index]

Un saludo


-- 
--
http://knuth.uca.es/R
--
Proyecto R-UCA
--
Nombre: Manuel Muñoz Márquez
Departamento: Departamento de Estadística e Investigación Operativa
Institución: Escuela Superior de Ingeniería
Organización: Universidad de Cádiz
--


El mar, 28-09-2021 a las 11:29 +0200, XYGcom escribió:
> Buenos días. Una pregunta que supongo sencilla pero a la que no le
> encuentro solución: ¿como reemplazo los valores NA por el que figura en
> otra columna?
> 
> Supongamos que tengo:
> Localidad. Provincia
> Argamasilla   Ciudad Real
> NA Cuenca
> NA Albacete
> 
> Quisiera sustituir el primer NA por Cuenca, el segundo por Albacete y
> así en todo el dataframe.
> 
> Gracias anticipadas a todos.
> 
> Jesús López
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es

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


[R-es] Reemplazar NA's

2021-09-28 Thread XYGcom
Buenos días. Una pregunta que supongo sencilla pero a la que no le encuentro 
solución: ¿como reemplazo los valores NA por el que figura en otra columna?

Supongamos que tengo:
Localidad. Provincia
Argamasilla   Ciudad Real
NA Cuenca
NA Albacete

Quisiera sustituir el primer NA por Cuenca, el segundo por Albacete y así en 
todo el dataframe.

Gracias anticipadas a todos.

Jesús López
___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es