Displaying 20 results from an estimated 4000 matches similar to: "Error list and debugging R code"
2005 May 31
2
FYI: Problems while loading package "class (VR)"
Hi,
Today, I performed automatic updates of packages and somehow lost "class"
package. I loaded a library that depended on it and got:
Error: package 'class' could not be loaded
In addition: Warning message: there is no package called 'class' in:
library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc)
I tried to load it by instal-package: class (VR) and
2005 May 26
2
Reading text files and readLine
Hi,
I am trying to write a function to read in a whole text file as a single
string ( so I can calculate its "sha1" hash function using package
"digest"). I need a single string containing the whole file, and so far I
was using paste(readLines(fileName), collapse = ""). Unfortunately this
function gives me warnings :
incomplete final line found by readLines on
2005 Oct 04
6
Animation of Mandelbrot Set
Hi,
I was playing with Mandelbrot sets and come up with the following code, I
thought I would share:
library(fields) # for tim.colors
library(caTools) # for write.gif
m = 400 # grid size
C = complex( real=rep(seq(-1.8,0.6, length.out=m), each=m ),
imag=rep(seq(-1.2,1.2, length.out=m), m ) )
C = matrix(C,m,m)
Z = 0
X = array(0, c(m,m,20))
for (k in 1:20) {
Z =
2005 Mar 25
2
Casting in R
Hi,
I am looking for functions that would allow me to access raw binary data of
R vectors. One way would be to use:
x = (1:10)*pi
writeBin(x, "temp.bin")
r = readBin("temp.bin", "raw", n=length(x)*8)
Other to write my own C code. Is there any other simpler way?
I this message is a rewording of my yesterday message "Looking for function
for Double to
2005 Mar 24
1
Unexpected error "subset assignment" (bug?)
Hi,
I run into following problem. It seems to me that operation in the 3rd line
should be valid.
> b = matrix(as.raw(0), 8,8)
> q = as.raw(1:8)
> b[1,] = q
Error: incompatible types in subset assignment
> length(b[1,])
[1] 8
> typeof(b[1,])
[1] "raw"
> length(q)
[1] 8
> typeof(q)
[1] "raw"
Is this a bug or a "feature"?
Jarek
2005 Jun 29
2
"all connections are in use" error during lazyload stage of packa ge installation
Hi,
I suddenly started getting strange errors while working on my caTools
package:
>RCMD install C:/programs/R/rw2011/src/library/caTools
......
preparing package caTools for lazy loading
Error in file(file, "r", encoding = encoding) :
all connections are in use
Execution halted
make: *** [lazyload] Error 1
*** Installation of caTools failed ***
I searched
2005 Sep 15
2
Splitting the string at the last sub-string
Hi,
I need to split a string into 2 strings, with the split point defined by the
last occurrence of some substring. I come up with some convoluted code to do
so:
str = "Chance favors the prepared mind"
sub = "e"
y = unlist(strsplit(str,sub))
z = cbind(paste(y[-length(y)], sub, sep="", collapse = ""), y[length(y)]);
y
z
z[1]
z[2]
Is there a simpler way
2005 May 27
1
xmlAttrs and problems with reading node attributes of XML file (b ug?)
Hi,
Consider the following code:
require(XML)
xmlFile = paste( "<?xml version=\"1.0\"
encoding=\"ISO-8859-1\"?>\n",
"<mzXML xmlns=\"a\" xmlns:xsi=\"b\"
xsi:schemaLocation=\"c\">\n",
"<parentFile a=\"a\" b=\"b\" />\n",
2005 Jul 15
3
Passing character strings from C code to R
Hi,
I have a C code which produces array of integers and potentially a string,
and I have problems passing the string out. Here is the relevant part of the
code:
1 PROTECT(Ret = allocVector(INTSXP, n));
2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */
3 for(i=0; i<n; i++) ret[i] = data[i];
4 Free(data);
5 i=1;
6 if (comment) { // comment was found
7 n
2005 Jul 15
3
Passing character strings from C code to R
Hi,
I have a C code which produces array of integers and potentially a string,
and I have problems passing the string out. Here is the relevant part of the
code:
1 PROTECT(Ret = allocVector(INTSXP, n));
2 ret = (int*) INTEGER(Ret); /* get pointer to R's Ret */
3 for(i=0; i<n; i++) ret[i] = data[i];
4 Free(data);
5 i=1;
6 if (comment) { // comment was found
7 n
2005 Oct 12
1
Questions about readBin function (Was: dec2bin?)
Hi,
The latest version of R had some changes to functions "readbin() and
writeBin() [which] now support raw vectors as well as filenames and
connections.". As a result I am working on retiring "raw2bin" and "bin2raw"
functions from "caTools" package which do exactly the same. Thanks to Prof.
Ripley for bringing this change to my attention.
Which brings me
2005 May 06
1
Latex can not find Rd.sty
Hi,
Lately my Latex engine used for checking packages stop working, and I can
not figure out how to fix it.
When creating my package (caMassClass) I get the
* checking caMassClass-manual.tex ... ERROR
LaTeX errors when creating DVI version.
This typically indicates Rd problems.
message. I look in caMassClass-manual.log file and find
! LaTeX Error: File `Rd.sty' not found.
2005 Jul 18
2
New functions supporting GIF file format in R
Hi,
A minor announcement. I just added two functions for reading and writing GIF
files to my caTools package. Input and output is in the form of standard R
matrices or arrays, and standard R color-maps (palettes). The functions can
read and write both regular GIF images, as well as, multi-frame animated
GIFs. Most of the work is done in C level code (included), so functions do
not use any
2004 Nov 03
2
Unexpected results from sort function when partial and index are used
Hi,
Consider the following example:
sort(10:1, partial=3)
## 1 2 3 7 6 5 4 8 9 10
sort(10:1, index=T)
## $x: 1 2 3 4 5 6 7 8 9 10
## $ix: 10 9 8 7 6 5 4 3 2 1
sort(10:1, partial=3, index=T)
## 1 2 3 7 6 5 4 8 9 10
The first 2 calls gave expected returns; however, the third one did not
returned an index as requested. I could not find anything about it in
2005 Aug 09
3
how to use the function from another package
Hi, I am trying to write a package(A) for myself and need to use a
function from another package(B) which is in R already(need to install
it before use). Could anyone tell me how to implement that? Also I
hope that my package gives an ERROR message(something like "STOP,
please install package B first") if the package B is not installed
yet. It is my first time to write a package. Thanks
2005 Jun 30
1
Is.integer and testing for integers
Hi,
I was trying to figure out if there is a function in R that tests if R
object contains only integers. I though "is.integer" would be it, but this
function only checks "whether its argument is of integer type or not". As a
result
x = (1:5)^2
is.integer(x)
Returns false. Of course I can write my own function like
"!any(x!=as.integer(x))" but I am just trying to
2005 Apr 02
1
Survey of "moving window" statistical functions - still looking f or fast mad function
Hi,
First, let me thank Jaroslaw for making this survey. I find it quite
illuminating.
Now the questions:
* the #1 solution below (based on cumsum) is numerically unstable.
Specifically if you do the runmean on a positive vector you can easily
get negative numbers due to rounding errors. Does anyone see a
modification which is free of this deficiency?
* is it possible to optimize the
2005 Sep 22
2
Survey of ROC AUC / wilcoxon test functions
Hi,
I was lately debugging parts of my 'colAUC' function in caTools package, and
in a process looked into other packages for calculating Areas Under ROC
Curves (AUC). To my surprise I found at least 6 other functions:
* wilcox.test
* AUC from ROC package,
* performance from ROCR package,
* auROC from limma package,
* ROC from Epi package,
* roc.area from verification
2005 Oct 01
3
dec2bin?
Hello,
I just want to ask if there is any function that can convert decimal
number to binary vector.
Thanks a lot.
Haiyong
2005 Oct 31
1
Sum of logical vector
Hi,
Recently I was told by users of some of the function I wrote that they
experience crashes in places where logical vector was passed to sum
function. However on my computer those functions work just fine. After
closer look at documentation of function 'sum', I realized that it is
defined only for complex and numeric vectors, so I guess I was using
"undocumented feature".