Re: [R] [External] converting MATLAB -> R | element-wise operation

2024-02-29 Thread Evan Cooch
Very interesting - thanks! Most of my problems are not limited by compute speed, but its clear that for some sorts of compute-intensive problems, sweep might be a limiting approach. On 2/29/2024 6:12 PM, Richard M. Heiberger wrote: > I decided to do a direct comparison of transpose and sweep. >

Re: [R] [External] converting MATLAB -> R | element-wise operation

2024-02-28 Thread Evan Cooch
2.0 1.667 1.50 > R matrices are column-based. MATLAB matrices are row-based. > >> On Feb 27, 2024, at 14:54, Evan Cooch wrote: >> >> So, trying to convert a very long, somewhat technical bit of lin alg >> MATLAB code to R. Most of it working, but raninto a stumb

[R] converting MATLAB -> R | element-wise operation

2024-02-27 Thread Evan Cooch
So, trying to convert a very long, somewhat technical bit of lin alg MATLAB code to R. Most of it working, but raninto a stumbling block that is probaably simple enough for someone to explain. Basically, trying to 'line up' MATLAB results from an element-wise division of a matrix by a vector

[R] linear programming in R | limits to what it can do, or my mistake?

2024-01-30 Thread Evan Cooch
Question for 'experts' in LP using R (using the lpSolve package, say) -- which does not apply to me for the sort of problem I describe below. I've run any number of LP's using lpSolve in R, but all of them to date have objective and constraint functions that both contain the same variables.

Re: [R] reference generated var name in loop

2023-05-28 Thread Evan Cooch
for(nm in names(parms)) { tmp.nm <- paste0(nm, '_r') ranvec[[tmp.nm]] <- rnorm(5, parms[nm], 0.25) } On Fri, May 26, 2023 at 8:50 AM Evan Cooch wrote: Greetings -- I'm trying to write some code that basically does the following: 1\ user inputs a list of parameter names, and parameter va

[R] reference generated var name in loop

2023-05-26 Thread Evan Cooch
Greetings -- I'm trying to write some code that basically does the following: 1\ user inputs a list of parameter names, and parameter values. 2\ code parses this list, extracting parameter names and values separately 3\ loops over the number of parameters, and for each parameter, generates

Re: [R] extract parts of a list before symbol

2023-05-26 Thread Evan Cooch
y be overkill as simply converting to a vector if ALL parts are of the same type will work too: names(as.vector(test)) [1] "a" "b" "c" To get one at a time: names(as.vector(test))[1] [1] "a" You can do it even simple by looking at the attributes of your

[R] extract parts of a list before symbol

2023-05-25 Thread Evan Cooch
Suppose I have the following list: test <- list(a=3,b=5,c=11) I'm trying to figure out how to extract the characters to the left of the equal sign (i.e., I want to extract a list of the variable names, a, b and c. I've tried the permutations I know of involving sub - things like

[R] interval between specific characters in a string...

2022-12-02 Thread Evan Cooch
Was wondering if there is an 'efficient/elegant' way to do the following (without tidyverse). Take a string abaaabbabaaab Its easy enough to count the number of times the character 'b' shows up in the string, but...what I'm looking for is outputing the 'intervals' between occurrences of

Re: [R] conditional output of string to file n times...

2021-07-07 Thread Evan Cooch
Figured it out on my own. Basically, use the replicate command for each line of the data.frame, then appending to a file. On 7/6/2021 9:27 AM, Evan Cooch wrote: Suppose I have a file with the the following structure - call the two space-separated fields 'label' and 'count': ABC 3 DDG 5 ABB 2

[R] conditional output of string to file n times...

2021-07-07 Thread Evan Cooch
Suppose I have a file with the the following structure - call the two space-separated fields 'label' and 'count': ABC 3 DDG 5 ABB 2 What I need to do is parse each line of the file, and then depending on the value of count, write out the value of 'label' to a new file, but 'count' times. In

Re: [R] problem(s) compiling RWinEdt

2019-04-22 Thread Evan Cooch
On 4/22/2019 2:00 PM, William Dunlap wrote: > Trying adding INSTALL_opts="--no-test-load" to your > install.packages(type="source",...) command.   This package is being > too clever in its .onAttach function. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > Thanks

[R] problem(s) compiling RWinEdt

2019-04-22 Thread Evan Cooch
[Note: if this should go to one of the other R maillists, apologies...and let me know *which* other list...] I use the WinEdt editor for ll my TeX work, and several years back, installed the RWinEdt package in R to allow me to use WinEdt as my R edtior as well. Worked, and continues to work,

Re: [R] A general question about using Bayes' Theorem for calculating the probability of The End of Human Technological Civilisation

2019-03-19 Thread Evan Cooch
Just curious -- if R-help is a moderated list (which  in theory , it is -- my posts have been 'modertated', to the degree that they aren't released to the list until someone approves them), and if these 'statistics discussion' questions are inappropriate to the mission (as described),

Re: [R] looking for 'tied rows' in dataframe

2019-03-19 Thread Evan Cooch
x for a 1-based indexing system. > > hold=apply(test,1,which.max) > hold[apply(test,1,isUnique)==FALSE] <- 0 > hold > [1] 1 2 0 > > > >> On Mar 17, 2019, at 8:17 PM, Evan Cooch wrote: >> >> Solved -- >> >> hold=apply(test,1,which.max) >&g

Re: [R] looking for 'tied rows' in dataframe

2019-03-18 Thread Evan Cooch
Solved -- hold=apply(test,1,which.max)     hold[apply(test,1,isUnique)==FALSE] <- 'T' Now, all I need to do is figure out how to get <- 'T' from turning everything in the matrix to a string. On 3/17/2019 8:00 PM, Evan Cooch wrote: Got relatively close - below: On 3/17/2019 7:39 PM

Re: [R] looking for 'tied rows' in dataframe

2019-03-18 Thread Evan Cooch
Got relatively close - below: On 3/17/2019 7:39 PM, Evan Cooch wrote: Suppose I have the following sort of structure: test <- matrix(c(2,1,1,2,2,2),3,2,byrow=T) What I need to be able to do is (i) find the maximum value for each row, (ii) find the column containing the max, but (

[R] looking for 'tied rows' in dataframe

2019-03-18 Thread Evan Cooch
Suppose I have the following sort of structure: test <- matrix(c(2,1,1,2,2,2),3,2,byrow=T) What I need to be able to do is (i) find the maximum value for each row, (ii) find the column containing the max, but (iii) if the maximum value is a tie (in this case, all numbers of the row are the

Re: [R] options other than regex

2018-05-25 Thread Evan Cooch
Numbers -- thanks. Another clever trick. On 5/25/2018 11:54 AM, Greg Minshall wrote: > Evan, > > are you really looking at numbers, or just at character strings (that, > in your case, happen to be numbers)? if just characters, this rather > odd combination of strsplit() and Reduce() might do the

Re: [R] options other than regex

2018-05-25 Thread Evan Cooch
ení odpovědnosti: > https://www.precheza.cz/01-dovetek/ | This email and any documents attached > to it may be confidential and are subject to the legally binding disclaimer: > https://www.precheza.cz/en/01-disclaimer/ > >> -Original Message- >> From: R-help [m

[R] options other than regex

2018-05-25 Thread Evan Cooch
Hi -- I'm looking for alternatives to regex for a fairly simply 'reformatting' problem. Alternatives only because a lot of folks have trouble parsing/interpreting regex expressions, and I'm looking for suggestions for something more 'transparent'. Here is an example of what I'm trying to

Re: [R] building random matrices from vectors of random parameters

2017-09-28 Thread Evan Cooch
Makes sense, although (re-)learning what aperm does wasn't a wasted exercise. Thanks! On 9/28/2017 1:22 PM, Jeff Newmiller wrote: > The use of aperm is unnecessary if you call array() properly. > > ms <- array(c(rep(0, 5),so,sa*m,sa), c(5, 2, 2)) [[alternative HTML version deleted]]

Re: [R] building random matrices from vectors of random parameters

2017-09-28 Thread Evan Cooch
Sure -- thanks -- only took me 3-4 attempts to get aperm to work (as opposed to really thinking hard about how it works ;-) On 9/28/2017 11:55 AM, Duncan Murdoch wrote: > On 28/09/2017 9:10 AM, Evan Cooch wrote: >> Thanks for both the mapply and array approaches! However, although &g

Re: [R] building random matrices from vectors of random parameters

2017-09-28 Thread Evan Cooch
> > In fact, this is what is returned by the mapply approach, while the > array approach returns the transpose. I gather the 'missing step' is > to use aperm, but haven't figured out how to get that to work...yet. ms <- array(c(rep(0, 3),sa*m,so,sa), c(3, 2, 2)) ms_new <- aperm(ms,c(1,3,2));

Re: [R] building random matrices from vectors of random parameters

2017-09-28 Thread Evan Cooch
Thanks for both the mapply and array approaches! However, although intended to generate the same result, they don't: # mapply approach n = 3 sa <- rnorm(n,0.8,0.1) so <- rnorm(n,0.5,0.1) m <- rnorm(n,1.2,0.1) mats = mapply(function(sa1, so1, m1) matrix(c(0,sa1*m1,so1,sa1),2,2,byrow=T), sa, so,

[R] building random matrices from vectors of random parameters

2017-09-27 Thread Evan Cooch
Suppose I have interest in a matrix with the following symbolic structure (specified by 3 parameters: sa, so, m): matrix(c(0,sa*m,so,sa),2,2,byrow=T) What I can't figure out is how to construct a series of matrices, where the elements/parameters are rnorm values. I'd like to construct

Re: [R] update numeric values of list with new values...

2017-09-22 Thread Evan Cooch
test.new > $a > [1] 4 > > $b > [1] 5 > > $c > [1] 6 > > Cheers, > Bert > > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed

Re: [R] update numeric values of list with new values...

2017-09-22 Thread Evan Cooch
Solved it: test <- list(a=1,b=2,c=3) new <- c(4,5,6) hold <- as.list(new) updated_test <- replace(test,c(1:3),hold) $a [1] 4 $b [1] 5 $c [1] 6 mean.parms <- as.list(mean.parms) mm.parms <- replace(far.parms,c(1:length(far.parms)),mean.parms) On 9/22/2017 10:34 AM

[R] update numeric values of list with new values...

2017-09-22 Thread Evan Cooch
Suppose I have the following: test <- list(a=1,b=2,c=3) I also have a vector (or list, or something else...) with new numbers new <- c(4,5,6) What I'm trying to figure out is how to take the list, and update the numbers from {1,2,3} to {4,5,6} So, in the end,I want the 'update' test list

Re: [R] selecting dataframe columns based on substring of col name(s)

2017-06-22 Thread Evan Cooch
Thanks to all the good suggestions/solutions to the original problem. On 6/21/2017 3:28 PM, David Winsemius wrote: >> On Jun 21, 2017, at 9:11 AM, Evan Cooch <evan.co...@gmail.com> wrote: >> >> Suppose I have the following sort of dataframe, where each column name ha

[R] selecting dataframe columns based on substring of col name(s)

2017-06-21 Thread Evan Cooch
Suppose I have the following sort of dataframe, where each column name has a common structure: prefix, followed by a number (for this example, col1, col2, col3 and col4): d = data.frame( col1=runif(10), col2=runif(10), col3=runif(10),col4=runif(10)) What I haven't been able to suss out is

[R] pull stat out of summary

2017-03-31 Thread Evan Cooch
Continuing my learning curve after 25_ years with using SAS. Want to pull the "Mean" forom the summary of something... test <- rnorm(1000,1.5,1.25) hold <- summary(test) names(hold) [1] "Min.""1st Qu." "Median" "Mean""3rd Qu." "Max." OK, so "Mean" is in there. So, is there a short

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-18 Thread Evan Cooch
data %>% group_by(exp) %>% summarise(difference = diff(rslt)) Or with base R aggregate(mydata, by = list(group = mydata$exp), FUN = diff) HTH Ulrik On Fri, 17 Mar 2017 at 17:34 Evan Cooch <evan.co...@gmail.com> wrote: Suppose I have a dataframe that looks like the following: n=2 m

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-18 Thread Evan Cooch
r with base R aggregate(mydata, by = list(group = mydata$exp), FUN = diff) HTH Ulrik On Fri, 17 Mar 2017 at 17:34 Evan Cooch <evan.co...@gmail.com> wrote: Suppose I have a dataframe that looks like the following: n=2 mydata <- data.frame(exp = rep(1:5,each=n), rslt = c(12,15,7,8,24,2

Re: [R] lagging over consecutive pairs of rows in dataframe

2017-03-18 Thread Evan Cooch
On 3/17/2017 12:58 PM, Ulrik Stervbo wrote: > Hi Evan > > you can easily do this by applying diff() to each exp group. > > Either using dplyr: > library(dplyr) > mydata %>% > group_by(exp) %>% > summarise(difference = diff(rslt)) > > Or with base R > aggregate(mydata, by = list(group =

[R] lagging over consecutive pairs of rows in dataframe

2017-03-17 Thread Evan Cooch
Suppose I have a dataframe that looks like the following: n=2 mydata <- data.frame(exp = rep(1:5,each=n), rslt = c(12,15,7,8,24,28,33,15,22,11)) mydata exp rslt 11 12 21 15 327 428 53 24 63 28 74 33 84 15 95 22 10 5 11 The

Re: [R] matrix merge, or something else?

2017-03-10 Thread Evan Cooch
Slick -- thanks. On 3/10/2017 1:26 AM, Jeff Newmiller wrote: test2[ , colnames( test1 ) ] <- test1 __ 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

Re: [R] concatenating range of columns in dataframe

2017-03-10 Thread Evan Cooch
On 3/10/2017 2:24 AM, Ulrik Stervbo wrote: Hi Evan, the unite function of the tidyr package achieves the same as Jim suggested, but in perhaps a slightly more readable manner. Ulrik I use perl for scripting, so readability isn't a big factor. ;-) Thanks!

Re: [R] concatenating range of columns in dataframe

2017-03-10 Thread Evan Cooch
On 3/10/2017 1:48 AM, Jim Lemon wrote: Hi Evan, How about this: df2<-data.frame(Trt=df[,1],Conc=apply(df[,2:5],1,paste,sep="",collapse="")) Jim Thanks! __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] concatenating range of columns in dataframe

2017-03-10 Thread Evan Cooch
On 3/10/2017 2:23 AM, Bert Gunter wrote: I think you need to spend some time with an R tutorial or two, especially with regard to indexing. Unless I have misunderstood (apologies if I have), df$Conc <- apply(df[,-1],1,paste,collapse="") does it. -- Bert \ Thanks -- sage advice.

[R] concatenating range of columns in dataframe

2017-03-09 Thread Evan Cooch
Suppose I have the following data frame (call it df): Trt y1 y2 y3 y4 A1A 1001 A1B 1100 A1 C 0 10 1 A1D 111 1 What I want to do is concatenate columns y1 -> y4 into a contiguous string (which I'll call df$conc), so that the final df looks

[R] matrix merge, or something else?

2017-03-09 Thread Evan Cooch
Suppose I have the following two matrices, both with same number of rows (3), but different number of columns (3 in test1, 4 in test2). test1 <- matrix(c(1,1,0,1,0,-1,-1,-1,0),3,3,byrow=T); test2 <- matrix( rep( 0, len=12), nrow = 3) I label the rows and columns of the two matrices as follows:

Re: [R] evaluating function over seq of values

2017-02-13 Thread Evan Cooch
Note that in your likelihood function, N can be a vector of values, so you can compute the likelihood for all values of N and just access the value you want via subscripting rather than repeatedly computing it for different N's. OK -- that is the part I'm stuck at - pointers to how to do

[R] evaluating function over seq of values

2017-02-13 Thread Evan Cooch
The MWE (below) shows what I'm hoping to get some help with: step 1\ specify the likelihood expression I want to evaluate using a brute-force grid search (not that I would do this in practice, but it is a convenient approach to explain the idea in a class...). step 2\ want to evaluate the

Re: [R] creating lists of random matrices

2016-11-09 Thread Evan Cooch
>> >> Hi, >> >> See ?replicate >> >> Example: >> >> ## Create a list of 5 2x2 matrices > > > Sorry, correction on my reply. > > I copied the wrong output, It should be: > > > replicate(5, matrix(rnorm(4), 2, 2), simplify = FALSE) > Perfect does the trick. Thanks also for the lapply solutions

[R] creating lists of random matrices

2016-11-09 Thread Evan Cooch
So, its easy enough to create a random matrix, using something like (say) matrix(rnorm(4),2,2) which generates a (2x2) matrix with random N(0,1) in each cell. But, what I need to be able to do is create a 'list' of such random matrices, where the length of the list (i.e., the number of said

Re: [R] problems compiling packages | 3.3.0 | Linux

2016-06-03 Thread Evan Cooch
OK -- thanks. I used to compile from source routinely, but could never get thee 'hand rolled' version of R to play nice with some external applications (specifically, jags, and openbugs). On 6/2/2016 5:41 PM, Marc Schwartz wrote: On Jun 2, 2016, at 10:35 AM, Evan Cooch <evan.co...@gmail.

[R] problems compiling packages | 3.3.0 | Linux

2016-06-02 Thread Evan Cooch
Updated my R install on my GNU/Linux boxes (running RHEL 6.xx), using latest from CRAN (i.e., not compiling from source), and while said upgrade seemed to go fine, am having all sorts of problems with getting some packages to compile (either during an initial install attempt, or upgrade to

Re: [R] embedding expression into title in R plot

2016-01-11 Thread Evan Cooch
On 1/11/2016 2:08 PM, William Dunlap wrote: I tend to use bquote, as in x_label <- bquote(bold(species) ~ (italic(N1))) plot(1:10,main=bquote("This is the expression for" ~ .(x_label) * "!")) Thanks -- I thought I'd tried something very close to this in my various attempts, but it

Re: [R] embedding expression into title in R plot

2016-01-11 Thread Evan Cooch
David -- On 1/11/2016 1:01 PM, David Winsemius wrote: On Jan 11, 2016, at 7:59 AM, Evan Cooch <evan.co...@gmail.com> wrote: Suppose I've specified that the xlab for a plot is expression(bold(species~(italic(N1 In other words, I want the axis label to be bold, italic 'species (N1)

Re: [R] different coloured axis title labels for different axes

2016-01-11 Thread Evan Cooch
On 1/11/2016 1:54 PM, William Dunlap wrote: The following shows how to get different colors for most features of a scatterplot: plot(1:11,log(1:11),ann=FALSE,axes=FALSE,col="pink",pch=16) box(col="gray") title(xlab="X Axis Label", col.lab="light blue") title(ylab="Y Axis Label",

[R] embedding expression into title in R plot

2016-01-11 Thread Evan Cooch
Suppose I've specified that the xlab for a plot is expression(bold(species~(italic(N1 In other words, I want the axis label to be bold, italic 'species (N1)' Now, I want the title for the plot to be have this label embedded in the title. Say, 'This is the plot for Species (N1)'. For a

[R] different coloured axis title labels for different axes

2016-01-11 Thread Evan Cooch
Consider a simple plot of X vs Y. There are elements on the plot that represent X, or Y, that are presented in different colours (say, blue for X, red for Y). Rather than use a legend, I would like to have the title label for the X-axis be in blue, and the title label for the Y-axis be in

[R] column means dropping column minimum

2015-12-08 Thread Evan Cooch
Suppose I have something like the following dataframe: samp1 <- c(60,50,20,90) samp2 <- c(60,60,90,58) samp3 <- c(25,65,65,90) test <- data.frame(samp1,samp2,samp3) I want to calculate column means. Easy enough, if I want to use all the data within each column: print(colMeans(test),na.rm =

Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-05 Thread Evan Cooch
On 11/5/2015 9:45 AM, Rainer Hurling wrote: Am 04.11.2015 um 21:36 schrieb Evan Cooch: On 11/4/2015 2:08 PM, Evan Cooch wrote: Greetings -- This has also been posted on the jags forum, but since I suspect the problem is more 'R-related' than jags, will aos post here. Decided to 'upgrade

Re: [R] JAGS 4.x, rjags 4.x problems | Linux -- solved

2015-11-05 Thread Evan Cooch
Well, sort of. I got sufficiently frustrated that I completely uninstalled R, jags, and everything related. Did a re-install using only versions of R nd JAGS found in the epel repo. No muss, no muss -- all works. Out of curiosity, uninstalled again, and tried my usual sequence of manually

Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-04 Thread Evan Cooch
On 11/4/2015 2:08 PM, Evan Cooch wrote: Greetings -- This has also been posted on the jags forum, but since I suspect the problem is more 'R-related' than jags, will aos post here. Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux boxes (which run latest RHEL). Here

Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-04 Thread Evan Cooch
On 11/4/2015 3:31 PM, Yvan Richard wrote: Hi Evan The last version of rjags on CRAN is 4.4. Have you tried it? http://cran.stat.auckland.ac.nz/web/packages/rjags/index.html I did have the same problem before updating it, but it now works on my Ubuntu with the new JAGS version. Cheers, -Yvan

Re: [R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-04 Thread Evan Cooch
it is installed. Seem reasonable? Not sure what to do about it, but... On 11/4/2015 3:42 PM, Evan Cooch wrote: On 11/4/2015 3:31 PM, Yvan Richard wrote: Hi Evan The last version of rjags on CRAN is 4.4. Have you tried it? http://cran.stat.auckland.ac.nz/web/packages/rjags/index.html I did have

[R] JAGS 4.x, rjags 4.x problems | Linux

2015-11-04 Thread Evan Cooch
Greetings -- This has also been posted on the jags forum, but since I suspect the problem is more 'R-related' than jags, will aos post here. Decided to 'upgrade' from jags 3.x.x to 4.x.x today, on my GNU/Linux boxes (which run latest RHEL). Here are the basic details: 1\ used R 3.2.2

Re: [R] 'strange' R graphics problem | Linux...

2015-10-15 Thread Evan Cooch
on my Ubuntu 14.04 > machine, that, as expected I have not had any problems with... I tried > to install 3.2.2 and 3.2.1 from source and got a very strange compile > error, which I need to sort out -- recompiling 3.1.1 failed as well... > > Best, > Tom > > On Wed, Oct 14,

[R] 'strange' R graphics problem | Linux...

2015-10-14 Thread Evan Cooch
So, am running 3.2.2 on a Centos 6.xx box. Code executes fine, but I'm having a heck of a time with graphics. I don't think this is related to R in the broad sense, but how it is interacting with graphics on the system. here is a description of the problem. 1\ something simple: test <-

Re: [R] 'strange' R graphics problem | Linux...

2015-10-14 Thread Evan Cooch
s, roll back to 3.2.1, and see what happens. > > Tom > > On Wed, Oct 14, 2015 at 2:47 PM, Evan Cooch <evan.co...@gmail.com > <mailto:evan.co...@gmail.com>> wrote: > > Tom -- > > On 10/14/2015 3:35 PM, Thomas Adams wrote: >> Evan, >>

Re: [R] 'strange' R graphics problem | Linux...

2015-10-14 Thread Evan Cooch
nks very much. I have a couple of Linux Mint 17.x systems as well -- I'll see if they throw the same problem at me/us. > Tom > > On Wed, Oct 14, 2015 at 8:36 AM, Evan Cooch <evan.co...@gmail.com > <mailto:evan.co...@gmail.com>> wrote: > > So, am running 3.2.2 on a Cent

Re: [R] 'strange' R graphics problem | Linux...

2015-10-14 Thread Evan Cooch
On 10/14/2015 4:00 PM, Evan Cooch wrote: > > > On 10/14/2015 3:51 PM, Thomas Adams wrote: >> Evan, >> >> I have Ubuntu 14.04 and 15.10 at home and have not had problems, but >> I don't think I've been using R 3.2.2 — I'll try this evening. > > Indeed - it

Re: [R] 'strange' R graphics problem | Linux...

2015-10-14 Thread Evan Cooch
/ftp sockets libxmlfifo cledit iconv TRUETRUETRUETRUETRUE TRUE NLS profmem cairo ICU long.double libcurl TRUE FALSETRUETRUETRUE FALSE On 10/14/2015 4:00 PM, Evan Cooch wrote

[R] extracting every nth character from a string...

2015-09-06 Thread Evan Cooch
Suppose I had the following string, which has length of integer multiple of some value n. So, say n=2, and the example string has a length of (2x4) = 8 characters. str <- "ABCDEFGH" What I'm trying to figure out is a simple, base-R coded way (which I heuristically call StrSubset in the

[R] specifying dimensions of a graphic (not the window...)

2015-02-08 Thread Evan Cooch
Greetings -- Graphics newbie (I generally don't use R for graphics, so if the question is 'obvious', point that out gently ;-) I'm trying to use levelplot in the lattice package, to generate what I'll call a 'decision table', where optimal decisions (discrete, on the interval [0.0,0.5] by

Re: [R] specifying dimensions of a graphic (not the window...)

2015-02-08 Thread Evan Cooch
On 2/8/2015 7:41 PM, Evan Cooch wrote: Greetings -- Graphics newbie (I generally don't use R for graphics, so if the question is 'obvious', point that out gently ;-) I'm trying to use levelplot in the lattice package, to generate what I'll call a 'decision table', where optimal decisions

Re: [R] naming rows/columns in 'array of matrices' | solved

2015-01-30 Thread Evan Cooch
The (obvious, after the fact) solution at the bottom. D'oh... On 1/30/2015 2:07 PM, Evan Cooch wrote: Suppose I have the following situation: I have an array of 2 matrices, where each matrix is (2x2): P - array(0, c(2,2,2)) P[,,1] - matrix(c(1,2,3,4),2,2,byrow=T); P[,,2] - matrix(c(5,6,7,8

[R] naming rows/columns in 'array of matrices'

2015-01-30 Thread Evan Cooch
Suppose I have the following situation: I have an array of 2 matrices, where each matrix is (2x2): P - array(0, c(2,2,2)) P[,,1] - matrix(c(1,2,3,4),2,2,byrow=T); P[,,2] - matrix(c(5,6,7,8),2,2,byrow=T); I want to label rows and columns of each matrix in the array, such that P would look

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread Evan Cooch
) + David Carlson (1) for their suggestions. On 10/8/2014 3:12 PM, Evan Cooch wrote: ...or some such. I'm trying to work up a function wherein the user passes a list of matrices to the function, which then (1) takes each matrix, (2) performs an operation to 'vectorize' the matrix (i.e., given an (m x

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread Evan Cooch
Thanks! On 10/9/2014 1:52 PM, David L Carlson wrote: Actually Jeff Laake's can be made even shorter with sapply(mat_list, as.vector) David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch Sent: Thursday, October 9

[R] cbind in a loop...better way?

2014-10-08 Thread Evan Cooch
...or some such. I'm trying to work up a function wherein the user passes a list of matrices to the function, which then (1) takes each matrix, (2) performs an operation to 'vectorize' the matrix (i.e., given an (m x n) matrix x, this produces the vector Y of length m*n that contains the

Re: [R] cbind in a loop...better way?

2014-10-08 Thread Evan Cooch
[mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch Sent: Wednesday, October 8, 2014 2:13 PM To: r-help@r-project.org Subject: [R] cbind in a loop...better way? ...or some such. I'm trying to work up a function wherein the user passes a list of matrices to the function, which then (1

[R] optim, L-BFGS-B | constrained bounds on parms?

2014-09-19 Thread Evan Cooch
Or, something to that effect. Following is an example of what I'm working with basic ABO blood type ML estimation from observed type (phenotypic) frequencies. First, I generate a log-likelihood function. mu[1] - mu[2] are allele freqs for A and B alleles, respectively. Since freq of O allele

Re: [R] optim, L-BFGS-B | constrained bounds on parms?

2014-09-19 Thread Evan Cooch
On 9/19/2014 11:32 AM, Prof J C Nash (U30A) wrote: One choice is to add a penalty to the objective to enforce the constraint(s) along with bounds to keep the parameters from going wild. This generally works reasonably well. Sometimes it helps to run just a few iterations with a big penalty

Re: [R] optim, L-BFGS-B | constrained bounds on parms?

2014-09-19 Thread Evan Cooch
You could also use Rvmmin that has bounds, or nmkb from dfoptim (though you cannot start on bounds). One 'negative' for dfoptim is that is doesn't automatically generate the Hessian (as far as I can tell). Rather nice to be able to do so for other calculations that usual follow after the

Re: [R] help using extrafont package | R graphics

2014-05-01 Thread Evan Cooch
is available at http://statr.me/2014/01/using-system-fonts-in-r-graphs/. Hope this would be helpful for you. Best, Yixuan 2014-04-26 16:54 GMT-04:00 Evan Cooch evan.co...@gmail.com mailto:evan.co...@gmail.com: Greetings -- Submitted this a little while ago -- for some reason, still

[R] help using extrafont package | R graphics

2014-04-26 Thread Evan Cooch
Greetings -- Submitted this a little while ago -- for some reason, still being held up by the moderator. Trying again... For a host of reasons, I need to use/embed Garamond font with various R graphics for a particular publication. I've figured out how to more or less get there from here,

[R] extrafont query | importing only 1 TTF

2014-04-25 Thread Evan Cooch
Greetings -- For a host of reasons, I need to use/embed Garamond font with various graphics for a particular publication. I've figured out how to more or less get there from here, using the following sequence: library(extrafont) Then, I need to import the system fonts (Windoze box). So, I

Re: [R] R2winBUGS WinBUGS gui

2007-11-25 Thread Evan Cooch
No. The idea is to use BRugs, i.e. OpenBUGS in such cases. If OpenBUGS lacks some features, you are certainly welcome to implement them and send patches to Andrew Thomas. Thanks very much. I thought as much, but given that I have had a 0% success rate in getting OpenBUGS to run on any

Re: [R] R2winBUGS WinBUGS gui

2007-11-25 Thread Evan Cooch
No. The idea is to use BRugs, i.e. OpenBUGS in such cases. If OpenBUGS lacks some features, you are certainly welcome to implement them and send patches to Andrew Thomas. Just finished trying the install of openBUGS under linux yet again. Same problems (more or less), which I'll list

Re: [R] R2winBUGS WinBUGS gui

2007-11-25 Thread Evan Cooch
Yes, sure, and indeed, it is a shame that nobody of those people who want it to work under Linux is trying to submit patches to make it work. I agree, but I *think* the primary reason for this is that it requires installing Blackbox as a PASCAL compiler. For much of the Linux community,

[R] R2winBUGS | option to turn off GUI?

2007-11-24 Thread Evan Cooch
Greetings - I run a multi-pro server box (GNU/Linux), on which I've installed winBUGS under wine. Works fine, and plays nice with r2WinBUGS, provided everything is done through a graphical front-end (either by working from console, or using a virtual desktop via VNC or equivalent). However,

[R] R2winBUGS WinBUGS gui

2007-11-23 Thread Evan Cooch
I am trying to figure out if it is possible to run winBUGS from within R, using R2winBUGS, without having winBUGS spawn any windows (basically - 'true' batch - no GUI actions at all). The reason being I have a machine which I (and several others) ssh/telnet into, and would like to run winBUGS

Re: [R] really dumb question | loop counters in

2007-09-21 Thread Evan Cooch
Thanks. And thanks for the C-style tip. Greg Snow wrote: Try: for(x in seq(0,1,by=0.01)) { print(x) } The for loop in S/R is what some languages call a foreach loop, you need to provide a vector of the values to loop over. If you really want a C style for loop, then just realize that