[R] using edit to extract codes from vignette failed

2014-09-07 Thread PO SU

Dear expeRts,
    When i using the following code, i get a error as follows:



 edit(file=vignette(grobs,package = grid))
Error in edit.vignette(file = vignette(grobs, package = grid)) : 
  argument name is missing, with no default


I investigated edit function, but still can't  get codes from a vignette, May 
you help me?


--

PO SU
mail: desolato...@163.com 
Majored in Statistics from SJTU
__
R-help@r-project.org mailing list
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] Defining vectors with per-determined correlations

2014-09-07 Thread peter dalgaard

On 04 Sep 2014, at 19:32 , Ista Zahn istaz...@gmail.com wrote:

 See ?mvrnorm in the MASS package.

... and in particular, notice its empirical=TRUE argument. 

Also, notice that the 3rd correlation (corr(x, z)=r3, say) can't be set 
arbitrarily: if r1=r2=0.99, r3 cannot be zero. 

 
 Best,
 Ista
 
 
 On Thu, Sep 4, 2014 at 12:04 PM, John Sorkin jsor...@grecc.umaryland.edu
 wrote:
 
 I need to define three vectors x, y, z (each of length 100) such that the
 pair-wise correlations of the vectors have per-defined values r1 and r2.
 More specifically I need to define x, y, and z so that:
 
 corr(x,y) = r1
 corr(y,z) = r2
 
 Is there any easy way to accomplish this with R?
 
 Thank you,
 John
 John David Sorkin M.D., Ph.D.
 Professor of Medicine
 Chief, Biostatistics and Informatics
 University of Maryland School of Medicine Division of Gerontology and
 Geriatric Medicine
 Baltimore VA Medical Center
 10 North Greene Street
 GRECC (BT/18/GR)
 Baltimore, MD 21201-1524
 (Phone) 410-605-7119
 (Fax) 410-605-7913 (Please call phone number above prior to faxing)
 
 Confidentiality Statement:
 This email message, including any attachments, is for ...{{dropped:18}}
 
 __
 R-help@r-project.org mailing list
 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
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
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] using edit to extract codes from vignette failed

2014-09-07 Thread Uwe Ligges



On 07.09.2014 11:06, PO SU wrote:


Dear expeRts,
 When i using the following code, i get a error as follows:



  edit(file=vignette(grobs,package = grid))


I guess you want to

edit(file = vignette(grobs, package = grid)[[file]])

?

Best,
Uwe Ligges





Error in edit.vignette(file = vignette(grobs, package = grid)) :
   argument name is missing, with no default


I investigated edit function, but still can't  get codes from a vignette, May 
you help me?


--

PO SU
mail: desolato...@163.com
Majored in Statistics from SJTU
__
R-help@r-project.org mailing list
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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Question about searchTwitter{twitteR}

2014-09-07 Thread Axel Urbiz
Hello,

The function searchTwitter() with the arguments supplied as below would
give me a different number of results on different days I run this code.
Maybe it is my lack of understanding about what the date arguments are
supposed to do in this function, but I would think I should be getting the
same tweets?


tweets - searchTwitter('my text search',
n = 1000,
since = '2013-09-01',
until = '2014-08-31')


Thanks,
Axel.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Solving equations

2014-09-07 Thread Mohan Radhakrishnan
Hi,
 I code R to parse data but not for solving equations. So this is
my first such problem. It is a programming puzzle.

I have these two equations.

1)4x - 3w = 0
2)8x - 7w =0

I know the value of x and w for

equation 1).  x = 3 and w = 4
equation 2).  x = 7 and w = 8

I also know how to write more equations based on data available in the
puzzle.

How do I solve a set of such equations ? I need to find out the values of x
and w for each such equation.

I know that here the equations are simple because the puzzle can be
simplfied.


Thanks,
Mohan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Testing general hypotheses on regression coefficients

2014-09-07 Thread peter dalgaard

On 06 Sep 2014, at 12:24 , bonsxanco bonsxa...@yahoo.com wrote:

 
 1) 8th grade algebra tells me B2/B1 == 0 == B2 =0;
 
 EViews (econometrics program) doesn't have the same opinion:
 
 Wald test on my real model (edited):
 
 * H0: B3/B2 = 0 - F-stat = 37.82497 
 * H0: B3 = 0- F-stat = 16.31689 

And when the econometrics program contradicts what you learned in 8th grade, 
surely the latter is wrong and the former is right, because it is done by a 
computer and computers cannot be wrong? ;-)

Probably what this shows most of all is a weakness of the Wald test approach: 
The s.e. of (b3hat/b2hat) will likely differ from s.e.(b3hat)/b2hat and hence 
the test statistics will differ even though they really test the same 
hypothesis. Actually, there are two generic weaknesses: (a) the somewhat 
arbitrary choice of test statistic and (b) the fact that the s.e. is not 
calculated at the null value of the parameter, but at the estimate.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
R-help@r-project.org mailing list
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] Solving equations

2014-09-07 Thread David Winsemius
In my education this was 9th or 10th grade (US) math. The r-help mailing list 
is not set up for providing mini-tutorials on R programming. Please read the 
Posting Guide, do the expected self-eduction in R programming, do the requested 
searching on your remaining questions in the Archives or StackOverflow and then 
in a few weeks considered reposting. Before doing so ... learn to post in plain 
text as as the Guide request.

-- 
David.

On Sep 7, 2014, at 1:54 AM, Mohan Radhakrishnan wrote:

 Hi,
 I code R to parse data but not for solving equations. So this is
 my first such problem. It is a programming puzzle.
 
 I have these two equations.
 
 1)4x - 3w = 0
 2)8x - 7w =0
 
 I know the value of x and w for
 
 equation 1).  x = 3 and w = 4
 equation 2).  x = 7 and w = 8
 
 I also know how to write more equations based on data available in the
 puzzle.
 
 How do I solve a set of such equations ? I need to find out the values of x
 and w for each such equation.
 
 I know that here the equations are simple because the puzzle can be
 simplfied.
 
 
 Thanks,
 Mohan
 
   [[alternative HTML version deleted]]
-- 

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list
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] Solving equations

2014-09-07 Thread Rui Barradas

Hello,

Inline.

Em 07-09-2014 09:54, Mohan Radhakrishnan escreveu:

Hi,
  I code R to parse data but not for solving equations. So this is
my first such problem. It is a programming puzzle.

I have these two equations.

1)4x - 3w = 0
2)8x - 7w =0

I know the value of x and w for

equation 1).  x = 3 and w = 4
equation 2).  x = 7 and w = 8


Why? Any of those equations defines a straight line, not a point. Those 
two points are just one of the infinitely many solutions.


Your equations are equivalent to
eq1) w = 4/3x
eq2) w = 8/7x

the equations of straight lines passing through the origin (no 
independent term).




I also know how to write more equations based on data available in the
puzzle.

How do I solve a set of such equations ? I need to find out the values of x
and w for each such equation.


There are packages to solve simultaneous equations but I've never used them.

Hope this helps,

Rui Barradas


I know that here the equations are simple because the puzzle can be
simplfied.


Thanks,
Mohan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about searchTwitter{twitteR}

2014-09-07 Thread Amos B. Elberg
Twitter tweets aren't a stable database. I wouldn't expect the search results 
to stay stable, as tweets are retweeted, deleted, accounts are closed, privacy 
settings adjusted, etc.  And if there are more than 1000 results, I don't know 
that twitter is internally ordered so you'd get the same set of results each 
time you run the same search. 

 On Sep 7, 2014, at 10:20 AM, Axel Urbiz axel.ur...@gmail.com wrote:
 
 Hello,
 
 The function searchTwitter() with the arguments supplied as below would
 give me a different number of results on different days I run this code.
 Maybe it is my lack of understanding about what the date arguments are
 supposed to do in this function, but I would think I should be getting the
 same tweets?
 
 
 tweets - searchTwitter('my text search',
n = 1000,
since = '2013-09-01',
until = '2014-08-31')
 
 
 Thanks,
 Axel.
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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
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] CRAN (and crantastic) updates this week

2014-09-07 Thread Crantastic
CRAN (and crantastic) updates this week

New packages


* classyfire (0.1-0)
  Maintainer: Eleni Chatzimichali
  Author(s): Eleni Chatzimichali ea.chatzimich...@gmail.com and Conrad Bessant
 c.bess...@qmul.ac.uk
  License: GPL (= 2)
  http://crantastic.org/packages/classyfire

  A collection of functions for the creation and application of highly
  optimised, robustly evaluated ensembles of support vector machines
  (SVMs). The package takes care of training individual SVM
  classifiers using a fast parallel heuristic algorithm, and combines
  individual classifiers into ensembles. Robust metrics of
  classification performance are offered by bootstrap resampling and
  permutation testing.

* cooptrees (1.0)
  Maintainer: Manuel Fontenla
  Author(s): Manuel Fontenla
  License: GPL-3
  http://crantastic.org/packages/cooptrees

  Computes several cooperative games and allocation rules associated
  with minimum cost spanning tree problems and minimum cost
  arborescence problems.

* coreTDT (1.0)
  Maintainer: Yu Jiang
  Author(s): Yu Jiang, Andrew S Allen
  License: GPL-3
  http://crantastic.org/packages/coreTDT

  Use to analysis case-parent trio sequencing studies. Test the compound
  heterozygous and recessive disease models

* descomponer (1.0)
  Maintainer: Francisco Parra
  Author(s): Francisco Parra  parra...@cantabria.es
  License: GPL (= 2)
  http://crantastic.org/packages/descomponer

  Decompose a time series into seasonal, trend and irregular components
  using transformations to amplitude-frequency domain.

* Frames2 (0.0.3)
  Maintainer: David Molina
  Author(s): Antonio Arcos ar...@ugr.es, Maria del Mar Rueda mru...@ugr.es,
 Maria Giovanna Ranalli giovanna.rana...@stat.unipg.it
 and David Molina dmoli...@ugr.es
  License: GPL (= 2)
  http://crantastic.org/packages/Frames2

  Point and interval estimation in dual frame surveys. In contrast to
  classic sampling theory, where only one sampling frame is
  considered, dual frame methodology assumes that there are two frames
  available for sampling and that, overall, they cover the entire
  target population. Then, two probability samples (one from each
  frame) are drawn and information collected is suitably combined to
  get estimators of the parameter of interest.

* GUILDS (1.2)
  Maintainer: Thijs Janzen
  Author(s): Thijs Janzen
  License: GPL-2
  http://crantastic.org/packages/GUILDS

  The GUILDS package combines a range of sampling formulas for the
  unified neutral model of biogeography and biodiversity. Alongside
  the sampling formulas, it includes methods to perform maximum
  likelihood optimization of the sampling formulas, methods to
  generate data given the neutral model, and methods to estimate the
  expected species abundance distribution. Sampling formulas included
  in the GUILDS package are the Etienne Sampling Formula (Etienne
  2005), the guild sampling formula, where guilds are assumed to
  differ in dispersal ability (Janzen 2014), and  the guilds sampling
  formula conditioned on guild size (Janzen 2014).

* iBATCGH (1.0)
  Maintainer: Alberto Cassese
  Author(s): Alberto Cassese
  License: GPL-2
  http://crantastic.org/packages/iBATCGH

  Bayesian integrative models of gene expression and comparative genomic
  hybridization data. The package provides inference on copy number
  variations and their association with gene expression

* ica (1.0-0)
  Maintainer: Nathaniel E. Helwig
  Author(s): Nathaniel E. Helwig hel...@umn.edu
  License: GPL (= 2)
  http://crantastic.org/packages/ica

  Independent Component Analysis (ICA) using various algorithms:
  FastICA, Information-Maximization (Infomax), and Joint Approximate
  Diagonalization of Eigenmatrices (JADE).

* insuranceData (1.0)
  Maintainer: Alicja Wolny--Dominiak
  Author(s): Alicja Wolny--Dominiak and Michal Trzesiok
  License: GPL-2
  http://crantastic.org/packages/insuranceData

  Insurance datasets, which are often used in claims severity and claims
  frequency modelling. It helps testing new regression models in those
  problems, such as GLM, GLMM, HGLM, non-linear mixed models etc. Most
  of the data sets are applied in the project quot;Mixed models in
  ratemakingquot; supported by grant NN 111461540 from Polish National
  Science Center.

* JAGUAR (1.1)
  Maintainer: Chaitanya Acharya
  Author(s): Chaitanya R. Acharya and Andrew S. Allen
  License: GPL-2
  http://crantastic.org/packages/JAGUAR

  Implements a 2 degree-of-freedom score test that measures 1) the
  overall shift in the gene expression due to genotype, and 2)
  group-specific changes in gene expression due to genotype
  (interaction term) in a mixed-effects model framework.

* mpcv (1.0)
  Maintainer: Krzysztof Ciupke
  Author(s): Krzysztof Ciupke krzysztof.ciu...@polsl.pl
  License: GPL (= 2.0)
  http://crantastic.org/packages/mpcv

  Multivariate process capability analysis using the multivariate
  process capability vector. Allows to analyze a 

Re: [R] Mixed sorting/ordering of strings acknowledging roman numerals?

2014-09-07 Thread Henrik Bengtsson
Thank you David - it took me awhile to get back to this and dig into
it.  It's clever to imitate gtools::mixedorder() as far as possible.
A few comments:

1. It took me a while to understand why you picked 3899 in your
Roman-to-integer table; it's because roman(x) is NA for x  3899.
(BTW, in 'utils', there's utils:::.roman2numeric() which could be
utilized, but it's currently internal.)

2. I think you forgot D=500 and M=1000.

3. There was a typo in your code; I think you meant rank.roman instead
of rank.numeric in one place.

4. The idea behind nonnumeric() is to identify non-numeric substrings
by is.na(as.numeric()).  Unfortunately, for romans that does not work.
Instead, we need to use is.na(numeric(x)) here, i.e.

  nonnumeric - function(x) {
  suppressWarnings(ifelse(is.na(numeric(x)), toupper(x), NA))
  }

Actually, gtools::mixedorder() could use the same.

5. I undid your .numeric to .roman to minimize any differences to
gtools::mixedorder().


With the above fixes, we now have:

mixedorderRoman - function (x)
{
if (length(x)  1)
return(NULL)
else if (length(x) == 1)
return(1)
if (is.numeric(x))
return(order(x))
delim = \\$\\@\\$
# NOTE: Note that as.roman(x) is NA for x  3899
romanC - as.character( as.roman(1:3899) )
numeric - function(x) {
suppressWarnings(match(x, romanC))
}
nonnumeric - function(x) {
suppressWarnings(ifelse(is.na(numeric(x)), toupper(x),
NA))
}
x - as.character(x)
which.nas - which(is.na(x))
which.blanks - which(x == )
if (length(which.blanks)  0)
x[which.blanks] - -Inf
if (length(which.nas)  0)
x[which.nas] - Inf
delimited - gsub(([IVXCLM]+),
paste(delim, \\1, delim, sep = ), x)
step1 - strsplit(delimited, delim)
step1 - lapply(step1, function(x) x[x  ])
step1.numeric - lapply(step1, numeric)
step1.character - lapply(step1, nonnumeric)
maxelem - max(sapply(step1, length))
step1.numeric.t - lapply(1:maxelem, function(i) sapply(step1.numeric,
function(x) x[i]))
step1.character.t - lapply(1:maxelem, function(i) sapply(step1.character,
function(x) x[i]))
rank.numeric - sapply(step1.numeric.t, rank)
rank.character - sapply(step1.character.t, function(x)
as.numeric(factor(x)))
rank.numeric[!is.na(rank.character)] - 0
rank.character - t(t(rank.character) + apply(matrix(rank.numeric),
2, max, na.rm = TRUE))
rank.overall - ifelse(is.na(rank.character), rank.numeric,
rank.character)
order.frame - as.data.frame(rank.overall)
if (length(which.nas)  0)
order.frame[which.nas, ] - Inf
retval - do.call(order, order.frame)
return(retval)
}


The difference to gtools::mixedorder() is minimal:

 romanC - as.character( as.roman(1:3899) )
21c11
 suppressWarnings(match(x, romanC))
---
 suppressWarnings(as.numeric(x))
24c14
 suppressWarnings(ifelse(is.na(numeric(x)), toupper(x),
---
 suppressWarnings(ifelse(is.na(as.numeric(x)), toupper(x),
34c24
 delimited - gsub(([IVXCLDM]+),
---
 delimited - 
 gsub(([+-]{0,1}[0-9]+\\.{0,1}[0-9]*([eE][\\+\\-]{0,1}[0-9]+\\.{0,1}[0-9]*){0,1}),
59,62d48

This difference is so small that the above could now be an option to
mixedorder() with minimal overhead added, e.g. mixedorder(y,
type=c(decimal, roman)).  One could even imagine adding support
for binary, octal and hexadecimal (not done).

Greg (maintainer of gtools; cc:ed), is this something you would
consider adding to gtools?  I've modified the gtools source code
available on CRAN (that's the only source I found), added package
tests, updated the Rd and verified it passes R CMD check.  If
interested, please find the updates at:

  https://github.com/HenrikBengtsson/gtools/compare/cran:master...master

Thanks

Henrik

On Tue, Aug 26, 2014 at 6:46 PM, David Winsemius dwinsem...@comcast.net wrote:

 On Aug 26, 2014, at 5:24 PM, Henrik Bengtsson wrote:

 Hi,

 does anyone know of an implementation/function that sorts strings that
 *contain* roman numerals (I, II, III, IV, V, ...) which are treated as
 numbers.  In 'gtools' there is mixedsort() which does this for strings
 that contains (decimal) numbers.  I'm looking for a mixedsortroman()
 function that does the same but with roman numbers, e.g.

 It's pretty easy to sort something you know to be congruent with the existing 
 roman class:

 romanC - as.character( as.roman(1:3899) )
 match(c(I, II, III,X,V), romanC)
 #[1]  1  2  3 10  5

 But I guess you already know that, so you want a regex approach to parsing. 
 Looking at the path taken by Warnes, it would involve doing something like 
 his regex based insertion of a delimiter for Roman numeral but simpler 
 because he needed to deal with decimal points and signs and exponent 
 notation, none of which you appear to need. If you only need to consider 
 character and Roman, then this hack of Warnes tools succeeds:

  

Re: [R] Mixed sorting/ordering of strings acknowledging roman numerals?

2014-09-07 Thread David Winsemius

On Sep 7, 2014, at 7:40 PM, Henrik Bengtsson wrote:

 Thank you David - it took me awhile to get back to this and dig into
 it.  It's clever to imitate gtools::mixedorder() as far as possible.
 A few comments:
 
 1. It took me a while to understand why you picked 3899 in your
 Roman-to-integer table; it's because roman(x) is NA for x  3899.
 (BTW, in 'utils', there's utils:::.roman2numeric() which could be
 utilized, but it's currently internal.)

Yes, that was the reason. I didn't think I needed a Roman-to-numeric function 
because I discovered the roman numbers were actually simple numeric vectors to 
which a class had been assigned and that it was the class-facilities that did 
all the work. The standard Ops functions were just acting on numeric vectors.

If one doesn't take care, their romanity can be lost:

 R - as.roman(10^(0:4))
 R
[1] IXCMNA

 unclass(R)
[1]1   10  100 1000   NA

 sum(R, na.rm=TRUE)
[1] 
 as.roman(sum(R, na.rm=TRUE))
[1] MCXI

 
 2. I think you forgot D=500 and M=1000.

Quite possible. I suspect Greg will have corrected the omission, but if not, 
this will be helpful to him.

 
 3. There was a typo in your code; I think you meant rank.roman instead
 of rank.numeric in one place.
 

I understood Greg's intention to wrap this into the mixedorder and mixed sort 
duo.

Best;
David.

 4. The idea behind nonnumeric() is to identify non-numeric substrings
 by is.na(as.numeric()).  Unfortunately, for romans that does not work.
 Instead, we need to use is.na(numeric(x)) here, i.e.
 
  nonnumeric - function(x) {
  suppressWarnings(ifelse(is.na(numeric(x)), toupper(x), NA))
  }
 
 Actually, gtools::mixedorder() could use the same.
 
 5. I undid your .numeric to .roman to minimize any differences to
 gtools::mixedorder().
 
 
 With the above fixes, we now have:
 
 mixedorderRoman - function (x)
 {
if (length(x)  1)
return(NULL)
else if (length(x) == 1)
return(1)
if (is.numeric(x))
return(order(x))
delim = \\$\\@\\$
# NOTE: Note that as.roman(x) is NA for x  3899
romanC - as.character( as.roman(1:3899) )
numeric - function(x) {
suppressWarnings(match(x, romanC))
}
nonnumeric - function(x) {
suppressWarnings(ifelse(is.na(numeric(x)), toupper(x),
NA))
}
x - as.character(x)
which.nas - which(is.na(x))
which.blanks - which(x == )
if (length(which.blanks)  0)
x[which.blanks] - -Inf
if (length(which.nas)  0)
x[which.nas] - Inf
delimited - gsub(([IVXCLM]+),
paste(delim, \\1, delim, sep = ), x)
step1 - strsplit(delimited, delim)
step1 - lapply(step1, function(x) x[x  ])
step1.numeric - lapply(step1, numeric)
step1.character - lapply(step1, nonnumeric)
maxelem - max(sapply(step1, length))
step1.numeric.t - lapply(1:maxelem, function(i) sapply(step1.numeric,
function(x) x[i]))
step1.character.t - lapply(1:maxelem, function(i) sapply(step1.character,
function(x) x[i]))
rank.numeric - sapply(step1.numeric.t, rank)
rank.character - sapply(step1.character.t, function(x)
 as.numeric(factor(x)))
rank.numeric[!is.na(rank.character)] - 0
rank.character - t(t(rank.character) + apply(matrix(rank.numeric),
2, max, na.rm = TRUE))
rank.overall - ifelse(is.na(rank.character), rank.numeric,
rank.character)
order.frame - as.data.frame(rank.overall)
if (length(which.nas)  0)
order.frame[which.nas, ] - Inf
retval - do.call(order, order.frame)
return(retval)
 }
 
 
 The difference to gtools::mixedorder() is minimal:
 
  romanC - as.character( as.roman(1:3899) )
 21c11
  suppressWarnings(match(x, romanC))
 ---
suppressWarnings(as.numeric(x))
 24c14
  suppressWarnings(ifelse(is.na(numeric(x)), toupper(x),
 ---
suppressWarnings(ifelse(is.na(as.numeric(x)), toupper(x),
 34c24
  delimited - gsub(([IVXCLDM]+),
 ---
delimited - 
 gsub(([+-]{0,1}[0-9]+\\.{0,1}[0-9]*([eE][\\+\\-]{0,1}[0-9]+\\.{0,1}[0-9]*){0,1}),
 59,62d48
 
 This difference is so small that the above could now be an option to
 mixedorder() with minimal overhead added, e.g. mixedorder(y,
 type=c(decimal, roman)).  One could even imagine adding support
 for binary, octal and hexadecimal (not done).
 
 Greg (maintainer of gtools; cc:ed), is this something you would
 consider adding to gtools?  I've modified the gtools source code
 available on CRAN (that's the only source I found), added package
 tests, updated the Rd and verified it passes R CMD check.  If
 interested, please find the updates at:
 
  https://github.com/HenrikBengtsson/gtools/compare/cran:master...master
 
 Thanks
 
 Henrik
 
 On Tue, Aug 26, 2014 at 6:46 PM, David Winsemius dwinsem...@comcast.net 
 wrote:
 
 On Aug 26, 2014, at 5:24 PM, Henrik Bengtsson wrote:
 
 Hi,
 
 does anyone know of an implementation/function that sorts strings that
 *contain* roman numerals (I, II, III, IV, V, 

[R] Psych package

2014-09-07 Thread sarbani.dasgupta
Hi Team,

I tried using fa.ply function for a dataset with ordinal and nominal 
variables.Its giving the following Warning.Is it a bug?Or we need to use some 
other procedure for factor analysis of ordinal/nominal data?

Code:-
faPCdirect - fa.poly(mydata, nfactors=12, rotate=varimax)

Warning:-
The items do not have an equal number of response alternatives, global set to 
FALSE

The items do not have an equal number of response alternatives, global set to 
FALSE
The estimated weights for the factor scores are probably incorrect.  Try a 
different factor extraction method.
There were 35 warnings (use warnings() to see them)

Regards
Sarbani



This message is for the designated recipient only and ma...{{dropped:16}}

__
R-help@r-project.org mailing list
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] Solving equations

2014-09-07 Thread Mohan Radhakrishnan
No. I was not looking for an answer to that question. I wasn't clear :-) I
already code using Octave and R to solve ML algorithms.

I am trying to understand  how R packages can help us to solve such
equations using LU decomposition etc. The question was about using R with
these math algorithms.

Mohan

On Mon, Sep 8, 2014 at 12:31 AM, Rui Barradas ruipbarra...@sapo.pt wrote:

 Hello,

 Inline.

 Em 07-09-2014 09:54, Mohan Radhakrishnan escreveu:

 Hi,
   I code R to parse data but not for solving equations. So this is
 my first such problem. It is a programming puzzle.

 I have these two equations.

 1)4x - 3w = 0
 2)8x - 7w =0

 I know the value of x and w for

 equation 1).  x = 3 and w = 4
 equation 2).  x = 7 and w = 8


 Why? Any of those equations defines a straight line, not a point. Those
 two points are just one of the infinitely many solutions.

 Your equations are equivalent to
 eq1) w = 4/3x
 eq2) w = 8/7x

 the equations of straight lines passing through the origin (no independent
 term).


 I also know how to write more equations based on data available in the
 puzzle.

 How do I solve a set of such equations ? I need to find out the values of
 x
 and w for each such equation.


 There are packages to solve simultaneous equations but I've never used
 them.

 Hope this helps,

 Rui Barradas


 I know that here the equations are simple because the puzzle can be
 simplfied.


 Thanks,
 Mohan

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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
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.