similar to: how to use the function from another package

Displaying 20 results from an estimated 11000 matches similar to: "how to use the function from another package"

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 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 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 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 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 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 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 Aug 02
6
can we manage memory usage to increase speed?
Hi, Thanks for reading. I am running a process in R for microarray data analysis. RedHat Enterprise Linux 4, dual AMD CPU, 6G memory. However, the R process use only a total of <200M memory. And the CPU usage is total to ~110% for two. The program takes at least 2 weeks to run at the current speed. Is there some way we can increase the usage of CPUs and memories and speed up? Any
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
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 07
2
about image() function in R and colors
Hi! I've got a map in R imported from a GIS (GRASS) as a vector of factors. So I've got 20 different levels in the map and I've created a vector of custom colors of exactly 20 colors in lenght. I'm trying to use image() (really plot.grassmeta() that call image()) to plot the map with those colors but it doesnt work and the colors are changed. I would like that all points
2005 Apr 27
1
Error list and debugging R code
Hi, I am trying to debug my code and looking for any tool to help me out with it. My main problem is with the error messages I can not figure out where they come from (what function produced them) and what do they mean. Is there such a think as list of error messages produced by R and standard R packages, and what do they mean? Or any tool to extract information which function produced the
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 26
1
Useful tip: Use Google to find R scripts
Hello, Ever wondered how people use a particular function in their programs? Use Google to find actual scripts: filetype:R boxplot will return real R scripts using the boxplot function. Regards, Pierre Lapointe Assistant Market Strategist *********************************************************************************** AVIS DE NON-RESPONSABILITE:\ Ce document transmis par
2005 Aug 04
2
color palette
Hi, I have a matrix with both positive and negative numbers, I would like to use image() to draw a heatmap. How can I can design a palette (or is there a function already available) that treat negative numbers in a blue gradient and positive numbers in a red gradient and treat 0 as white? Thanks
2005 Sep 28
1
Fast AUC computation
I am doing a simulation with a relatively large data set (20,000 observations) for which I want to calculate the area under the Receiver Operator Curve (AUC) for many parameter combinations. I am using the ROC library and the following commands to generate each AUC: rocobj=rocdemo.sca(truth = ymis, data = model$fitted.values, rule = dxrule.sca) #generation of observed ROC object
2005 Oct 07
2
matrix operation
Hello: I have a matrix 'dat' with 2 columns. I have the following code: for (i in 1:nrows(dat)) { if (dat[i,1] < dat[i,2]) { dat[i,2]<-0 } else { dat[i,2]<-1 } Is there a way to accomplish this without the for loop? Thank you. -Dhiren