[R] plist file?

2010-11-17 Thread Nick Matzke
Hi all, I am running R.app on Mac OS X 10.4. I am trying to figure out if there is a .plist file of some sort, or a similar parameter file, that will let me turn on and off e.g. line-wrapping in the R.app GUI console. The only hint I could find online is this:

[R] Switch Enter and Return in R.app?

2010-07-26 Thread Nick Matzke
Hi all, I googled this but no luck. I am using R.app 2.10.1 on Mac OSX 10.4. Here's the problem: When I type at the R.app command line and hit the carriage return Enter (right pinky, Return on some keyboards), it just adds a blank line. To actually get the command to execute, I have to go

[R] convert 1, 10, and 100 to 0001, 0010, 0100 etc.

2010-09-10 Thread Nick Matzke
Hi, Is there an easy way to convert numbers into a form such that they all have the same number of digits? e.g.: 1, 10, and 100 ...become... 0001, 0010, 0100 etc. I ask because I am producing a large number of files that need to sort consistently by filename. Currently I get this kind

Re: [R] convert 1, 10, and 100 to 0001, 0010, 0100 etc.

2010-09-10 Thread Nick Matzke
Thanks!! David Winsemius wrote: On Sep 10, 2010, at 4:05 PM, Nick Matzke wrote: Hi, Is there an easy way to convert numbers into a form such that they all have the same number of digits? e.g.: 1, 10, and 100 ...become... 0001, 0010, 0100 etc. sprintf(%05.0f, 100) [1] 00100

[R] list of complex objects?

2010-05-25 Thread Nick Matzke
Hi all, If I would like to make a list of complex objects -- in my case, phylogenetic trees, but it could be e.g. statistical results from something like lm, or whatever -- how can I put them into a list? When I try the obvious methods, e.g. cat, append, list, etc., I seem to get weird

Re: [R] list of complex objects?

2010-05-26 Thread Nick Matzke
Erik Iverson wrote: Nick Matzke wrote: Hi all, If I would like to make a list of complex objects -- in my case, phylogenetic trees, but it could be e.g. statistical results from something like lm, or whatever -- how can I put them into a list? When I try the obvious methods, e.g. cat

Re: [R] list of complex objects?

2010-05-26 Thread Nick Matzke
a single list with 4 components. If you want to make a list of objects, use list_of_fits = list(fitJC1, fitJC2, fitJC3) HTH, Peter On Wed, May 26, 2010 at 5:23 PM, Nick Matzke mat...@berkeley.edu wrote: Erik Iverson wrote: Nick Matzke wrote: Hi all, If I would like to make a list of complex

[R] 380x380 dataframe to list

2010-06-04 Thread Nick Matzke
Hi, This can't be hard, but I can't find the solution. I have a 380x380 data frame of numbers. I would like to turn it into a single column so I can do e.g. hist and mean on it without writing my own function. There must be a simple function for this, but I'm stumped -- reshape, dim, etc.

Re: [R] 380x380 dataframe to list

2010-06-04 Thread Nick Matzke
That's the answer, thanks!! Nick Peter Langfelder wrote: c(as.matrix(data)) will not do it? Peter On Fri, Jun 4, 2010 at 5:47 PM, Nick Matzke mat...@berkeley.edu wrote: Hi, This can't be hard, but I can't find the solution. I have a 380x380 data frame of numbers. I would like to turn

[R] weird error: Coercing LHS to a list

2010-06-19 Thread Nick Matzke
Hi all! I'm trying to build a simple class, but I'm getting a weird error. E.g. if I do: == gregion = setClass(gregion, contains = data.frame, representation(name = character, poly.x = numeric, poly.y = numeric )) gregion$name = North America == Then I get this message:

Re: [R] weird error: Coercing LHS to a list

2010-06-20 Thread Nick Matzke
Wow, did I stump everyone with this? Mostly I'd just like to build a class without getting the error below. Cheers! Nick Nick Matzke wrote: Hi all! I'm trying to build a simple class, but I'm getting a weird error. E.g. if I do: == gregion = setClass(gregion, contains = data.frame

[R] sorting matrix to match an ordered list

2009-01-27 Thread Nick Matzke
Hi all, This can't be very hard, but it is sticking me because I am a beginner. Setup: x = rbind(c(0,1,1), c(2,3,1), c(4,5,1)) y = as.matrix(x) rownames(y) = c(a,b,c) colnames(y) = c(a,b,c) ordered_list = c(b, c, a) How do I produce a new matrix, z, with the rows and columns both sorted in

Re: [R] sorting matrix to match an ordered list

2009-01-27 Thread Nick Matzke
1 2 c 5 1 4 a 1 1 0 On Tue, Jan 27, 2009 at 3:26 PM, Nick Matzke mat...@berkeley.edu wrote: Hi all, This can't be very hard, but it is sticking me because I am a beginner. Setup: x = rbind(c(0,1,1), c(2,3,1), c(4,5,1)) y = as.matrix(x) rownames(y) = c(a,b,c) colnames(y) = c(a,b,c

[R] tab characters

2009-01-29 Thread Nick Matzke
Hi all, Working at the R command line, how do I get strings to display e.g. tab or newline characters as they should be displayed, rather than as e.g. \n or \t? e.g.: x=\t x=\t x [1] \t print(x) [1] \t -- Nicholas J. Matzke Ph.D.

[R] running multiple commands in one system() call

2009-02-22 Thread Nick Matzke
Hi all, I'm on Mac OS X 10.4... So I've got a small python script I need to run from R. However, to get the python script working, I need to have the shell that R calls get settings from my .bash_profile file, which apparently it doesn't currently (the shell R calls uses an older version of

[R] last result

2009-01-23 Thread Nick Matzke
Hi, Let's say one has just run a command line command that took an hour and produced a huge matrix as an output. However, one forgot to store the output in a variable. Is there a hidden variable somewhere that stores the result, so that one doesn't have to re-run the analysis for an hour?

Re: [R] last result

2009-01-23 Thread Nick Matzke
Thanks!!! Best R list ever... Cheers, Nick Barry Rowlingson wrote: 2009/1/23 Jorge Ivan Velez jorgeivanve...@gmail.com: See ?.Last.value But don't do that right after you've done the calculation! You get *one* chance with .Last.value: # here comes my important numbers... runif(10)

[R] R console line-wrapping

2009-09-15 Thread Nick Matzke
Hi all, a quick question I couldn't find the answer to in the usual places: Is there a way to turn off line-wrapping in the R console? Or set the line width-before-wrapping manually? Currently it looks like the console linewraps after about 70 characters, this occurs even if I increase the

Re: [R] R console line-wrapping

2009-09-16 Thread Nick Matzke
David Winsemius wrote: On Sep 15, 2009, at 5:47 PM, Nick Matzke wrote: Hi all, a quick question I couldn't find the answer to in the usual places: Is there a way to turn off line-wrapping in the R console? Or set the line width-before-wrapping manually? Currently it looks like

[R] eval(expr) without printing to screen?

2009-09-19 Thread Nick Matzke
Hi, I have a script which I source, which evaluates a changing expression call hundreds of times. It works, but it prints to screen each time, which is annoying. There must be simple way to suppress this, or to use a slightly different set of commands, which will be obvious to those wiser

Re: [R] eval(expr) without printing to screen?

2009-09-20 Thread Nick Matzke
baptiste auguie wrote: Hi, What about this, eval(parse(text=expr)) (no print) HTH, baptiste Thanks. For some reason I couldn't think of that, for some reason I had a dim memory in my head that that wouldn't work, but it does. Thanks! Cheers, Nick 2009/9/19 Nick Matzke mat

[R] subset a string

2010-03-04 Thread Nick Matzke
Hi, This has got to be easy, but for some reason the simplest things can be the hardest to find help on in R. How the heck do I subset a string? e.g., x = abcdef I just want the first 3 characters. Cheers! Nick -- Nicholas J. Matzke

Re: [R] subset a string

2010-03-04 Thread Nick Matzke
thanks!! was stuck in python brain. Simon Blomberg wrote: substr(x,1,3) On Thu, 2010-03-04 at 21:32 -0800, Nick Matzke wrote: Hi, This has got to be easy, but for some reason the simplest things can be the hardest to find help on in R. How the heck do I subset a string? e.g., x = abcdef

[R] histogram-like barplot? (or reverse?)

2010-04-03 Thread Nick Matzke
Hi, I have a simple task I can't figure out. I'd like to take some measurements I made, e.g.: year (y-axis) 1 2 3 4 5 6 counts (x-axis) 10 10 20 30 40 50 And then, make a barplot with the x-axis ticks (representing the borders between years) between the bars. However, barplot seems to

Re: [R] histogram-like barplot? (or reverse?)

2010-04-03 Thread Nick Matzke
(...) { panel.fill(col=white) panel.grid(-1,0,lty=3,col=gray) panel.barchart(...) }, main=xyplot, box.width=5000 ) === Nick Matzke wrote: Hi, I have a simple task I can't figure out. I'd like to take some measurements I made, e.g.: year (y-axis) 1 2 3 4 5 6 counts

[R] limited number of graphs in Quartz window

2011-03-16 Thread Nick Matzke
Hi all, I'm using the R GUI on a Mac. It is easy to produce a number of plots and put them into a Quartz window, and then use Command-left or Command-right to flip between them. However, Quartz seems to hold a maximum of about 15 plots, and then discards anything plotted before that.

[R] parse .ps files with R?

2012-02-18 Thread Nick Matzke
Hi, Is there a way to parse a postscript (*.ps) file with R (or perhaps with some other command-line utility)? E.g., I have a map in postscript format with lots of features, but I just want to extract the coastline and it's coordinates. Any help very much appreciated! Cheers! Nick --

Re: [R] parse .ps files with R?

2012-02-19 Thread Nick Matzke
Thanks very much!! Nick On 2/18/12 7:39 PM, baptiste auguie wrote: Hi, the grImport package provides some tools for this. HTH, b. On 19 February 2012 16:06, Nick Matzkemat...@berkeley.edu wrote: Hi, Is there a way to parse a postscript (*.ps) file with R (or perhaps with some other

[R] Installing rgeos on Mac OS X 10.4 (was Re: package 'stringr' does not have a name space

2011-10-25 Thread Nick Matzke
attempts...) On 10/25/11 1:09 PM, Nick Matzke wrote: Hi all, I have almost gotten rgeos to install, however I'm getting a peculiar error about a (successfully installed) other package, stringr: Error : package 'stringr' does not have a name space I have asked the r-sig-geo list, but this error looks

[R] file name too long error during R CMD INSTALL

2011-10-28 Thread Nick Matzke
Hi all, I am attempting to install a package called phylobase from source directory. It all seems to work until the end, at which point it looks like the last compile command fails because the line is too long...perhaps because the g++ command line also includes Loading ~/.Rprofile..., like

Re: [R] file name too long error during R CMD INSTALL

2011-10-28 Thread Nick Matzke
A correspondant suggests it would help if I said the OS, it's Intel Mac OS X 10.4...yes I should update but I'm trying to hold off a little longer due to numerous other things I don't want to have to reinstall just yet... On 10/28/11 10:54 AM, Nick Matzke wrote: Hi all, I am attempting

[R] knncat broken on R 2.14?

2012-02-01 Thread Nick Matzke
Hi, Until recently I was using the knncat classifier function of knncat on an old computer (2.12, Mac OS X 10.4), and everything worked great. However, now that I have updated to R 2.14.1 (on Mac OS X 10.7), knncat seems broken. Problems: 1. It seems to output verbose output by default,

[R] identical function names from 2 packages

2011-05-18 Thread Nick Matzke
Hi, If I load 2 packages that have a function with the same name, how do I tell R to run one or the other? (Instead of having R automatically use the first- or last-loaded one, whichever it is. (Which is it, by the way.)) Cheers! Nick --

Re: [R] identical function names from 2 packages

2011-05-18 Thread Nick Matzke
Thanks!! Nick On 5/18/11 7:06 PM, Ista Zahn wrote: Hi Nick, See ?:: Best, Ista On Wed, May 18, 2011 at 10:02 PM, Nick Matzkemat...@berkeley.edu wrote: Hi, If I load 2 packages that have a function with the same name, how do I tell R to run one or the other? (Instead of having R

[R] How to check if R.app is running?

2013-01-20 Thread Nick Matzke
Hi, here's an obscure question someone can hopefully help with. I have some R code that uses stuff from parallel (now a part of the R core in 2.15 I believe), especially clusterApply. However, this seems to cause problems in R.app, and I've seen advice to not use these multicore functions,

Re: [R] How to check if R.app is running?

2013-01-20 Thread Nick Matzke
Probably good enough, thanks! Nick On 1/20/13 2:03 PM, Duncan Murdoch wrote: On 13-01-20 4:51 PM, Nick Matzke wrote: Hi, here's an obscure question someone can hopefully help with. I have some R code that uses stuff from parallel (now a part of the R core in 2.15 I believe), especially

[R] populating a large matrix

2012-06-19 Thread Nick Matzke
Hi all, This question is slightly weird. I am trying to populate a matrix with equations. The matrix represents transition probabilities between states. A simple example is: state1 state2 state3 state1 s d d*d state2 e s d*e state3 e*e e*d s

Re: [R] populating a large matrix

2012-06-20 Thread Nick Matzke
Hi! Thanks for the replies, comments below: On 6/20/12 3:26 AM, Oliver Ruebenacker wrote: Hello, For an optimization strategy, we need to know more: do you have many variables? do you have many different formulae? do you re-calculate after changing only one variable? Take care

[R] extract all numbers from a string

2013-06-15 Thread Nick Matzke
Hi all, I have been beating my head against this problem for a bit, but I can't figure it out. I have a series of strings of variable length, and each will have one or more numbers, of varying format. E.g., I might have: tmpstr = The first number is: 32. Another one is: 32.1. Here's a

Re: [R] extract all numbers from a string

2013-06-16 Thread Nick Matzke
,pattern)[[1]] #[1] 32 32.1 0.3523e10 0.3523e-10 -313.1 as.numeric(str_extract_all(tmpstr,pattern)[[1]]) A.K. - Original Message - From: Nick Matzke mat...@berkeley.edu To: R-help@r-project.org Cc: Sent: Sunday, June 16, 2013 1:06 AM Subject: [R] extract all numbers from

Re: [R] extract all numbers from a string

2013-06-17 Thread Nick Matzke
Ooh, nice! Thanks! Nick On 6/16/13 8:42 PM, Gabor Grothendieck wrote: On Sun, Jun 16, 2013 at 9:00 PM, Nick Matzke mat...@berkeley.edu wrote: Thanks *VERY* much, this is great! I realized a few more cases, I think I've got something that covers all the possibilities now: library(stringr

[R] simple Rcpp function produces: AddressSanitizer: attempting free on address which was not malloc

2013-07-08 Thread Nick Matzke
I have an R package, cladoRcpp, which is up on CRAN. After a minor update, which compiled without errors on R CMD check on my machine, I submitted the update. Brian Ripley got an error that I didn't get: == We still see

[R] easiest way to put italics words in sentences plotted with text()?

2013-08-09 Thread Nick Matzke
Hi, I am plotting some labels that consist of strings in which some words (but only some) should be in italics. E.g. M3: Homo, 5 areas, 2 areas max M4: Pan, 3 areas, 2 areas max I am putting these on the plot with the text() command. The words Homo and Pan should be italicized, since

[R] how to check if a library is loaded, from a function

2011-01-31 Thread Nick Matzke
Hi, I've written a function which I load with a source command. The function requires a certain library, phangorn, to work. I would like the function to check if phangorn is loaded as a library before running. For some reason, just putting require(phangorn) into the sourced function

[R] how to check if an attribute exists

2011-02-02 Thread Nick Matzke
I am dealing with an object that sometimes has a certain attribute, sometimes doesn't. How do I check for this? exists doesn't work... === z=c() z$a = c(c, d, f) z $a [1] c d f exists(z) [1] TRUE exists(z$a) [1] FALSE === ...basically, I want

Re: [R] how to check if an attribute exists

2011-02-02 Thread Nick Matzke
Oh wait, this basically does it: if (a %in% attributes(z)$names) + print(TRUE) [1] TRUE (but there may be a better way) Cheers! Nick On 2/2/11 7:20 PM, Nick Matzke wrote: I am dealing with an object that sometimes has a certain attribute, sometimes doesn't. How do I check for this? exists

Re: [R] if else in R

2013-11-19 Thread Nick Matzke
Hi, This would be an issue with if() as well as if/else. ab$b has 4 numbers in it, so ab$b 0 evaluates to TRUE TRUE FALSE TRUE or whatever. if() can only take a single true or false. Cheers! Nick On Tue, Nov 19, 2013 at 8:30 PM, Gary Dong pdxgary...@gmail.com wrote: Dear R users, I am a R

Re: [R] R CMD BATCH *without* saving output

2014-07-24 Thread Nick Matzke
On Thu, Jul 24, 2014 at 12:16 PM, Nick Matzke mat...@nimbios.org wrote: Hi all, Hi have a series of scripts that print a lot of notes etc. to screen. I have to run them on a massive set of input files. The scripts are self-contained and save the important output to data files

Re: [R] R CMD BATCH *without* saving output

2014-07-24 Thread Nick Matzke
, type=message) At the end of the script: # Turn off output sink sink() # Turn off message sink sink(type=message) # Close connection to black hole close(con) On Thu, Jul 24, 2014 at 12:27 PM, Nick Matzke mat...@berkeley.edu wrote: On Thu, Jul 24, 2014 at 12:16 PM, Nick Matzke mat

[R] R CMD BATCH *without* saving output

2014-07-24 Thread Nick Matzke
Hi all, Hi have a series of scripts that print a lot of notes etc. to screen. I have to run them on a massive set of input files. The scripts are self-contained and save the important output to data files in an organized way. I don't need the screen output for anything. Problems: - If I run

[R] run Rscript and ignore errors?

2015-04-23 Thread Nick Matzke
Hi R-help, I've looked at google, the Rscript documentation and the Rscript --help output and haven't found much on this. So, here's my question: I have a rather long script that runs on various input datasets. It is quite convenient to run the script from the Terminal command line with

[R] Run Rscript and ignore errors?

2015-04-23 Thread Nick Matzke
Hi R-help, I've looked at google, the Rscript documentation and the Rscript --help output and haven't found much on this. So, here's my question: I have a rather long script that runs on various input datasets. It is quite convenient to run the script from the Terminal command line with

Re: [R] Run Rscript and ignore errors?

2015-04-26 Thread Nick Matzke
. As originally mentioned, I'm lazy. I did find a super-easy solution, posted here: http://r.789695.n4.nabble.com/run-Rscript-and-ignore-errors-tc4706333.html#a4706395 Cheers! Nick On Thu, Apr 23, 2015 at 12:28 PM, Nick Matzke mat...@nimbios.org wrote: Hi R-help, I've looked at google

Re: [R] run Rscript and ignore errors?

2015-04-24 Thread Nick Matzke
O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. On April 23, 2015 9:51:31 AM PDT, Nick Matzke