dkahle / mpoly

Symbolic computing with multivariate polynomials in R
https://dkahle.github.io/mpoly/
12 stars 12 forks source link

R CMD check failures with stringr 1.0.0 #1

Closed hadley closed 8 years ago

hadley commented 9 years ago

Could you please take a look?

checking examples ... ERROR
Running examples in ‘mpoly-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: mp
> ### Title: Define a multivariate polynomial.
> ### Aliases: mp
> 
> ### ** Examples
> 
> ( m <- mp('x + y + x y') )
x  +  y  +  x y
> is.mpoly( m )
[1] TRUE
> unclass(m)
[[1]]
   x coef 
   1    1 

[[2]]
   y coef 
   1    1 

[[3]]
   x    y coef 
   1    1    1 

> 
> mp('x - y')
x  -  y
> mp('x - 1')
x  -  1
> mp('x +      y')
x  +  y
> mp('x -      5')
x  -  5
> mp('x - -5')
x  +  5
> mp('10 x 6 x') # -> 60 x^2
60 x^2
> mp('10 x 6 x + 10 x 6 x y y 2') # -> 60 x^2  +  120 x^2 y^2
60 x^2  +  120 x^2 y^2
> 
> mp('x^2 + x^2 y') # -> x^2  +  x^2 y
x^2  +  x^2 y
> 
> mp('x - x') # -> 0
0
> mp('x - 4 x') # -> -3 x
-3 x
> mp('x y^2 - y^2 x') # -> 0
0
> 
> mp('5^2') # -> 25
25
> mp('2^2 x + 5^2 + 3^2') # -> 4 x  +  34
4 x  +  34
> mp('1 1') # -> 1
1
> mp('-1 -1 -1') # -> 1
-1
> mp('1  3 5^2 + 2 3^4 x') # -> 75  + 162 x
75  +  162 x
> mp("x - 2 x -3") # 7 x
7 x
> 
> ( ms <- mp(c('x + y', '2 x')) )
x  +  y
2 x
> is.mpolyList(ms)
[1] TRUE
> 
> mp('10 x + 2 y 3 + x^2 5 y') # -> 10 x  +  6 y  +  5 x^2 y
10 x  +  6 y  +  5 x^2 y
> mp('x + 2 y + x^2 y + x y z') # -> x  +  2 y  +  x^2 y  +  x y z
x  +  2 y  +  x^2 y  +  x y z
> mp('x + 2 y + x^2 y + x y z', varorder = c('y', 'z', 'x')) # -> x  +  2 y  +  y  +  y z x
x  +  2 y  +  y x^2  +  y z x
> #mp('x + 2 y + x^2 y', varorder = c('q', 'p')) # -> error
> 
> mp('p111 + p121 2 p112^2')
p111  +  2 p121 p112^2
> unclass(mp('p111 + p121 2 p112^2'))
[[1]]
p111 coef 
   1    1 

[[2]]
p121 p112 coef 
   1    2    2 

> 
> mp('0')
0
> mp('2')
2
> mp('-5')
-5
> mp('-4 x')
-4 x
> mp('y + -1 x')
y  -  x
> mp('-1 + x')
-1  +  x
> 
> mp("(x)")
x
> mp("((((x))))")
x
> mp("(x + 0)")
x
> mp("(x + 1)")
x  +  1
> mp("(x - 1)")
x  -  1
> mp("(-1 x - 1)")
-1 x  -  1
> mp("2 (x + 1)")
2 x  +  2
> mp("-1 (x + 1)")
-1 x  -  1
> 
> 
> string <- "-2 x + -1 x (3 x - (7 - 2 x)) 7 (x + 1) -3"
> mp(string)
-149 x  +  105 x^3  -  42 x^2
> # note that in the above problem, the -3 on the end is
> # times negative 3, not minus 3; that would be "... - 3"
> 
> mp("(x + 1) (x - 1)")
x^2  -  1
> mp("(x + 1) (x + 2)")
x^2  +  3 x  +  2
> mp("(x + 1)^5")
x^5  +  5 x^4  +  10 x^3  +  10 x^2  +  5 x  +  1
> mp("x + 1")^5
x^5  +  5 x^4  +  10 x^3  +  10 x^2  +  5 x  +  1
> mp("3 (x + 1) (x + 2)^2")
3 x^3  +  15 x^2  +  24 x  +  12
> 
> mp("(x + y) (x - y)")
x^2  -  y^2
> mp("((x + y) (x - y))^2")
Error in while (str_detect(fLP, "--")) { : 
  missing value where TRUE/FALSE needed
Calls: mp ... lapply -> FUN -> Reduce -> lapply -> as.list -> bubble
Execution halted
dkahle commented 9 years ago

Is 1.0.0 different from the version on github now (0.9.0.9000)? The github mpoly was updated a while back to match up with it and checks out fine. (I assume you checked the CRAN version of mpoly against the new stringr...)