Re: [R] computing distance in miles or km between 2 street addre

2007-09-06 Thread Henrik Bengtsson
On 9/6/07, Rolf Turner [EMAIL PROTECTED] wrote: On 7/09/2007, at 10:17 AM, (Ted Harding) wrote: On 06-Sep-07 18:42:32, Philip James Smith wrote: Hi R-ers: I need to compute the distance between 2 street addresses in either km or miles. I do not care if the distance is a shortest

Re: [R] quantile() returns a value outside the data range

2007-08-22 Thread Henrik Bengtsson
Hi, yes, it is all about numerical accuracy; x - c(6.402611, 6.402611, 6.420587) x001 - sapply(1:9, function(type) quantile(x, probs=0.01, type=type)) names(x001) - NULL print(x001) ## [1] 6.402611 6.402611 6.402611 6.402611 6.402611 ## [6] 6.402611 6.402611 6.402611 6.402611 diff(x001) ## [1]

Re: [R] function to find coodinates in an array

2007-08-16 Thread Henrik Bengtsson
See arrayIndex() in the R.utils package, e.g. X - array((2*3*4):1, dim=c(2,3,4)) idx - 1:length(X) ijk - arrayIndex(idx, dim=dim(X)) print(ijk) [,1] [,2] [,3] [1,]111 [2,]211 [3,]121 [4,]221 [5,]131 [6,]231 [7,]1

Re: [R] reading BMP or TIFF files

2007-06-07 Thread Henrik Bengtsson
See the EBImage package on Bioconductor. /Henrik On 6/7/07, Bob Meglen [EMAIL PROTECTED] wrote: I realize that this question has been asked before (2003); From: Yi-Xiong Zhou Date: Sat 22 Nov 2003 - 10:57:35 EST but I am hoping that the answer has changed. Namely, I would rather read the

Re: [R] handling a cancelled file.choose()

2007-06-06 Thread Henrik Bengtsson
See ?tryCatch. Example: Function returning NULL if cancelled: fileChoose - function(...) { pathname - NULL; tryCatch({ pathname - file.choose(); }, error = function(ex) { }) pathname; } /Henrik On 6/6/07, Ben Tupper [EMAIL PROTECTED] wrote: Hello, I have a file reading

Re: [R] Getting names of objects passed with ...

2007-06-01 Thread Henrik Bengtsson
I use: foo - function(...) { args - list(...); names(args); } /Henrik On 6/1/07, Mike Meredith [EMAIL PROTECTED] wrote: Is there a tidy way to get the names of objects passed to a function via the ... argument? rbind/cbind does what I want: test.func1 - function(...) { nms -

Re: [R] how to abort script with message

2007-05-21 Thread Henrik Bengtsson
Hi, I think the behavior that you outline is due to the fact that you cut'n'paste the script to the R prompt, is that correct? If so, use source() instead to run your script, then stop() will do what you want. /Henrik On 5/21/07, Blew, Ted [EMAIL PROTECTED] wrote: it is desired to abort an R

Re: [R] Size of an object in workspace

2007-04-24 Thread Henrik Bengtsson
See ll() in R.oo (that is two L:s), e.g. ll() member data.class dimension objectSize 1 author character 1120 2 myfunc function NULL512 3 x matrix c(3,11)248 4 y array c(5,7,1)264 ll() is quite flexible so you can create

Re: [R] Matlab import

2007-04-19 Thread Henrik Bengtsson
Hi, as already mentioned, do not save MAT files in ASCII format but save to binary formats, i.e. do *not* use -ascii. Moreover, from ?readMat, you find that: From Matlab v7, _compressed_ MAT version 5 files are used by default [3]. These are not supported. Use 'save -V6' in Matlab to

Re: [R] erratic behavior of match()?

2007-04-19 Thread Henrik Bengtsson
...and so say google [http://www.google.com/search?q=1%250.1]: 1 modulo 0.1 = 0.1, so end of discussion ;) In bit of a food coma now, but the following is interesting: r = a %% b = r = (b*a/b) %% (b*b/b) = r = b*((a/b) %% 1) modulo - function(a, b) { b * ((a/b) %% 1) } intdiv

Re: [R] Matlab import

2007-04-19 Thread Henrik Bengtsson
Hope this helps. Spencer Graves Henrik Bengtsson wrote: Hi, as already mentioned, do not save MAT files in ASCII format but save to binary formats, i.e. do *not* use -ascii. Moreover, from ?readMat, you find that: From Matlab v7, _compressed_ MAT version 5 files are used

Re: [R] R in cron job: X problems

2007-04-19 Thread Henrik Bengtsson
Try using png2() in R.utils, which immitates png() but uses bitmap() and ghostscript to create the PNG file. You need to set 'R_GSCMD' to tell R where ghostscript is located - you can use System$findGhostscript() at startup to let R try to locate ghostscript for you. /H On 4/19/07, Mark

Re: [R] Runing R in a bash script

2007-04-17 Thread Henrik Bengtsson
Or see png2() in R.utils, which imitates png() but uses bitmap(), which in turn uses postscript-to-png via ghostscript. BTW, personally I think PNGs generated via bitmap() look way better than the ones generated via png(). /Henrik On 4/17/07, Jeffrey Horner [EMAIL PROTECTED] wrote: Ulrik

Re: [R] Reading a csv file row by row

2007-04-06 Thread Henrik Bengtsson
Hi. On 4/6/07, Yuchen Luo [EMAIL PROTECTED] wrote: Hi, my friends. When a data file is large, loading the whole file into the memory all together is not feasible. A feasible way is to read one row, process it, store the result, and read the next row. In Fortran, by default, the 'read'

Re: [R] package for Matlab

2007-04-05 Thread Henrik Bengtsson
On 4/5/07, Tobias Verbeke [EMAIL PROTECTED] wrote: Schmitt, Corinna wrote: Hallo, does a package for Matlab exist in R? To read and write MAT files, there is the R.matlab package: http://cran.r-project.org/src/contrib/Descriptions/R.matlab.html This package also enables bidirectional

Re: [R] reading raw matrix saved with writeBin

2007-03-15 Thread Henrik Bengtsson
FYI, to save data as bitmap images, see the EBImage package on Bioconductor. /H On 3/15/07, Ranjan Maitra [EMAIL PROTECTED] wrote: On Wed, 14 Mar 2007 18:45:53 -0700 (PDT) Milton Cezar Ribeiro [EMAIL PROTECTED] wrote: Dear Friends, I saved a matrix - which contans values 0 and 1 -

[R] hpush not allowed

2007-03-02 Thread Henrik Bengtsson
Hi, I've get the following on both strider and frodo: frodo{hb}: hpush -v Sorry, user hb is not allowed to execute '/usr/local/bin/hpush -v' as upush on frodo.Berkeley.EDU. Strange, because it worked when we set it up Thursday. Thxs Henrik __

Re: [R] hpush not allowed

2007-03-02 Thread Henrik Bengtsson
[that one went to the wrong [EMAIL PROTECTED] sorry about that. /Henrik] On 3/2/07, Henrik Bengtsson [EMAIL PROTECTED] wrote: Hi, I've get the following on both strider and frodo: frodo{hb}: hpush -v Sorry, user hb is not allowed to execute '/usr/local/bin/hpush -v' as upush

Re: [R] R File IO Slow?

2007-03-01 Thread Henrik Bengtsson
Just an idea: Two things that can slow down save()/load() is if you save() in ASCII format or a compressed binary format. If this is your case for MYFILE, try to resave in a non-compressed binary format. See ?save for details. /HB On 3/1/07, ramzi abboud [EMAIL PROTECTED] wrote: Is R file IO

[R] Removing directory?

2007-02-28 Thread Henrik Bengtsson
Hi, I'm trying to remove/delete a directory usingR. I've tried the following with no success: % Rterm --vanilla getwd() [1] C:/Documents and Settings/hb/braju.com.R/aroma.affymetrix/test dir.create(foo) file.info(foo) size isdir mode mtime ctime

Re: [R] Removing directory?

2007-02-28 Thread Henrik Bengtsson
file.info(foo) size isdir mode mtime ctime atime foo NANA NA NA NA NA file.exists(foo) [1] FALSE /Henrik On 2/28/07, James W. MacDonald [EMAIL PROTECTED] wrote: I think you want to add a recursive = TRUE to your call to unlink(). Best, Jim Henrik Bengtsson wrote: Hi, I'm

Re: [R] Problem with R interface termination

2007-02-27 Thread Henrik Bengtsson
Hi, this is due to the R.utils library. Interestingly, others reported this yesterday. There are three different ways to get around the problem right now: 1) Exit R so it does not call .Last() by quit(runLast=FALSE), 2) load the R.utils package and then exit via quit() as usual, or 3) remove

Re: [R] Problem with R interface termination

2007-02-27 Thread Henrik Bengtsson
For the completion of this thread; the below update was confirmed to solve the problem. /HB On 2/27/07, Henrik Bengtsson [EMAIL PROTECTED] wrote: Hi, this is due to the R.utils library. Interestingly, others reported this yesterday. There are three different ways to get around the problem

Re: [R] exact matching of names in attr

2007-02-26 Thread Henrik Bengtsson
if (!name %in% names(attributes(dat))) { ... } /Henrik On 2/26/07, Michael Toews [EMAIL PROTECTED] wrote: In R 2.5.0 (r40806), one of the change is to allow partial matching of name in the attr function. However, how can I tell if I have an exact match or not? For example, checking to see

Re: [R] convert to binary to decimal

2007-02-17 Thread Henrik Bengtsson
On 2/16/07, Jim Regetz [EMAIL PROTECTED] wrote: Roland Rau wrote: On 2/16/07, Petr Pikal [EMAIL PROTECTED] wrote: Hi slight modification of your function can be probably even quicker: fff-function(x) sum(2^(which(rev(x))-1)) :-) Petr Yes, your function is slightly but

Re: [R] help with tryCatch

2007-02-15 Thread Henrik Bengtsson
ignore since source(arg) in R takes care of closing. } } } for (Object j:err){ System.out.println(j); } } } Henrik Bengtsson wrote: To be more precise, put the tryCatch() only around the code causing the problem

Re: [R] help with tryCatch

2007-02-13 Thread Henrik Bengtsson
Henrik Bengtsson wrote: See ?tryCatch. /Henrik On 2/12/07, Stephen Bond [EMAIL PROTECTED] wrote: Could smb please help with try-catch encapsulating a function for downloading. Let's say I have a character vector of symbols and want to download each one and surround by try and catch

Re: [R] help with tryCatch

2007-02-13 Thread Henrik Bengtsson
file and stops there while I want it to go through the list and accumulate the nonexistent filenames in err. Thank you Stephen Henrik Bengtsson wrote: Hi, google R tryCatch example and you'll find: http://www.maths.lth.se/help/R/ExceptionHandlingInR/ Hope this helps Henrik

Re: [R] help with tryCatch

2007-02-13 Thread Henrik Bengtsson
To be more precise, put the tryCatch() only around the code causing the problem, i.e. around source(). /H On 2/13/07, Henrik Bengtsson [EMAIL PROTECTED] wrote: Put the for loop outside the tryCatch(). /H On 2/13/07, Stephen Bond [EMAIL PROTECTED] wrote: Henrik, thank you

Re: [R] help with tryCatch

2007-02-12 Thread Henrik Bengtsson
See ?tryCatch. /Henrik On 2/12/07, Stephen Bond [EMAIL PROTECTED] wrote: Could smb please help with try-catch encapsulating a function for downloading. Let's say I have a character vector of symbols and want to download each one and surround by try and catch to be safe # get.hist.quote() is

Re: [R] reading very large files

2007-02-02 Thread Henrik Bengtsson
Hi. General idea: 1. Open your file as a connection, i.e. con - file(pathname, open=r) 2. Generate a row to (file offset, row length) map of your text file, i.e. a numeric vector 'fileOffsets' and 'rowLengths'. Use readBin() for this. You build this up as you go by reading the file in chunks

Re: [R] reading very large files

2007-02-02 Thread Henrik Bengtsson
Forgot to say, in your script you're reading the rows unordered meaning you're jumping around in the file and there is no way the hardware or the file caching system can optimize that. I'm pretty sure you would see a substantial speedup if you did: sel - sort(sel); /H On 2/2/07, Henrik

Re: [R] Need to fit a regression line using orthogonal residuals

2007-01-30 Thread Henrik Bengtsson
The iwpca() in Bioconductor package aroma.light takes a matrix of column vectors and fits an R-dimensional hyperplane using iterative re-weighted PCA. From ?iwpca.matrix: Arguments: X N-times-K matrix where N is the number of observations and K is the number of dimensions. Details: This

Re: [R] R.oo Destructors

2007-01-17 Thread Henrik Bengtsson
in R.oo? How I'd like to use it: I have an object which opens a connection thru RODBC (held as a private member) It would be nice if the connection closes automatically (inside the destructor) when an object gets gc()'ed. Thanks in advance. Regards, Ken BTW, a BIG thanks to Henrik

Re: [R] [[ gotcha

2007-01-16 Thread Henrik Bengtsson
To create a empty list do: B - list() /H On 1/16/07, Robin Hankin [EMAIL PROTECTED] wrote: The following gotcha caught me off-guard just now. I have two matrices, a and b: a - matrix(1,3,3) b - matrix(1,1,1) (note that both a and b are matrices). I want them in a list: B -

Re: [R] Speeding things up

2007-01-08 Thread Henrik Bengtsson
First, since you only update the 'ddtd' conditioned on 'value', you should be able to vectorize removing the loop. I let you figure out how to do that yourself. Second, you apply the $ operator multiple times in the loop that will definitely add some overhead. It should be faster to extract

Re: [R] A question about R environment

2007-01-08 Thread Henrik Bengtsson
sourceTo() in R.utils will allow you to source() a file into an environment. /Henrik On 1/9/07, Gabor Grothendieck [EMAIL PROTECTED] wrote: Try this: e - new.env() e$f - function(x)x attach(e) search() [1] .GlobalEnve package:stats [4] package:graphics

Re: [R] Evaluating Entire Matlab code at a time

2006-12-30 Thread Henrik Bengtsson
This is very odd, but maybe 'cd' is not a command on your Windows Matlab installation. I tried the same code on a Unix installation (I don't have access to Matlab for Windows but others have been using R.matlab there successfully). Find out what the command for getting the current directory in

Re: [R] Failure loading library into second R 2.3.1 session on Windows XP

2006-12-29 Thread Henrik Bengtsson
Hi, it sounds like you mixing up the words install and load. Basically, you only have to *install* a package once on your computer, but have to load it for every R session which you are going to use it in. So, in your case install it once, using either install.packages(corpcor) or the

Re: [R] Evaluating Entire Matlab code at a time

2006-12-29 Thread Henrik Bengtsson
Hi. On 12/30/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote: Dear Mr.Bengtsson, The steps you have suggested are working for single lines of matlab statements. But, as i mentioned earlier, If i want to see the output of an entire matlab code (say swissroll.m) then you suggested me to do res -

Re: [R] Query regarding linking R with Matlab

2006-12-28 Thread Henrik Bengtsson
On 12/28/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote: Respected Sir, It worked. open(matlab) [1] TRUE Good. But however, the 'evaluate' function is not responding. When i give the command as: res - evaluate(matlab, A=1+2;, B=ones(2,20);) The R interface is not returning any value

Re: [R] Query regarding linking R with Matlab

2006-12-28 Thread Henrik Bengtsson
[Forwarding to r-help for completeness. /Henrik] -- Forwarded message -- From: Henrik Bengtsson [EMAIL PROTECTED] Date: Dec 28, 2006 9:45 PM Subject: Re: [R] Query regarding linking R with Matlab To: [EMAIL PROTECTED] Hi. On 12/28/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote

Re: [R] Query regarding linking R with Matlab

2006-12-27 Thread Henrik Bengtsson
Hi, It might be that R can't find Matlab; then you have to specify option 'matlab', see help(Matlab). Try also a different port. Try to add a line setVerbose(matlab, -2) to get more detailed output what is going on; matlab - Matlab(host=localhost, port=9998) setVerbose(matlab, -2) if

Re: [R] Query regarding linking R with Matlab

2006-12-27 Thread Henrik Bengtsson
Hi. From what you tell me you manage to start Matlab in the background by calling: Matlab$startServer() but that R fails to connect to Matlab by: matlab - Matlab(host=localhost, port=9998) if (!open(matlab)) throw(Matlab server is not running: waited 30 seconds.) Sorry for not being

Re: [R] R.matlab question

2006-12-27 Thread Henrik Bengtsson
? Henrik On 12/20/06, Henrik Bengtsson [EMAIL PROTECTED] wrote: Hi. On 12/20/06, Aimin Yan [EMAIL PROTECTED] wrote: Does anyone know how to solve this question about R.matlab? I am in windowsXP, my matlab is matlab 7.0.0 19920(R14) thanks, Aimin matlab - Matlab(host=localhost, port

Re: [R] R.matlab question

2006-12-20 Thread Henrik Bengtsson
Hi. On 12/20/06, Aimin Yan [EMAIL PROTECTED] wrote: Does anyone know how to solve this question about R.matlab? I am in windowsXP, my matlab is matlab 7.0.0 19920(R14) thanks, Aimin matlab - Matlab(host=localhost, port=9998) if (!open(matlab)) throw(Matlab server is not running:

Re: [R] Query regarding linking R with Matlab

2006-12-20 Thread Henrik Bengtsson
Hi. On 12/20/06, Bhanu Kalyan.K [EMAIL PROTECTED] wrote: Sir, I am still new to the R-matlab interfacing. I will explain you the problem statement more clearly. The following is a matlab code. (swissroll.m) = % SWISS ROLL DATASET

Re: [R] call by reference

2006-12-20 Thread Henrik Bengtsson
There is no support for 'call by reference' in the S language, and this is intentionally, but you can use environments to imitate it, cf. ?environment. See also the R.oo package. /Henrik On 12/20/06, biter bilen [EMAIL PROTECTED] wrote: Can anyone help me about pass by reference of arguments

Re: [R] Query regarding linking R with Matlab

2006-12-17 Thread Henrik Bengtsson
Hi, what operating system are you on and what version of Matlab do you have? In general you should be able to get started with R.matlab by first installing all required packages from CRAN: install.packages(c(R.oo, R.utils, R.matlab)) Then load the package: library(R.matlab) From there just

Re: [R] Start Matlab server in R 2.4.0

2006-12-17 Thread Henrik Bengtsson
Hi. On 12/18/06, Aimin Yan [EMAIL PROTECTED] wrote: In order to start matlab server in R , I using the following commands getwd() setwd(D:\R_matlab) install.packages(R.oo) install.packages(R.matlab) install.packages(R.utils) library(R.matlab) Matlab$startServer() a minimized MATLAB

Re: [R] How do I create an object in the Global environment from a function

2006-12-14 Thread Henrik Bengtsson
Please note that help(-) says: The operators '-' and '-' cause a search to made through the environment for an existing definition of the variable being assigned. If such a variable is found (and its binding is not locked) then its value is redefined, otherwise assignment takes

Re: [R] reaccessing array at a later date - trying to write it to file

2006-11-23 Thread Henrik Bengtsson
Here is a simple function that allow you to load the objects stored by save() into an evironment (to avoid loading them into the global workspace): loadToEnv - function(...) { env - new.env() load(..., env=env) env } x - 1:10 save(file=foo.xdr, x, letters, R.version) objects -

Re: [R] Single precision data behaviour with readBin()

2006-11-09 Thread Henrik Bengtsson
Hi, what you are observing is the fact that there is always a limit in the precision a floating-point values can be stored. The value you are trying to read is stored in 4 bytes (floats). For higher precision, the value could be stored in 8 bytes (doubles). BTW, R works with 8 byte

Re: [R] Object attributes in R

2006-10-11 Thread Henrik Bengtsson
On 10/11/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: You can define your own class then define [ to act any way you would like: [.myobj - function(x, ...) { y - unclass(x)[...] Careful, this is not the same as y - NextMethod([, x, ...) /Henrik attributes(y)

Re: [R] testing for error

2006-10-09 Thread Henrik Bengtsson
tryCatch() is doing exactly what you need. I consider tryCatch() an updated and more flexible version of try() making the latter history. /H On 10/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: See: http://www.mail-archive.com/r-help@stat.math.ethz.ch/msg09925.html On 10/9/06, Jonathan

Re: [R] Space required by object?

2006-09-27 Thread Henrik Bengtsson
See ll() in the R.oo package. /Henrik On 9/27/06, Ben Fairbank [EMAIL PROTECTED] wrote: Does R provide a function analogous to LS() or str() that reports the storage space, on disk or in memory, required by objects? Ben Fairbank __

Re: [R] printing a variable name in a for loop

2006-09-26 Thread Henrik Bengtsson
Example: lst - list(variable1, variable2, variable3) for (kk in seq(along=lst)) { name - names(lst)[kk]; value - lst[[kk]]; cat(Hello,, name, value, , World,) } /Henrik On 9/26/06, Jim Lemon [EMAIL PROTECTED] wrote: Suzi Fei wrote: Hello, How do you print a variable name in a for

Re: [R] Creating Movies with R

2006-09-23 Thread Henrik Bengtsson
On 9/22/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: See the flag= argument on formatC: n - 10 formatC(1:n, dig = nchar(n)-1, flag = 0) # Here is another way: n - 10 sprintf(paste(%0, nchar(n), .0f, sep = ), 1:n) sprintf(%0*.0f, nchar(n), 1:n) or even sprintf(%0*d, nchar(n), 1:n)

Re: [R] Adding .R to source file keeps R from reading it?

2006-09-21 Thread Henrik Bengtsson
Hmm... sounds like you're on Windows and have the Explorer setup such that it is hiding file extensions. You can try to use list.files() from R to see if the files actually have file extension. If this is your problem, open My Computer - Tools - Folder Options... and select tab View. Make sure

Re: [R] new version of The R Guide available on CRAN

2006-08-22 Thread Henrik Bengtsson
Hi, thanks for this. I'll keep it in mind next time in teaching/referring someone to R. BTW, before the R-core guys get you ;) Just replace all places where you use library to refer to a package (see all comments on the definition of these on r-help/r-devel), e.g. Page 17: FYI, .GlobalEnv is

Re: [R] how to skip certain rows when reading data

2006-07-28 Thread Henrik Bengtsson
Have a look at readTable() in the R.utils package. It can do quite a few thinks like reading subsets of rows, specify colClasses by column names etc. Implementation was done so that memory usage is as small as possible. Note the note on the help page: WARNING: This method is very much in an

[R] Generating valid R code using R

2006-07-16 Thread Henrik Bengtsson
Hi, I'm trying to generate valid R code using R. Parts of the task is to read a sequence of characters from file and escape them such that they can be put in quotation marks to form a valid R code string. Example: Let the input file be (four rows containing ASCII 0-255 characters):

Re: [R] R.oo question

2006-05-26 Thread Henrik Bengtsson
On 5/26/06, Omar Lakkis [EMAIL PROTECTED] wrote: This is a simple R.oo question but I, thankfully, hope that someone would explain it to me so I would better understand this work frame. I create this class: setConstructorS3(MyExample, function(param=0) { print(paste(called with param=,

Re: [R] Avoiding a memory copy by [[

2006-05-23 Thread Henrik Bengtsson
On 5/23/06, Matthew Dowle [EMAIL PROTECTED] wrote: Hi, n = 1000 L = list(a=integer(n), b=integer(n)) L[[2]][1:10] gives me the first 10 items of the 2nd vector in the list L. It works fine. However it appears to copy the entire L[[2]] vector in memory first, before subsetting it.

Re: [R] Avoiding a memory copy by [[

2006-05-23 Thread Henrik Bengtsson
On 5/23/06, Matthew Dowle [EMAIL PROTECTED] wrote: Thanks. I looked some more and found that L$b[1:10] doesn't seem to copy L$b. If that's correct why does L[[2]][1:10] copy L[[2]] ? I forgot, this is probably what I was told in discussion about UseMethod($) the other day: The $ operator is

Re: [R] multiple plots with par mfg

2006-05-23 Thread Henrik Bengtsson
saveSubplot - function() { if (!exists(subplotPars, mode=list)) subplotPars - list(); p - par(no.readonly=TRUE); mfg - p$mfg; key - mfg[1]*(mfg[3]-1)+mfg[2]; subplotPars[[key]] - p; invisible(key); } restoreSubplot - function(mfg) { opar - par(); if (length(mfg) == 2) mfg

Re: [R] R.matlab anyone ?

2006-05-08 Thread Henrik Bengtsson (max 7Mb attachments)
Hi Alex, author here - thanks for this. Indeed, there is a typo in MatlabServer.m that gives the error iff the port number is out of range. So if you set MATLABSERVER_PORT in range it should work. However, the Matlab code contains a syntax error in that statement which shouldn't be there. FYI,

Re: [R] load file RData which store in zip file

2006-03-29 Thread Henrik Bengtsson
@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+2h UTC) __ R-help@stat.math.ethz.ch mailing list https

Re: [R] load huge image

2006-03-27 Thread Henrik Bengtsson
the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+2h UTC) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org

Re: [R] The R fork

2006-03-18 Thread Henrik Bengtsson
On 3/18/06, Uwe Ligges [EMAIL PROTECTED] wrote: pau carre wrote: Hello, I would like to call a function that can take infinite time to be executed in some circumstances (which can not be easily detected). So, I would like that once the function is being executed for more than two seconds

Re: [R] storing via for (k in 1:100) {}

2006-03-18 Thread Henrik Bengtsson
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC

Re: [R] How to divide too long labels?

2006-03-18 Thread Henrik Bengtsson
://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Traffic on R-Help Mailing List

2006-03-17 Thread Henrik Bengtsson
Hi, there's been plenty of messages sent during that period. The r-help archive is at https://www.stat.math.ethz.ch/pipermail/r-help/ (you can find this via http://www.r-project.org/ - Mailing Lists - r-help/web interface - R-help Archives). There are similar pages for r-devel and the other

Re: [R] handling warning messages

2006-03-16 Thread Henrik Bengtsson
the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org

Re: [R] setMethod confusion

2006-03-15 Thread Henrik Bengtsson
-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] Additional arguments in S3 method produces a warning

2006-03-15 Thread Henrik Bengtsson
__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC) __ R-help

Re: [R] info() function?

2006-03-08 Thread Henrik Bengtsson
feature in the base package? Any suggestions? Robert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Henrik Bengtsson Mobile

Re: [R] returning the largest element in an array/matrix?

2006-03-07 Thread Henrik Bengtsson
This is a problem how to convert vector indices to array indices. Here is a general solution utilizing the fact that matrices are stored column by column in R (this extends to arrays of any dimension): arrayIndex - function(i, dim) { ndim - length(dim); # number of dimension v -

Re: [R] Making an S3 object act like a data.frame

2006-03-07 Thread Henrik Bengtsson
Hi. On 3/7/06, hadley wickham [EMAIL PROTECTED] wrote: [.ggobiDataset - function(x, ..., drop=FALSE) { x - as.data.frame(x) NextMethod([, x) } [[.ggobiDataset - function(x, ..., drop=FALSE) { x - as.data.frame(x) NextMethod([[, x) } $.ggobiDataset -

Re: [R] Adding header lines to a dataframe that is exported using write.csv

2006-02-27 Thread Henrik Bengtsson
-guide.html -- Henrik Bengtsson Mobile: +46 708 909208 (+1h UTC) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] R and Power Point

2006-02-14 Thread Henrik Bengtsson
On 2/14/06, Duncan Murdoch [EMAIL PROTECTED] wrote: On 2/14/2006 9:08 AM, Michael Kubovy wrote: On Feb 14, 2006, at 1:46 AM, Erin Hodgess wrote: I'm using R in a time series class. ... I have decided to put together Power Point slides for the teaching. ... I am currently saving the R

Re: [R] chm.help in windows

2006-01-23 Thread Henrik Bengtsson
Same in R v2.2.1 patched (2006-01-01 r36947) and Rv2.3.0 (2006-01-01 r36947). /Henrik Thomas Steiner wrote: options(chmhelp=TRUE) help(package=fCalendar) does not open teh windows help browser, but help(CalendarData, package=fCalendar) does. Why? A bug? I use R 2.1.1 under

[R] LaTeX slide show (Was: Re: Taking code from packages)

2006-01-13 Thread Henrik Bengtsson
Duncan Murdoch wrote: On 1/13/2006 2:04 AM, Ales Ziberna wrote: Hello! [snip] (I'm a little sensitive about dependencies now, since the LaTeX seminar template I've used a few times no longer works. It depends on too many LaTeX packages, and someone, somewhere has introduced

Re: [R] R - Wikis and R-core

2006-01-12 Thread Henrik Bengtsson
[EMAIL PROTECTED] wrote: Hello Martin and others, I am happy with this decision. I'll look a little bit at this next week. Best, Philippe Grosjean We've had a small review time within R-core on this topic, amd would like to state the following:

Re: [R] [R-pkgs] sudoku

2006-01-09 Thread Henrik Bengtsson
Subject: Re: [R] [R-pkgs] sudoku Date: Sat, 07 Jan 2006 09:36:54 +1100 From: Henrik Bengtsson [EMAIL PROTECTED] To: Brahm, David [EMAIL PROTECTED] CC: [EMAIL PROTECTED] References: [EMAIL PROTECTED] Brahm, David wrote: Any doubts about R's big-league status should be put to rest, now

Re: [R] repeat { readline() }

2006-01-08 Thread Henrik Bengtsson
as a character during keyboard input. I doubt if that was intentional (0 is not the default state) and I have changed it for R-devel.\ Thank you very much this. Henrik On Sun, 8 Jan 2006, Henrik Bengtsson wrote: Hi. Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like repeat

[R] repeat { readline() }

2006-01-07 Thread Henrik Bengtsson
Hi. Using Rterm v2.2.1 on WinXP, is there a way to interrupt a call like repeat { readline() } without killing the Command window? Ctrl+C is not interrupting the loop: R : Copyright 2006, The R Foundation for Statistical Computing Version 2.2.1 Patched (2006-01-01 r36947) snip/snip

Re: [R] Using 'polygon' in a 3d plot

2006-01-04 Thread Henrik Bengtsson
Ted Freeman wrote: I'm new to R, after many years of using Matlab. I've found the R function 'polygon' to be nearly equivalent to the Matlab function 'patch'. For example, the R commands: plot(c(0, 5), c(0, 4), type = 'n', asp = 1, ann = FALSE) x - c(1, 2, 2, 1.5, 1) z - c(1, 1, 2, 1.7,

Re: [R] Age of an object?

2005-12-14 Thread Henrik Bengtsson
If R would have timestamps telling when any object was last modified, we could extend R with a 'GNU make'-style functionality (or syntax) together with some fancy caching to persistent storage (files, data bases, ...). That would really nice! As B.R. and M.M. writes, timestamping is most

[R] About help on 'mahalanobis'

2005-12-13 Thread Henrik Bengtsson
Hi, help on 'mahalanobis' (in the stats package in Rv2.2.0) now says: Description: Returns the Mahalanobis distance of all rows in 'x' and the vector mu='center' with respect to Sigma='cov'. This is (for vector 'x') defined as D^2 = (x - mu)' Sigma^{-1} (x -

Re: [R] Row wise function call.

2005-11-30 Thread Henrik Bengtsson
Vasundhara Akkineni wrote: I have another issue.i have a function which calculates the log2(col i /col2) value, where i stands for columns 3,4,...etc. data-read.table(table.txt, header=TRUE) iratio-function(x){ for(n in 3:ncol(data)){ z-log2(data[x,n]/data[x,2]) } } Where x- the row

Re: [R] Superimpose Histograms

2005-11-29 Thread Henrik Bengtsson
See library(R.basic) example(plot.histogram) x1 - rnorm(1000, 0.4, 0.8) x2 - rnorm(1000, 0.0, 1.0) x3 - rnorm(1000, -1.0, 1.0) hist(x1, width=0.33, offset=0.00, col=blue, xlim=c(-4,4), main=Histogram of x1, x2 x3, xlab=x1 - blue, x2 - red, x3 - green) hist(x2,

Re: [R] Row-wise data retrieval

2005-11-29 Thread Henrik Bengtsson
Vasundhara Akkineni wrote: I want to retrieve data row wise from a data frame. My data frame is as below: data-read.table(table.txt, header=TRUE) how can i get row-wise data? Examples: data[1,] data[2,] for (rr in 1:nrow(data)) data[rr,] rows - c(1, 5:8, 3) data[rows,] /Henrik

Re: [R] Removing Rows

2005-11-21 Thread Henrik Bengtsson
seq() is good at these kind of things: keep - seq(from=1, to=nrow(d), by=10) d1 - d[ keep,] d2 - d[-keep,] /Henrik Juan Pablo Romero wrote: try this: (if d is the data.frame) 1) d[ (1:217)[1:217 %% 10 == 0], ] 2) d[ (1:217)[1:217 %% 10 != 0], ] 2005/11/21, mark salsburg

Re: [R] writing R shell scripts?

2005-11-09 Thread Henrik Bengtsson
Mike Miller wrote: On Wed, 9 Nov 2005, Henrik Bengtsson wrote: A note of concern: When writing batch scripts like this, be explicit and use the print() statement. A counter example to compare echo 1; 2 | R --slave --no-save and echo print(1); print(2) | R --slave --no-save I

Re: [R] read.table error with R 2.2.0

2005-11-09 Thread Henrik Bengtsson
Florence Combes wrote: Thanks a lot for your answer. In fact I found the solution, it's seems strange to me so I put it here if it could bu useful for other people ... I have the same as you getAnywhere(read.table)$where [1] package:base namespace:base

Re: [R] writing R shell scripts?

2005-11-08 Thread Henrik Bengtsson
Mike Miller wrote: Many thanks for the suggestions. Here is a related question: When I do things like this... echo matrix(rnorm(25*2),c(25,2)) | R --slave --no-save ...I get the desired result except that I would like to suppress the [,1] row and column labels so that only the values go to

Re: [R] writing R shell scripts?

2005-11-08 Thread Henrik Bengtsson
Mike Miller wrote: On Wed, 9 Nov 2005, Henrik Bengtsson wrote: What you really want to do might be solved by write.table(), e.g. x - matrix(rnorm(25*2),c(25,2)); write.table(file=stdout(), x, row.names=FALSE, col.names=FALSE); Thanks. That does what I want. There is one remaining

Re: [R] warning.expression?

2005-09-23 Thread Henrik Bengtsson
Roger D. Peng wrote: You might be interested in 'tryCatch' to catch warnings. A warning here: tryCatch(expr, warning=...) will catch warnings and interrupt 'expr' (as if an error occured), whereas withCallingHandlers(expr, warning=...) does not do this. /Henrik -roger Thomas

Re: [R] help.search problem

2005-09-06 Thread Henrik Bengtsson
What version of R and what operating system? What packages do you have loaded? Try utils::help.search(tps), does that work? Have you tried it in a fresh R session, i.e. start with R --vanilla. If you can't get it to work after this, report the above information plus what you get from

  1   2   3   >