Re: [R] passing a modified argument to an S3 method

2024-04-20 Thread Berry, Charles via R-help
> On Apr 19, 2024, at 1:36 PM, CRAN.r via R-help wrote: > > Is there a way to pass a modified argument from an S3 generic to a method? > Here's a non-working example that I want to return "abcd". > grep-ing the source code is often a good way to answer a question like this. Particularly, w

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
Hi, Just find a scaling factor that would make the two sets of data comparable. Here I divided the second row by 5 and did the same for the second axis. Charles-Édouard F1 <- as.table(matrix(c(50,11,6,17,16,3,1,2237,611,403,240,280,0,0), 2,7)) barplot(F1, beside = TRUE, col = c("blue

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
2)) axis(4, at = c(0, 5, 10), labels = c(0,50,100)) -Message d'origine- De : sibylle.stoec...@gmx.ch Envoyé : 24 novembre 2023 09:27 À : 'Charles-Édouard Giguère' ; r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis Dear Charles-Edouard Thanks a lot. So no

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
You could also use more simply facet_wrap(~ Studien_Flaeche). Charles-Édouard -Message d'origine- De : Charles-Édouard Giguère Envoyé : 24 novembre 2023 09:11 À : sibylle.stoec...@gmx.ch; r-help@r-project.org Objet : RE: [R] ggplot adjust two y-axis Hi Sibylle, For that kind of

Re: [R] ggplot adjust two y-axis

2023-11-24 Thread Charles-Édouard Giguère
Hi Sibylle, For that kind of data with two different scales, I generally use two graphs that I name gg1 and gg2 and join them using gridExtra::grid.arrange(gg1, gg2). This way, the red part of your graph is easier to interpret. Have a nice day, Charles-Édouard -Message d'origine---

[R] fortune nomination WAS: Re: How long does it take to learn the R programming language?

2022-09-28 Thread Berry, Charles
Aha! CCB > On Sep 27, 2022, at 6:08 PM, Rolf Turner wrote: > > > On Mon, 26 Sep 2022 11:14:57 +0800 > Turritopsis Dohrnii Teo En Ming wrote: > >> Subject: How long does it take to learn the R programming language? >> >> Good day from Singapore, >> >> How long does it take to learn the R pro

Re: [R] Cacheing of functions from libraries other than the base in Rmarkdown

2021-09-19 Thread Berry, Charles
Chris, > On Sep 18, 2021, at 12:26 PM, Chris Evans wrote: > > This question may belong somewhere else, if so, please signpost me and accept > apologies. > > What is happening is that I have a large (for me, > 3k lines) Rmarkdown file > with many R code blocks (no other code or > engine is u

Re: [R] concatenating columns in data.frame

2021-07-01 Thread Berry, Charles
> On Jul 1, 2021, at 11:24 AM, Bert Gunter wrote: > > Why not simply: > > ## reprex > set.seed(123) > df = data.frame("A"=sample(letters, 10), "B"=sample(letters, 10), >"C"=sample(letters,10), "D"=sample(letters, 10)) > df > use_columns = c("D", "B") > > ## one liner > df$com

Re: [R] concatenating columns in data.frame

2021-07-01 Thread Berry, Charles
> On Jul 1, 2021, at 7:36 AM, Micha Silver wrote: > > I need to create a new data.frame column as a concatenation of existing > character columns. But the number and name of the columns to concatenate > needs to be passed in dynamically. The code below does what I want, but seems > very clu

Re: [R] if statement and for loop question

2021-05-30 Thread Berry, Charles
Kai, You have made a simple mistake. And now you cannot see it. I believe this is not uncommon among programmers. It has happened to me more times than I want to recall. > On May 30, 2021, at 9:28 AM, Kai Yang via R-help wrote: > > Hello List,I have a data frame which having the character c

Re: [R] dependent nested for loops in R

2021-01-31 Thread Berry, Charles
> On Jan 30, 2021, at 9:32 PM, Shaami wrote: > > Hi > I have made the sample code again. Could you please guide how to use > vectorization for variables whose next value depends on the previous one? > Glad to help. First, it could help you to trace your code. I suspect that the results ar

Re: [R] Inappropriate color name

2020-11-20 Thread Charles Novaes de Santana
e institute, with a board of > literary, sociology, psychology professors? > > Afaik is github owned by Microsoft, and Microsoft is known to be an > offender of peoples rights. Who the @#$@#$ cares what they do? > > > -- Um axé! :) -- Charles Novaes de Santana, PhD https://github.co

Re: [R] [EXT] Re: Inappropriate color name

2020-11-20 Thread Charles Novaes de Santana
branch of a repository for example. I wonder what would happen if there was a color named "redneck" instead of "indianred". Charles On Fri, 20 Nov 2020 at 10:37, Marc Roos wrote: > > >name since it conveys the wrong indication of its purpose. But the > >w

Re: [R] Intended use-case for data.matrix

2020-11-04 Thread Philip Charles
in a package, you could still test against R-devel, but why make your life more difficult by *not* putting it in a package?) Duncan Murdoch On 04/11/2020 6:48 a.m., Philip Charles wrote: > Hi R gurus, > > We do a lot of work with biological -omics datasets (genomics, proteomics >

[R] Intended use-case for data.matrix

2020-11-04 Thread Philip Charles
logies if this has been asked before. I'm also pretty sure my misunderstanding is with the intended use-case of data.matrix and R ethos around strings/factors rather than the rationale for the change, which is why I'm asking here. Best wishes, Phil Philip Charles Target Discovery Institu

[R] Packages Not Available for R version 4.0.3

2020-10-23 Thread Charles Thuo
th Regards, Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html a

[R] Fitting Mixed Distributions in the fitdistrplus package

2020-10-21 Thread Charles Thuo
Dear Sirs, The below listed code fits a gamma and a pareto distribution to a data set danishuni. However the distributions are not appropriate to fit both tails of the data set hence a mixed distribution is required which has ben defined as "mixgampar" as shown below. library(fitdistrplus) x<-

Re: [R] text on curve

2020-09-22 Thread Berry, Charles
> On Sep 22, 2020, at 1:10 AM, Jinsong Zhao wrote: > > Hi there, > > I write a simple function that could place text along a curve. Since I am not > familiar with the operation of rotating graphical elements, e.g., text, > rectangle, etc., I hope you could give suggestions or hints on how t

Re: [R] Nonlinear logistic regression fitting

2020-07-28 Thread Berry, Charles
Did you try searching for "Michaelis" on rseek.org? It seems like there are many hits that might be pertinent to your query. If none is pertinent, maybe saying why they are not sufficient will help others see how their "expert opinions" can help you. HTH, Chuck > On Jul 28, 2020, at 8:19 AM

[R] how to add a calculated column into a data frame

2020-06-04 Thread Charles Thuo
Dear Sirs, I have a data frame that has a column that shows the transaction date. How do i add another column that extracts the year of transaction from the transaction date. Charles [[alternative HTML version deleted]] __ R-help@r

Re: [R] consecutive n values

2020-06-04 Thread Berry, Charles
Catalin, > On Jun 4, 2020, at 6:06 AM, Catalin Roibu wrote: > > Dear R users, > > Please help me to detect consecutive n values in R and their interval. > > > rle.seq1<-rle(reco$extr) > cbind(rle.seq1$values) > index<-any(rle.seq1$values=="DRY"&rle.seq1$lengths>=3) > cumsum(rle.seq1$lengths)[

[R] Question about combining foodwebs and phylogenetic trees

2020-05-05 Thread Charles Lehnen
I have trying to combine foodweb outputs like the bipartite package's plotweb() function of bipartiteD3’s bipartite_D3 function with phylogenetic trees, similar to a tanglegram. Because of the very large size and a high amount of variability in my dataset, standard tanglegrams turn out very convolu

Re: [R] How to read a file containing two types of rows - (for the Netflix challenge data format)

2020-01-31 Thread Berry, Charles
> On Jan 31, 2020, at 1:04 AM, Emmanuel Levy wrote: > > Hi, > > I'd like to use the Netflix challenge data and just can't figure out how to > efficiently "scan" the files. > https://www.kaggle.com/netflix-inc/netflix-prize-data > > The files have two types of row, either an *ID* e.g., "1:" ,

Re: [R] Identifying presence of Java

2019-11-09 Thread Berry, Charles
> On Nov 9, 2019, at 8:51 AM, Dennis Fisher wrote: > > R 3.6.3 > OSX and Windows > > Colleagues > > I want to identify if Java is installed on a particular computer. > [...] > I execute something like: > CAPTURE <- system("Java -version", intern=TRUE, ignore.stderr=FALSE, > ignore.

Re: [R] Creating a histogram from a frequency vector

2019-10-10 Thread Berry, Charles
> On Oct 9, 2019, at 9:58 AM, Rui Barradas wrote: > > Hello, > > Here are 3 ways. > For a large number of bars, sometimes this: plot( y, type='h') # maybe use lwd=5 Chuck > The first are almost the same, they use base graphics. > > x <- 1:6 > y <- c(73,53,42,67,41,50) > > barplot(setN

Re: [R] Efficient way to update a survival model

2019-08-31 Thread Berry, Charles
The i^th model is included in the Cox[[ i ]] object. You can extract the formula objects with: frms <- lapply(Cox, formula) then if you want the existing and incremental terms: indeps <- lapply(frms, function(x) as.list( x[[ 3 ]] )) oldTerms <- lapply(indeps, "[[", 2) newTerms <- lapply(indep

Re: [R] Open a file which name contains a tilde

2019-06-07 Thread Berry, Charles
> On Jun 6, 2019, at 2:04 PM, Richard O'Keefe wrote: > > How can expanding tildes anywhere but the beginning of a file name NOT be > considered a bug? > > I think that that IS what libreadline is doing if one allows a whitespace separated list of file names. As reported in R-help,

Re: [R] Open a file which name contains a tilde

2019-06-06 Thread Berry, Charles
> On Jun 6, 2019, at 3:59 AM, Ivan Krylov wrote: > > On Wed, 5 Jun 2019 18:07:15 +0200 > Frank Schwidom wrote: > >> +> path.expand("a ~ b") >> [1] "a /home/user b" > >> How can I switch off any file crippling activity? > > It doesn't seem to be possible if readline is enabled and works >

Re: [R] Tying to underdressed the magic of lm redux

2019-06-01 Thread Berry, Charles
John, I believe the pieces you are missing are filed under 'computing on the language', 'passing unevaluated objects', and 'language objects'. Forgive me if I belabor things you already know. lm, transform, and many other functions do their "magic" by operating on language objects. You migh

Re: [R] lm fails on some large input

2019-04-18 Thread Berry, Charles
> On Apr 18, 2019, at 8:24 AM, Michael Dewey wrote: > > Perhaps subtract 1506705766 from y? Good advice. Some further notes follow. One can specify `tol` to have a smaller than default value e.g. m2 <- lm(x ~ y, tol=1e-12) which is accurate: plot(y,x) abline(coef=coef(m2)) Users

Re: [R] Alternative to lops

2019-04-04 Thread Berry, Charles
Comments inline, but first: Please review the posting guide and follow the instructions there, especially: 1) "No HTML posting..." 2) "When providing examples, it is best to give an R command that constructs the data,..." > On Apr 4, 2019, at 9:41 AM, Ek Esawi wrote: > > Hi All-- > > Sorry

Re: [R] Vectorizing a for-loop for cross-validation in R

2019-01-23 Thread Berry, Charles
See inline. > On Jan 23, 2019, at 2:17 AM, Aleksandre Gavashelishvili > wrote: > > I'm trying to speed up a script that otherwise takes days to handle larger > data sets. So, is there a way to completely vectorize or paralellize the > following script: > >*# k-fold cross valida

Re: [R] Accessing Data Frame

2019-01-03 Thread Berry, Charles
See below. > On Jan 3, 2019, at 6:50 AM, Benoit Galarneau > wrote: > > Hi everyone, > I'm new to the R world. > Probably a newbie question but I am stuck with some concept with data frame. > I am following some examples in the "Hands-On Programming with R". > > In short, how can I access/filte

[R] fortune nomination WAS:Re: help

2018-12-13 Thread Berry, Charles
"You need Santa Claus not r-help." in response to an unrealistic and poorly posed request for help. Best, Chuck > On Dec 13, 2018, at 11:12 AM, David L Carlson wrote: > > You need Santa Claus not r-help. You haven't given us a fraction of the > information we would need to help. You don't

[R] YAML for bookdown

2018-09-12 Thread Charles Geyer
. -- Charles Geyer Professor, School of Statistics Resident Fellow, Minnesota Center for Philosophy of Science University of Minnesota char...@stat.umn.edu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] For loop with multiple iteration indexes

2018-09-10 Thread Berry, Charles
I have a sense of deja vu: https://www.mail-archive.com/r-help@r-project.org/msg250494.html There is some good advice there. > On Sep 9, 2018, at 3:49 PM, David Disabato wrote: > > Hi R-help, > > I am trying to create a for loop with multiple iteration indexes. I don't > want to use two diffe

[R] FPMC?

2018-08-14 Thread Charles Determan
, Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] A slightly unorthodox matrix product.

2018-08-04 Thread Berry, Charles
> On Aug 4, 2018, at 12:59 PM, Jeff Newmiller wrote: > ... > Slick work on the vectorizing, but for the future reference it was slightly > buggy: > Thanks for catching that! Chuck __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] A slightly unorthodox matrix product.

2018-08-04 Thread Berry, Charles
> On Aug 4, 2018, at 11:43 AM, Jeff Newmiller wrote: > > Sometimes a good old for loop performs best, even if it doesn't look sexy: > > Fair enough, but a vectorized solution beats them all (see below). Also, [SNIP] > # Charles > ans1b <- function( a, b )

Re: [R] A slightly unorthodox matrix product.

2018-08-04 Thread Berry, Charles
> On Aug 4, 2018, at 10:01 AM, Eric Berger wrote: > > Hi Rolf, > A few edits because (i) nrow(a) should be nrow(A) and (ii) you have > calculated C[j,k,i] = A[i,j]*B[i,k], (iii) minor style change on lapply. > > library(abind) > xxx <- lapply(1:nrow(A),function(i){A[i,]%o%B[i,]}) > yyy <- do.

Re: [R] Suggestions for scatter plot of many data

2018-07-19 Thread Berry, Charles
> On Jul 18, 2018, at 1:55 PM, Rich Shepard wrote: > > I have daily precipitation data for 58 locations from 2005-01-01 through > 2018-06-18. So roughly 5000 observations of latitiude, longitude, elevation(?), and amount. Maybe something dynamic like Hans Rosling does: https://towardsdatas

Re: [R] Generate random Bernoulli draws

2018-07-06 Thread Berry, Charles
On Jul 6, 2018, at 4:27 PM, Charles Berry wrote: > >> On Jul 6, 2018, at 3:31 PM, Duncan Murdoch wrote: >> >> On 06/07/2018 1:18 PM, Berry, Charles wrote: >>> A liitle math goes along way. See below. >>>> On Jul 5, 2018, at 10:35 PM, Marino David wrote:

Re: [R] Generate random Bernoulli draws

2018-07-06 Thread Berry, Charles
> On Jul 6, 2018, at 3:31 PM, Duncan Murdoch wrote: > > On 06/07/2018 1:18 PM, Berry, Charles wrote: >> A liitle math goes along way. See below. >>> On Jul 5, 2018, at 10:35 PM, Marino David wrote: >>> >>> Dear Bert, >>> >>> I kno

Re: [R] Generate random Bernoulli draws

2018-07-06 Thread Berry, Charles
A liitle math goes along way. See below. > On Jul 5, 2018, at 10:35 PM, Marino David wrote: > > Dear Bert, > > I know it is a simple question. But for me, at current, I fail to implement > it. So, I ask for help here. > > It is not homework. > > Best, > > David > > 2018-07-06 13:32 GMT+08:0

Re: [R] R maintains old values

2018-07-03 Thread Berry, Charles
> On Jul 3, 2018, at 6:25 AM, J C Nash wrote: > > Now, to add to the controversy, how do you set a computer on fire? >From the bash prompt: stuxnet --overload=cpu,disk,network,gpu --fan=off --no-warnings HTH, Chuck __ R-help@r-project.org maili

Re: [R] subsetting lists....

2018-06-18 Thread Berry, Charles
> On Jun 18, 2018, at 4:15 AM, akshay kulkarni wrote: > > correctionI want the method without a for loop Here are two. The first is more readable, but the second is 5 times faster. mapply("[", YH, iuhV) unlist(YH, recursive = FALSE, use.names = FALSE)[cumsum( lengths(YH)) - lengths(YH)

Re: [R] printing an arbitrary-length character vector in columns on a page of a pdf report

2018-06-05 Thread Berry, Charles
> On Jun 5, 2018, at 9:45 AM, Christopher W Ryan wrote: > > I'm writing code for a recurring report, using an R --> Sweave --> pdflatex > workflow. It includes a character vector of short words that I would like > to display compactly, in columns on a page, rather than one word per line, > whi

Re: [R] to R Core T: mle function in 32bits not respecting the constrain

2018-05-28 Thread Berry, Charles
> On May 27, 2018, at 10:31 PM, francesc badia roca wrote: > > I have an issue using mle in versions of 32 bits. > > I am writing a package which I want to submit to the CRAN. > When doing the check, there is an example that has an error running in the > 32 bits version. > > The problem comes

Re: [R] is there any method to defer the execution of code in r?

2018-05-13 Thread Berry, Charles
> On May 13, 2018, at 9:24 AM, Jeff Newmiller wrote: > > Not when I click on that link. > > Nor me, but what I get is actually https://stackoverflow.com/questions/1174799/how-to-make-execution-pause-sleep-wait-for-x-seconds-in-r note the number is *different* than 50314015 - the OPs postin

Re: [R] How to define mutualy exclusive parameters of a function

2018-04-26 Thread Berry, Charles
> On Apr 26, 2018, at 6:46 AM, Polychronis Kostoulas > wrote: > > Dear All, > apologies if this is basic: I am writing a function: > > fb<-function(mean, median, mode, a, b=0.95, lower=F) > {} > > The arguments mean, median and mode are mutually exclusive (i.e. the user > should define o

Re: [R] getting all circular arrangements without accounting for order

2018-03-30 Thread Berry, Charles
> On Mar 29, 2018, at 6:48 PM, Ranjan Maitra wrote: > > Dear friends, > > I would like to get all possible arrangements of n objects listed 1:n on a > circle. > > Now this is easy to do in R. Keep the last spot fixed at n and fill in the > rest using permuations(n-1, n-1) from the gtools pa

Re: [R] Gaussian Process Classification R packages

2017-12-11 Thread Berry, Charles
> On Dec 11, 2017, at 8:06 AM, Damjan Krstajic wrote: > > I have kindly asked for help and I am sad to receive such a reply from some > on the r-help list. > > Well, you only said you were `struggling' to find a package. Bert may well have done the Google search himself and found numerous r

Re: [R] libPaths displays truncated path?

2017-11-23 Thread Berry, Charles
> On Nov 23, 2017, at 4:34 AM, Loris Bennett wrote: > > Hi, > > TL;DR > - > > I define the path > >/cm/shared/apps/R/site-library/3.4.2 > > and add it to libPath. Why does libPath then display it as > >/cm/shared/apps/R/site-library/3.4 > > ? > Because it is a symbolic li

Re: [R] draw a circle with a gradient fill

2017-10-24 Thread Berry, Charles
> On Oct 24, 2017, at 2:56 AM, Alaios via R-help wrote: > > Hi all,I would like to draw a simple circle where the color gradient follows > the rule color = 1/(r^2) where r is the distance from the circle. This is called a radial gradient fill in SVG speak. [snip] > but this package does not

[R] [R-pkgs] gpuR 2.0.0 released

2017-10-20 Thread Charles Determan
Dear R users, I am happy to announce the most recent version of gpuR has been released. There are several new enhancements to the package including the ability to use user written OpenCL kernels. A full list of changes from the NEWS are shown below. API Changes: 1. deviceType, gpuInfo, cpuInfo

Re: [R] "Improvement with the R code"

2017-08-28 Thread Berry, Charles
> On Aug 28, 2017, at 9:26 AM, Elie Canonici Merle > wrote: > > Chuck (Is it fine to call you Chuck?) In this forum, yes please. > I don't know much about pmin and factor but it might worth looking into if > you want to manipulate states by names (I assume this is why one might want > to use

Re: [R] "Improvement with the R code"

2017-08-28 Thread Berry, Charles
All of this can be done without for loops. Use head(..., -1), tail(..., -1) to get the pre and post states. Use factor or pmin to recode them as necessary Use table(pre, post) to get the transition counts. Use prop.table(table_of_counts,1) to get the probabilities. HTH, Chuck > On Aug 28,

Re: [R] fitting cosine curve

2017-06-21 Thread Charles C. Berry
what I'm calling amplitude, the d and f are what I'm calling phase. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

Re: [R] fitting cosine curve

2017-06-20 Thread Charles C. Berry
On Tue, 20 Jun 2017, lily li wrote: Hi R users, I have a question about fitting a cosine curve. I don't know how to set the approximate starting values. See Y.L. Tong (1976) Biometrics 32:85-94 The method is known as `cosinor' analysis. It takes advantage of the *intrinsic* linear

Re: [R] Determining which.max() within groups

2017-06-07 Thread Charles C. Berry
On Tue, 6 Jun 2017, Morway, Eric wrote: Using the dataset below, I got close to what I'm after, but not quite all the way there. Any suggestions appreciated: Daily <- read.table(textConnection(" Date wyrQ 1911-04-01 1990 4.530695 1911-04-02 1990 4.700596 1911-04-03 1990 4.898814 1

Re: [R] Data import R: some explanatory variables not showing up correctly in summary

2017-06-01 Thread Charles C. Berry
EASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry Dept of Family Medicine & Public Health cberry at ucsd edu UC San Diego /

Re: [R] odfWeave - A loop of the "same" data

2017-06-01 Thread Charles C. Berry
On Thu, 1 Jun 2017, POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help wrote: Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicit

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Charles Determan
le type now. Thanks again. > > > On Tue, May 9, 2017 at 9:04 AM, Charles Determan > wrote: > >> If you want the mean of each element across you list of matrices the >> following should provide what you are looking for where Reduce sums all >> your matrix elements

Re: [R] About calculating average values from several matrices

2017-05-09 Thread Charles Determan
, Charles On Tue, May 9, 2017 at 9:52 AM, lily li wrote: > I meant for each cell, it takes the average from other dataframes at the > same cell. I don't know how to deal with row names and col names though, so > it has the error message. > > On Tue, May 9, 2017 at 8:50 AM,

Re: [R] Multi-GPU "Yinyang" K-means and K-nn for R

2017-02-23 Thread Charles Determan
be best though to take this conversation off list though. If you would like to discuss this further please email me separately. Kind regards, Charles On Thu, Feb 23, 2017 at 4:37 AM, Vadim Markovtsev wrote: > ¡Hola! > > This is to announce that [kmcuda](https://github.com/src-d/km

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-21 Thread Charles C. Berry
On Tue, 21 Feb 2017, stephen sefick wrote: Sorry for not being clear. I have never used S3 methods before. Below is some R code that sketches out my idea. Is this a sensible solution? Sure. See comments (untested) inline. Chuck test_data <- data.frame(a=1:10, b=1:10, c=1:10) functionA <-

Re: [R] Make sure a data frame has been "fun through" a function

2017-02-20 Thread Charles C. Berry
On Mon, 20 Feb 2017, stephen sefick wrote: Hello, I would like to add something to a data frame that is 1) invisible to the user, 2) has no side effects, and 3) I can test for in a following function. Is this possible? I am exploring classes and attributes and I have thought about using a list

[R] [R-pkgs] gpuR 1.2.0 released

2016-12-22 Thread Charles Determan
all through my github issues https://github.com/cdeterman/gpuR.git Also, thanks to all those as well for testing this package on various GPU devices and operating systems. A lot of the stability of this package is made possible by your efforts. Kind regards, Charles [[alternative H

Re: [R] MC_CORES and mc.cores for parallel package

2016-12-07 Thread Charles C. Berry
On Wed, 7 Dec 2016, Marc Girondot via R-help wrote: Hi, From the documentation of ?options Options set in package parallel These will be set when package parallel (or its namespace) is loaded if not already set. mc.cores: a integer giving the maximum allowed number of additional R processes

Re: [R] Frequency of a character in a string

2016-11-14 Thread Charles C. Berry
On Mon, 14 Nov 2016, Marc Schwartz wrote: On Nov 14, 2016, at 11:26 AM, Charles C. Berry wrote: On Mon, 14 Nov 2016, Bert Gunter wrote: [stuff deleted] Hi, Both gsub() and strsplit() are using regex based pattern matching internally. That being said, they are ultimately calling

Re: [R] Frequency of a character in a string

2016-11-14 Thread Charles C. Berry
On Mon, 14 Nov 2016, Bert Gunter wrote: Yes, but it need some help, since nchar gives the length of the *entire* string; e.g. ## to count "a" 's : x <-(c("abbababba","bbabbabbaaaba")) nchar(gsub("[^a]","",x)) [1] 4 6 This is one of about 8 zillion ways to do this in base R if you don't wan

Re: [R] Alternative to apply in base R

2016-11-08 Thread Charles C. Berry
On Tue, 8 Nov 2016, Doran, Harold wrote: Without reaching out to another package in R, I wonder what the best way is to speed enhance the following toy example? Over the years I have become very comfortable with the family of apply functions and generally not good at finding an improvement fo

Re: [R] Dealing with -Inf in a maximisation problem.

2016-11-06 Thread Charles C. Berry
On Mon, 7 Nov 2016, Rolf Turner wrote: On 07/11/16 13:07, William Dunlap wrote: Have you tried reparameterizing, using logb (=log(b)) instead of b? Uh, no. I don't think that that makes any sense in my context. The "b" values are probabilities and must satisfy a "sum-to-1" constraint. To a

Re: [R] Converting a list to a data frame

2016-11-04 Thread Charles Determan
Hi Kevin, There may be a more elegant way but the following do.call and lapply should solve your problem. do.call(rbind, lapply(seq(length(x)), function(i) data.frame(set=i, x[[i]]))) Regards, Charles On Fri, Nov 4, 2016 at 7:37 AM, Kevin E. Thorpe wrote: > There is probably a very sim

Re: [R] function ave() with seq_along returning char sequence instead of numeric

2016-11-01 Thread Charles C. Berry
On Mon, 31 Oct 2016, Jeff Newmiller wrote: The help page describes the first argument x as a numeric... it is not designed to accept character, Actually it is so designed, but not advertised as such. See below. so the fact that you get anything even close to right is just a bonus. As the do

[R] Escaping quotes WAS: Storing long string with white space in variable

2016-10-19 Thread Charles C. Berry
On Wed, 19 Oct 2016, g.maub...@weinwolf.de wrote: Hi All, I would like to store a long string with white space in a variable: -- cut -- # Create README.md readme <- "--- title: "Your project title here" author: "Author(s) name(s) here" date: "Current date here" output: html_document --- [s

Re: [R] Looping through data tables (or data frames) by removing previous individuals

2016-10-03 Thread Charles C. Berry
On Mon, 3 Oct 2016, Frank S. wrote: Dear R users, [deleted] I want to get a list of "k" data tables (or data frames) so that each contains those individuals who for the first time are at least 65, looping on each of the dates of vector "v". Let's consider the following example with 5 ind

Re: [R] Where are the PCA outputs?

2016-09-12 Thread Charles Determan
Hi Nick, "prcomp" returns an object of class "prcomp" so when you simply 'print' the object it gets passed to the "print.prcomp" function. If you want to see all the objects you should assign the results to an object. Regards, Charles On Mon, Sep 1

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-03 Thread Charles C. Berry
On Sat, 3 Sep 2016, Bert Gunter wrote: Chuck et. al.: As I said previously, my intuition about the relative efficiency of tapply() and duplicated() in the context of this thread was wrong. My `intuition' was wrong, too. But tapply() uses split() which runs quite fast. So not a big surprise,

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Charles C. Berry
On Fri, 2 Sep 2016, Bert Gunter wrote: [snip] The "trick" is to use tapply() to select the necessary row indices of your data frame and forget about all the do.call and rbind stuff. e.g. I agree the way to go is "select the necessary row indices" but I get there a different way. See below.

Re: [R] Help with big data and parallel computing: 500, 000 x 4 linear models

2016-08-08 Thread Charles C. Berry
On Mon, 8 Aug 2016, Ellis, Alicia M wrote: I have a large dataset with ~500,000 columns and 1264 rows. Each column represents the percent methylation at a given location in the genome. I need to run 500,000 linear models for each of 4 predictors of interest in the form of: Methylation.stie

Re: [R] How to make the "apply" faster

2016-07-09 Thread Charles C. Berry
On Sat, 9 Jul 2016, Debasish Pai Mazumder wrote: I have 4-dimension array x(lat,lon,time,var) I am using "apply" to calculate over time new = apply(x,c(1,2,4),FUN=function(y) {length(which(y>=70))}) This is very slow. Is there anyway make it faster? If dim(x)[3] << prod(dim(x)[-3]), new <-

Re: [R] How to identify runs or clusters of events in time

2016-07-01 Thread Charles C. Berry
See below On Fri, 1 Jul 2016, Mark Shanks wrote: Hi, Imagine the two problems: 1) You have an event that occurs repeatedly over time. You want to identify periods when the event occurs more frequently than the base rate of occurrence. Ideally, you don't want to have to specify the perio

[R] openssl package install error

2016-05-06 Thread Charles Determan
I am trying to install 'openssl' on ubuntu 14.04. I already of libssl-dev and libcurl4-openssl-dev installed. But when I try to install I get a bunch of errors complaining about 'unknown type 'u_char''. Thoughts? Excerpt of output: Found pkg-config cflags and libs! Using PKG_CFLAGS= Using PKG_

Re: [R] Linear Regressions with constraint coefficients

2016-04-26 Thread charles rockson via R-help
Any help with exporting anova output in R to csv or xlsx? From: "Aleksandrovic, Aljosa (Pfaeffikon)" To: Bert Gunter Cc: "r-help@r-project.org" Sent: Tuesday, April 26, 2016 8:29 AM Subject: Re: [R] Linear Regressions with constraint coefficients Ok, and if I would just like to fo

Re: [R] Using read.csv() to import data

2016-04-25 Thread charles rockson via R-help
Duncan, What about converting your anova results in R  back into csv or excel? Thanks Charles   From: Duncan Murdoch To: Jason Hernandez ; "r-help@r-project.org" Sent: Sunday, April 24, 2016 2:05 PM Subject: Re: [R] Using read.csv() to import data On 24/04/2016 4:30

[R] Using read.csv() to import data

2016-04-25 Thread charles rockson via R-help
First save your file as csv and then type the following in the consoleassignname assignname=read.csv(file.choose()) This would open up your dcouments file and then you can select the file you saved as csv. Cheers From: Jason Hernandez via R-help To: "r-help@r-project.org" Sent: S

Re: [R] A Neural Network question

2016-04-19 Thread Charles Determan
Hi Phil, I don't think this is the correct list for this. You question has nothing to do with R specifically which is the purpose here. I suggest you pursue other help lists related to neural networks to try and find someone to assist you. Regards, Charles On Sat, Apr 16, 2016 at 2:

Re: [R] TensorFlow in R

2016-04-01 Thread Charles Determan
Hi Axel, Looks like the only thing right now is rflow ( https://github.com/terrytangyuan/rflow). It appears to simply wrap around the python bindings. I am not aware of any others. Be interesting to keep an eye on. Regards, Charles On Fri, Apr 1, 2016 at 11:32 AM, Axel Urbiz wrote: >

Re: [R] Fit a smooth closed shape through 4 points

2016-03-21 Thread Charles Determan
method used. Regards, Charles On Mon, Mar 21, 2016 at 7:59 AM, Alexander Shenkin wrote: > Hello all, > > I have sets of 4 x/y points through which I would like to fit closed, > smoothed shapes that go through those 4 points exactly. smooth.spline > doesn't like my data, si

[R] [R-pkgs] gpuR 1.1.0 Release

2016-03-18 Thread Charles Determan
' method for pairwise distances (euclidean and sqEuclidean) Introductory vignette can be found at https://cran.r-project.org/web/packages/gpuR/vignettes/gpuR.pdf Help with installation can be found at https://github.com/cdeterman/gpuR/wiki Bug reports, suggestions, and feature requests are appreciated

Re: [R] RSNNS neural network

2016-03-03 Thread Charles Determan
Unfortunately we can only provide so much help without a reproducible example. Can you use a dataset that everyone would have access to to reproduce the problem? Otherwise it is difficult for anyone to help you. Regards, Charles On Tue, Mar 1, 2016 at 12:35 AM, jake88 wrote: > I am new t

Re: [R] GPU package crowd-source testing

2016-02-11 Thread Charles Determan
n, thanks to all for taking the time to try out this package. Regards, Charles On Tue, Feb 9, 2016 at 12:20 PM, Charles Determan wrote: > Greetings R users, > > I would like to request any users who would be willing to test one of my > packages. Normally I would be content using testt

[R] GPU package crowd-source testing

2016-02-09 Thread Charles Determan
hat I can accomplish from a hardware perspective. Best Regards, Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Charles C. Berry
On Sun, 17 Jan 2016, Lars Bishop wrote: I’d appreciate your help on understanding the following. It is not very clear to me from the model.matrix documentation, why simply changing the order of terms in the formula may change the number of resulting columns. Please note I’m purposely not in

[R] Which GLM to use with mixed predictor variables i.e. both discrete and continous

2016-01-09 Thread Charles Thuo
is discrete p.statcount - predictor variable and is discrete Which is the most appropriate glm to use for such a model. Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see ht

[R] [R-pkgs] New package: gpuR

2015-11-30 Thread Charles Determan
tains a wiki to help with installation. Although it must be compiled, it is able to be installed on Linux, Mac OSX, and Windows platforms. I welcome any comments, issues (please submit on the github), and of course additional contributions. Regards, Charles Determan [[alterna

Re: [R] Add sequence numbers to lines with the same ID: How can this be accomplished?

2015-10-24 Thread Charles C. Berry
t of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide comm

Re: [R] Linear regression with a rounded response variable

2015-10-21 Thread Charles C. Berry
On Wed, 21 Oct 2015, Ravi Varadhan wrote: Hi, I am dealing with a regression problem where the response variable, time (second) to walk 15 ft, is rounded to the nearest integer. I do not care for the regression coefficients per se, but my main interest is in getting the prediction equation fo

Re: [R] Plotting EEG signals as a "head" using R

2015-10-19 Thread Charles Novaes de Santana
Thanks a lot, Dénes!! This library is very good! I can plot the head even in 3D using the command "eegspace(space,voltage)", in which "space" defines the position of the electrodes and voltage is the voltage of my EEG signal :) Simple and elegant! :) Thanks! Best, Char

  1   2   3   4   5   6   7   8   9   10   >