Re: [R] output from R to simple html

2020-07-08 Thread Michael Hannon
I can't tell what kind of structure you want to output, but one simple thing that I've done along these lines is to use knitr::kable to output a dataframe in either HTML or LaTeX format (for direct inclusion on a web page or to convert to PDF for other uses). -- Mike On Wed, Jul 8, 2020 at 12:02

Re: [R] Using OpenBLAS on Ubuntu

2020-06-28 Thread Michael Hannon
Or maybe R-devel. On Sun, Jun 28, 2020 at 8:51 PM Jeff Newmiller wrote: > > Wouldn't this question make more sense in r-sig-debian? > > On June 28, 2020 7:54:49 PM PDT, Erin Hodgess wrote: > >Hello! > > > >Hope everyone is doing well. > > > >I'm not sure if this is the correct place to post,

Re: [R] Creating map in R

2019-11-22 Thread Michael Hannon
Yep, I had that same thought after I posted a reply to the OP. Not to discourage anybody from reading the posting guide, but a quick look at it suggests that the following might be useful in this case: https://stat.ethz.ch/mailman/listinfo/r-sig-geo On Thu, Nov 21, 2019 at 9:48 PM Jeff

Re: [R] Read shp file

2019-11-21 Thread Michael Hannon
I can't help you locate the .shx file, but the gist of it is that a "shapefile" actually requires a minimum of three files: https://knowledge.autodesk.com/support/autocad-map-3d/learn-explore/caas/sfdcarticles/sfdcarticles/Required-files-that-make-up-a-shapefile.html The .shx file is an index of

Re: [R] Unable to update R 3.4 to R 3.5 in Ubuntu 18.04 LTS

2018-09-17 Thread Michael Hannon
I didn't find an attached file, but I'm using Ubuntu 18.04 and have upgraded R to version 3.5. I don't recall exactly how I did the upgrade, but it must have been something like: https://www.digitalocean.com/community/tutorials/how-to-install-r-on-ubuntu-18-04-quickstart -- Mike $ cat

Re: [R] Making objects global in a package

2018-07-16 Thread Michael Hannon
ions: >>> R-package-devel. >>> >>> b) This seems like a job for the sysdata.rda file... no explicit >>> environments needed. See the Writing R Extensions manual. >>> >>> On July 13, 2018 5:51:06 PM PDT, Michael Hannon < >>> jmhannon.ucda

[R] Making objects global in a package

2018-07-13 Thread Michael Hannon
Greetings. I'm putting together a small package in which I use `dplyr::read_csv()` to read CSV files from several different sources. I do this in several different files, but with various kinds of subsequent processing, depending on the file. I find it useful to specify column types, as the

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
t;rainer_k...@icloud.com> wrote: > >> >> >> > On 19 Feb 2018, at 12:25, Duncan Murdoch <murdoch.dun...@gmail.com >> <mailto:murdoch.dun...@gmail.com>> wrote: >> > >> > On 19/02/2018 5:47 AM, Michael Hannon wrote: >> >> Thanks, Duncan.

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
och <murdoch.dun...@gmail.com> wrote: > On 18/02/2018 9:06 PM, Michael Hannon wrote: >> >> Greetings. The group that I work with has just started using the approach >> outlined in Karl Broman's handy primer: >> >> http://kbroman.org/pkg_primer/pages/vignettes.html &

Re: [R] Include pre-existing PDF files as vignettes in an R package?

2018-02-19 Thread Michael Hannon
Extensions" manual? If so, what about the instructions provided there > do you find lacking? > > Best, > Ista > > On Sun, Feb 18, 2018 at 9:06 PM, Michael Hannon > <jmhannon.ucda...@gmail.com> wrote: >> Greetings. The group that I work with has just started

[R] Include pre-existing PDF files as vignettes in an R package?

2018-02-18 Thread Michael Hannon
Greetings. The group that I work with has just started using the approach outlined in Karl Broman's handy primer: http://kbroman.org/pkg_primer/pages/vignettes.html to create vignettes for a couple of R packages. This works fine as long as we have a current Rmd version of the vignette.

Re: [R] Remove

2017-12-08 Thread Michael Hannon
library(dplyr) DM <- read.table( text='GR x y A 25 125 A 23 135 . . . ) DM %>% filter((GR == "A" & (x >= 15) & (x <= 30)) | (GR == "B" & (x >= 40) & (x <= 50)) | (GR == "C" & (x >= 60) & (x <= 75))) On Fri, Dec 8, 2017 at 4:48 PM, Ashta

Re: [R] cannot allocate vector of size n

2017-12-05 Thread Michael Hannon
(1) That's an old version of R Studio, although I doubt that that's the source of your problem. (2) What is your session info? > sessionInfo() or > devtools::session_info() I just allocated a numeric vector of size 2.5e9 on a 16GB linux box (R 3.4.3). It worked, but it pretty much

Re: [R] Is there a tool to find unused functions?

2017-11-15 Thread Michael Hannon
mvbutils::foodweb produces a graphical display of the hierarchy (or network or ...) of function calls. Isolated functions are not called. This might help you. -- Mike On Wed, Nov 15, 2017 at 12:44 AM, Alexander Engelhardt wrote: > I've inherited a large R codebase

Re: [R] Example of the use of the "crt" graphical parameter?

2017-05-01 Thread Michael Hannon
want a working > function, it wouldn't be too hard to program. > > Jim > > > On Tue, May 2, 2017 at 6:57 AM, Michael Hannon > <jmhannon.ucda...@gmail.com> wrote: >> Hi, folks. This is an issue that we've defined away, but I recently >> thought it would be useful to

Re: [R] [FORGED] Re: Example of the use of the "crt" graphical parameter?

2017-05-01 Thread Michael Hannon
(for margin text) > only listens to las, so can only do horizontal or vertical. > > Paul > > > On 02/05/17 09:47, Michael Hannon wrote: >> >> Thanks, Bert. I *did* mean crt, and I did read (and re-read) the man >> page. What I'm lacking, and the only thing

Re: [R] Example of the use of the "crt" graphical parameter?

2017-05-01 Thread Michael Hannon
> > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, May 1, 2017 at 1:57 PM, Michael Hannon > <jmhannon.ucda...@gmail.com> wrot

[R] Example of the use of the "crt" graphical parameter?

2017-05-01 Thread Michael Hannon
Hi, folks. This is an issue that we've defined away, but I recently thought it would be useful to rotate characters in some marginal text in a base-R plot. I made a few stabs on using the "crt" parameter but was unsuccessful. I'm deliberately omitting details of my attempts, as I want just to

Re: [R] Counting enumerated items in each element of a character vector

2017-04-25 Thread Michael Hannon
s a regular expression by default. > > Best, > Ista > > On Tue, Apr 25, 2017 at 11:40 PM, Michael Hannon > <jmhannon.ucda...@gmail.com> wrote: >> I like Boris's "Hadley" solution. For the record, I've appended a >> version that uses regular expressions, the o

Re: [R] Counting enumerated items in each element of a character vector

2017-04-25 Thread Michael Hannon
I like Boris's "Hadley" solution. For the record, I've appended a version that uses regular expressions, the only benefit of which is that it could be generalized to find more-complicated patterns. -- Mike counts <- sapply(text1, function(next_string) { loc_example <-

Re: [R] Interesting quirk with fractions and rounding

2017-04-20 Thread Michael Hannon
I might add that things that *look* like integers in R are not really integers, unless you explicitly label them as such: > str(20) num 20 > str(20.5) num 20.5 > str(20L) int 20 > I think that Python 2 will do integer arithmetic on things that look like integers: $ python2 . . . >>> 30 /

Re: [R] Help with lapply and tapply

2017-03-11 Thread Michael Hannon
I think Bert's advice is sound. Let me add a few, miscellaneous comments: (1) Some people find "by" easier than "tapply". (2) The "apply" function can, as I'm sure you (Bert) know, iterate over a matrix. (3) Hadley probably has better ways to do all of this (it's hard to keep up). -- Mike On

Re: [R] Extracting first number after * in a character vector

2017-01-23 Thread Michael Hannon
Elegant I don't know, but I think the appended does the trick. -- Mike > foo <- c(" 1 X[0,SMITH] * 0 0 1 ", + " 2 X[0,JOHNSON] * 0 0 1 ", + " 3 X[0,WILLIAMS] * 1 0 1 ",

Re: [R] Need advice on linear programming in R

2016-09-01 Thread Michael Hannon
ge.r-project.org/examples/lp.html> > > Best, > Florian > > Gesendet: Donnerstag, 01. September 2016 um 05:34 Uhr > Von: "Michael Hannon" <jmhannon.ucda...@gmail.com> > An: "R help" <r-help@r-project.org> > Betreff: [R] Need advice on linear program

Re: [R] Need advice on linear programming in R

2016-09-01 Thread Michael Hannon
Thanks, Peter. Not useless at all, but I'm somewhat overwhelmed by the choices. I'll have a closer look at some of them. -- Mike On Thu, Sep 1, 2016 at 1:24 AM, peter dalgaard <pda...@gmail.com> wrote: > >> On 01 Sep 2016, at 05:34 , Michael Hannon <jmhannon.ucda..

[R] Need advice on linear programming in R

2016-08-31 Thread Michael Hannon
Greetings. A subset of a problem that the group I work with turns out to be an optimization problem, in the sense of linear programming. We've looked at several approaches to this but haven't found one that seems to be the right fit. I'm looking for some guidance in finding an R package that

Re: [R] Matrix

2016-07-16 Thread Michael Hannon
I'm not sure what the OP is looking for in the first two columns, but he does seem to be looking for only the diagonal and super-diagonal elements. Here's some code that makes output that looks similar to the "Desired output": mat1 <- matrix(rbind(c(3, 4, 5), c(4, 7, 8),

Re: [R] create one bigger matrix with one smaller matrix

2015-12-31 Thread Michael Hannon
Something like: A <- matrix(c(1,2,3,4),2,2) A B <- matrix(rep(A, 4), nrow=2) B C <- do.call(rbind, lapply(1:8, function(x) B)) C On Thu, Dec 31, 2015 at 12:28 PM, Kathryn Lord wrote: > Dear R users, > > Suppose that I have a matrix A > > A <-

Re: [R] creating a list based on various mean values

2015-10-23 Thread Michael Hannon
Does the following not do what you want? k1 <- c(0.005, 0.200, 0.300, 0.400, 0.500, 0.600, 0.700, 0.800, 0.900, 1.000, 1.100, 1.200, 1.300, 1.400, 1.500, 1.600, 1.700, 1.800, 1.900, 2.000, 5.000, 10.000) k1 xr <- lapply(k1, rnorm, n=20) xr On Fri, Oct 23, 2015 at 1:51 AM, Erin

Re: [R] how to do away for loop using functionals?

2015-10-14 Thread Michael Hannon
I've done a simple-minded transliteration of your code into code using nested lapply's. I doubt that it buys you much in terms of performance (or even clarity, which is really one of the main advantages of the `apply` family). > A [,1] [,2] [,3] [,4] [,5] [1,] 3.06097

Re: [R] how to do away for loop using functionals?

2015-10-13 Thread Michael Hannon
The answer to "another note" is: mapply(rep, w, 5:1) I'll try to look at the first part in more detail later today. -- Mike On Mon, Oct 12, 2015 at 5:55 PM, Annie Hawk via R-help wrote: > HI R-experts, > > > I am trying to speed up my calculation of the A results below

Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Michael Hannon
need to cross compile R package for my embedded box or i > can directly install the debian MIPS version of R package. But there is no > apt-get or other installer in the embedded box. > > > Regards > Sasi > > On Wed, Oct 7, 2015 at 1:46 AM, Michael Hannon <jmhannon.uc

Re: [R] Installing pre-compiled R in Linux

2015-10-07 Thread Michael Hannon
mbedded systems such as routers and > switches, do we need to install the complete R package in the system also? > Or just libR.so and Rscript should be ok? > > Thanks again Mike. > > Regards > Sasi > > On Tue, Oct 6, 2015 at 5:57 PM, Michael Hannon <jmhannon.ucda...@g

Re: [R] Installing pre-compiled R in Linux

2015-10-06 Thread Michael Hannon
It's very likely that there is already an R package for your linux system, and, if so, you'd probably be well-served to use that one. You've given us the version of the kernel you're using (not a recent one, BTW), but what linux distribution are you using? -- Mike On Tue, Oct 6, 2015 at 3:59

Re: [R] cbind question, please

2015-04-24 Thread Michael Hannon
Is this what you're looking for? dog - 1:3 bat - 2:4 tree - 5:7 big.char - c(dog,bat,tree) do.call(cbind,lapply(big.char, get)) [,1] [,2] [,3] [1,]125 [2,]236 [3,]347 On Thu, Apr 23, 2015 at 3:41 PM, Erin Hodgess erinm.hodg...@gmail.com wrote:

Re: [R] Combine list element by column name to make a dataframe

2015-04-06 Thread Michael Hannon
Maybe something like the appended? -- Mike lst - list(setNames(c(1,10,50,60,70,80), c(id,id1,math,phy,che,bio)), setNames(c(2,20,45), c(id,id1,phy)), setNames(c(3,30,75), c(id,id1,bio))) lst df -

[R] Dealing with NA in tbl_df?

2015-03-21 Thread Michael Hannon
Greetings. I was reading through the vignette for tidy-data (from the tidyr package) and came across something that puzzled me. One of the examples in the vignette uses a data set related to tuberculosis, originally from the World Health Organization, but also available at:

Re: [R] issue on installation of RCurl on Debian Wheezy

2014-12-23 Thread Michael Hannon
I think you need to have curl-config installed. I had a similar problem on Ubuntu and found the program in various packages:. $ apt-file search curl-config | grep bin libcurl4-gnutls-dev: /usr/bin/curl-config libcurl4-nss-dev: /usr/bin/curl-config libcurl4-openssl-dev:

Re: [R] Using OpenBLAS with R

2014-11-17 Thread Michael Hannon
Useful and interesting. Thanks for your prompt reply. -- Mike On Sun, Nov 16, 2014 at 2:29 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On 16/11/2014 00:11, Michael Hannon wrote: Greetings. I'd like to get some advice about using OpenBLAS with R, rather than using the BLAS

[R] Using OpenBLAS with R

2014-11-15 Thread Michael Hannon
Greetings. I'd like to get some advice about using OpenBLAS with R, rather than using the BLAS that comes built in to R. I've tried this on my Fedora 20 system (see the appended for details). I ran a simple test -- multiplying two large matrices -- and the results were very impressive, i.e., in

[R] Hadley's book: paper/PDF/etc. versus github

2014-10-03 Thread Michael Hannon
Hi, folks. I've got a sort of coupon that would allow me to get a copy of Advanced R by Hadley Wickham at no cost. OTOH, I've already cloned the github repository, and having the live Rmd files (or in this case, rmd files) is enormously more useful to me than having any form of electronic or

Re: [R] ubuntu 14.04

2014-09-24 Thread Michael Hannon
As others have noted, it does run. You might want to have a look at: http://cran.r-project.org/bin/linux/ubuntu/README Following the instructions there will allow you to get (automatically) an up-to-date version of R. -- Mike On Wed, Sep 24, 2014 at 11:58 AM, carol white

Re: [R] a knitr question

2014-07-30 Thread Michael Hannon
That's what I thought. Also, just FYI, the ed editor on *nix systems doesn't have a prompt (at least not by default). My son thought I was trolling him when I told him that. -- Mike On Wed, Jul 30, 2014 at 5:06 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: On Thu, Jul 31, 2014 at 9:47 AM,

Re: [R] Installing RCurl: 'configure' exists but is not executable

2013-11-02 Thread Michael Hannon
` -rwxr-xr-x 1 root root 6327 Oct 20 15:25 /usr/bin/curl-config On Friday 01 November 2013 20:21:36 Michael Hannon wrote: The error message doesn't seem to refer to the tmp directory. What do you get from: ls -l `which curl-config` -- Mike On Fri, Nov 1, 2013 at 7:43 PM, Rainer

Re: [R] Installing RCurl: 'configure' exists but is not executable

2013-11-01 Thread Michael Hannon
The error message doesn't seem to refer to the tmp directory. What do you get from: ls -l `which curl-config` -- Mike On Fri, Nov 1, 2013 at 7:43 PM, Rainer Schuermann rainer.schuerm...@gmx.net wrote: I'm trying to install.packages( RCurl ) as root but get ERROR: 'configure' exists

Re: [R] How to extract last value in each group

2013-08-14 Thread Michael Hannon
Or how about rle/cumsum, as per the appended? -- Mike myData - read.table(junk.dat, header=TRUE, stringsAsFactors=FALSE) myData Date Time O H L C U D 1 06/01/2010 1358 136.40 136.40 136.35 136.35 2 12 2 06/01/2010 1359 136.40 136.50 136.35 136.50 9 6 3 06/01/2010 1400 136.45 136.55 136.35

[R] sample(c(0, 1)...) vs. rbinom

2013-05-22 Thread Michael Hannon
Greetings.  My wife is teaching an introductory stat class at UC Davis.  The class emphasizes the use of simulations, rather than mathematics, to get insight into statistics, and R is the mandated tool.   A student in the class recently inquired about different approaches to sampling from a

Re: [R] How to turn a LaTeX Sweave file (Rnw) into .HTML/.odf/.docx? (under windows)

2011-09-22 Thread Michael Hannon
I have found several references on how to do this, my question is if anyone is actually using them - and if there are some strong points on what to use, and how well it is working out. My goal is to be able to easily create docs from R, but to be able to share it with other researchers (who

[R] Simple example of using a closure in R to manage bank accounts?

2011-07-25 Thread Michael Hannon
Greetings. I once ran across a simple (toy) example of using a closure in R to manage bank accounts. I've got a use for it now but can no longer find it. If you have it (or a similar example), will you please send it to me? (Unfortunately, a web search that includes the terms bank and

Re: [R] Simple example of using a closure in R to manage bank accounts?

2011-07-25 Thread Michael Hannon
Hi, Leo. Yes, that's exactly the idea. Thanks, -- Mike From: Leo Guelman leo.guel...@gmail.com To: Michael Hannon jm_han...@yahoo.com Cc: R Help r-help@r-project.org Sent: Mon, July 25, 2011 3:16:13 PM Subject: Re: [R] Simple example of using a closure in R to manage bank accounts

Re: [R] Simple example of using a closure in R to manage bank accounts?

2011-07-25 Thread Michael Hannon
Yes, I think that's the same example that I saw previously. Thanks, Gabor. -- Mike - Original Message From: Gabor Grothendieck ggrothendi...@gmail.com To: Michael Hannon jm_han...@yahoo.com Cc: R Help r-help@r-project.org Sent: Mon, July 25, 2011 3:40:58 PM Subject: Re: [R

Re: [R] Help me pls

2010-09-23 Thread Michael Hannon
From: Seyit Ali KAYIS ska...@selcuk.edu.tr To: r-help@r-project.org Sent: Thu, September 23, 2010 12:12:49 AM Subject: [R] Help me pls Dear All, I need to create eps file which is the required figure format of the journal that I want to submit a paper. I am able to create files in

Re: [R] Fwd: R install in Fedora

2010-09-16 Thread Michael Hannon
Actually I tried in both ways : yum install R and sudo yum install R , but the error is same. I have root privilege, means I used the command su - and enter the password. May be its problem from Fedora. Thanks for your valuable help. I will post this issue in R-SIG-Fedora list. Kind

Re: [R] Regex exercise

2010-08-20 Thread Michael Hannon
For regular expression afficianados, I'd like a cleverer solution to the following problem (my solution works just fine for my needs; I'm just trying to improve my regex skills): Given the string (entered, say, at a readline prompt): 1 2 -5, 3- 6 4 8 5-7 10 ## only integers will be

Re: [R] Regex exercise

2010-08-20 Thread Michael Hannon
You are essentially doing the eval and parsing by hand instead of letting eval(parse()) do the work. I prefer the latter. Hi, Bert. Yes, I agree with both your analysis and your preference. However, your code did something that I did not expect and for which I can find no documentation -- I

Re: [R] Spliting a text

2010-08-04 Thread Michael Hannon
- Original Message From: Megh Dal megh700...@yahoo.com To: r-h...@stat.math.ethz.ch Sent: Wed, August 4, 2010 4:04:06 AM Subject: [R] Spliting a text Hi, I want to split a text to seperate numerical and non-numerical portions of that. For example suppose I have a text abc

Re: [R] sort file names in numerical order

2010-07-17 Thread Michael Hannon
I get some file names by list.files(). These names are in alphabetical order. I want to change it to logical numeric order. Example: fileNames - c(A10, A1, A2, B1, B2, B10) sort(fileNames) [1] A1 A10 A2 B1 B10 B2 I want to have: A1 A2 A10 B1 B2 B10 Is this possible?

Re: [R] Help installing R commander in Fedora 13...

2010-07-01 Thread Michael Hannon
From: Carlo Tambuatco oraclmas...@gmail.com To: r-help@r-project.org Sent: Wed, June 30, 2010 12:18:54 PM Subject: [R] Help installing R commander in Fedora 13... I did a standard install of R on Fedora 13 using yum as root, which I assumed installed both the base packages and the

[R] How to choose seed in set.seed(seed, ...)?

2010-02-03 Thread Michael Hannon
Greetings. I understand that to generate distinct sequences of random numbers in R one can initialize the calculation of each sequence by calling the set.seed() function with a distinct value for seed the (integer) first argument to the function. I'd like to know if there are any guidelines or

[R] Infinite != NaN?

2009-08-29 Thread Michael Hannon
Greetings. I somehow had the impression that an infinite number, as obtained by dividing by zero, for instance, would be flagged as both missing (NA) and not a number (NaN). It appears that I was wrong on both counts, although the is.finite function correctly returns FALSE in such a case.

[R] S data sets in R?

2009-05-19 Thread Michael Hannon
Greetings. I'm trying to learn to program in R. (I'm definitely NOT new to programming, just to R.) A colleague suggested that I have a look at the book: An Introduction to S and S-Plus by: Phil Spector I've glanced at the book, and it does indeed seem to be the kind of thing I