Re: [R] "Within" model in plm package: is the reported R-squared correct?

2018-02-20 Thread Bert Gunter
Generally speaking, statistical questions are O/T here, but sometimes they intersect with on-topic R programming issues and do get responses. So if you do not get a response here, try a statistics forum, like stats.stackexchange.com . Cheers, Bert Bert Gunter "The trouble with having an

Re: [R] deparseDots to get names of all arguments?

2018-02-20 Thread Bert Gunter
- 1 > b <- 2 > f(a,b) [1] "a" "b" I am sure that there are packages that may do this more elegantly and perhaps reliably, though. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it."

Re: [R] deparseDots to get names of all arguments?

2018-02-20 Thread Bert Gunter
Duncan et.al: Referring to my previous suggestion for f: > f(log(x),x^2) [1] "log(x)" "x^2" Is this not what you want? Cheers, Bert On Tue, Feb 20, 2018 at 4:00 PM, Duncan Murdoch wrote: > On 20/02/2018 5:47 PM, Rolf Turner wrote: > >> On 21/02/18 11:36, Spencer Graves wrote: >> >>> Hi, All

Re: [R] Aggregate over multiple and unequal column length data frames

2018-02-20 Thread Bert Gunter
All columns in a data.frame **must** have the same length. So you cannot do this unless empty values are filled with missings (NA's). -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley

Re: [R] regex for "[2440810] / www.tinyurl.com/hgaco4fha3"

2018-02-20 Thread Bert Gunter
These are always kind of fun, not least because of the variety of different replies that "work" at least somewhat. Here's mine: > stringa <- "[2440810] / www.tinyurl.com/hgaco4fha3" > sub("^(.+)www\\.(.+)\\.com.+","\\1\\2",stringa) [1] "[2440810] / tinyurl" Note the use of doubled backslashes to

Re: [R] Specify multiple nested random effects in lme with heteroskedastic variance across group

2018-02-21 Thread Bert Gunter
You should post this on the r-sig-mixed-models list. You are more likely to get a helpful response there. 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 in his "Bloo

Re: [R] Problem with geterrmessage()

2018-02-22 Thread Bert Gunter
if it fails." so: attr(ERRORMESSAGE, "conditon") will give you the error conditon. 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 in his "Bloom County" c

Re: [R] Regression Tree Questions

2018-02-24 Thread Bert Gunter
ere created/entered. -- 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 in his "Bloom County" comic strip ) On Sat, Feb 24, 2018 at 11:21 AM, José María Mateos wrote: > On

Re: [R] reshaping column items into rows per unique ID

2018-02-25 Thread Bert Gunter
almost certainly will not fit into any local version of R (maybe it would in some server version -- others more knowledgeable should comment on this). Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (

Re: [R] questions about performing Robust multiple regression using bootstrap

2018-02-26 Thread Bert Gunter
ts.stackexchange.com instead. While there, I suggest you also ask whether what you want to do makes any sense (I don't think it does). Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Ber

Re: [R] Random Seed Location

2018-02-26 Thread Bert Gunter
In case you don't get an answer from someone more knowledgeable: 1. I don't know. 2. But it is possible that other packages that are loaded after set.seed() fool with the RNG. 3. So I would call set.seed just before you invoke each random number generation to be safe. Cheers, Ber

Re: [R] Aggregate over multiple and unequal column length data frames

2018-02-27 Thread Bert Gunter
Then you need to rethink your data structure. Use a list instead of a data frame. The components of a list can have different lengths, and the "apply" family of functions (lapply(), etc.) can operate on them. Consult any good R tutorial for details. Cheers, Bert Bert Gunter "T

Re: [R] Parallel assignments and goto

2018-02-27 Thread Bert Gunter
No clue, but see ?assign perhaps if you have not done so already. -- 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 in his "Bloom County" comic strip ) On Tue, Feb

Re: [R] File system issue since upgrading macOS to High Sierra

2018-02-28 Thread Bert Gunter
> Any suggestions? > Post on the r-sig-mac list if you do not get a satisfactory reply here. -- Bert > > -Rich > > __ > 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] data analysis for partial two-by-two factorial design

2018-03-02 Thread Bert Gunter
you clearly need the off topic discussion as to what it does or does not mean. For that, you might try the stats.stackexchange.com statistical site. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." --

Re: [R] Random effect in GAM (mgcv)

2018-03-04 Thread Bert Gunter
Statistics questions are largely off topic on this list, although they do sometimes intersect R programming issues, which are on topic. However, I believe a statistics list like stats.stackexchange.com might be more suitable for your query. Cheers, Bert Bert Gunter "The trouble with h

Re: [R] Change Function based on ifelse() condtion

2018-03-04 Thread Bert Gunter
all(lapply,c(list(X,FUN),l))) } } > Lapply_me (X=1:5,FUN=sum,mc.cores=4) [[1]] [1] 1 [[2]] [1] 2 [[3]] [1] 3 [[4]] [1] 4 [[5]] [1] 5 Though the program logic needs fixing: if none of the names in list(...) are "mc.cores," l is undefined! Cheers, Bert Bert Gunter "The

Re: [R] Interpret List Label as Date from Quantmod getOptionChain

2018-03-04 Thread Bert Gunter
ackage that provide date tools. 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 in his "Bloom County" comic strip ) On Sun, Mar 4, 2018 at 6:28 PM, Sparks, John wrote:

[R] WAAAYYY OFF TOPIC -- For Statistics Buffs only

2018-03-05 Thread Bert Gunter
A really nice example of an instance where an "outlier" was the whole story scientifically and hiding it with statistical summaries, here an "average" of some sort, lost the science. Moral: "Look at your data and think." (Ellis Ott) https://www.sciencenews.org/article/proxima-centauri-flare-may-h

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
recovers the effects: > lm(y ~ drugA + drugB, data=d) Call: lm(formula = y ~ drugA + drugB, data = d) Coefficients: (Intercept) drugAy drugBy 1.282e-161.000e+002.000e+00 As usual, OFAT designs are blind to interactions, so that if they really exist, the interpretation

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
But of course the whole point of additivity is to decompose the combined effect as the sum of individual effects. "Mislead" is a subjective judgment, so no comment. The explanation I provided is standard. I used it for decades when I taught in industry. Cheers, Bert Bert Gunter &q

Re: [R] data analysis for partial two-by-two factorial design

2018-03-05 Thread Bert Gunter
Yuan: IMHO you need to stop making up your own statistical analyses and get local expert help. I have nothing further to say. Do what you will. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (ak

Re: [R] Capturing warning within user-defined function

2018-03-06 Thread Bert Gunter
diately** brought up ?tryCatch, which I think is what you want. If not, you should probably explain why it isn't, so that someone with more patience than I can muster will sort through your code to help. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people ke

Re: [R] Empirical density estimation

2018-03-11 Thread Bert Gunter
You need to re-read ?density and perhaps think again -- or do some study -- about how a (kernel) density estimate works. The points at which the estimate is calculated are *not* the values given, nor should they be! Cheers, Bert Bert Gunter "The trouble with having an open mind is that p

Re: [R] Equivalent of gtools::mixedsort in R base

2018-03-11 Thread Bert Gunter
ordered factors via do.call() as above. i.e. > y1 <- ordered(y,lev = mixedsort(y)) > y1 [1] a1 a10 a100 a12 a2 Levels: a1 < a2 < a10 < a12 < a100 > order(y1) [1] 1 5 2 4 3 (this is just for 1 vector to show how the idea would work). Of course, if this is **not** what yo

Re: [R] Bug report: override stopifnot() ?

2018-03-12 Thread Bert Gunter
ot;lsyMatrix" [,1] [1,] TRUE That is, the result is not a logical but a (S4) object of class "lsyMatrix" that contains a logical. Whence your (expected) error message. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along a

Re: [R] Learning advanced R

2018-03-13 Thread Bert Gunter
See here for some suggestions: https://www.rstudio.com/online-learning/#R 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 in his "Bloom County" comic strip ) On

Re: [R] Vary an equation using values from a sequence

2018-03-14 Thread Bert Gunter
I thnk what you want is ?outer. e.g.: outer(Data -min(Data),value,FUN = "+") Whether this works for your real task, however, may depend on details and complexities that you have omitted. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep c

Re: [R] stats 'dist' euclidean distance calculation

2018-03-15 Thread Bert Gunter
and I believe this whole thread may fit better at the Bioconductor list rather than here. 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 in his "Bloom County&quo

Re: [R] R code for Batch forecasting

2018-03-15 Thread Bert Gunter
Use a for loop or something else, e.g. lapply() with predict(). To get a better answer, read and follow the posting guide linked below. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley B

Re: [R] length of 'dimnames' [2] not equal to array extent- For Correlation Plot

2018-03-17 Thread Bert Gunter
Hmmm The error message seems self-explanatory. Please re-read ?corrplot. 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 in his "Bloom County" comic strip ) On

Re: [R] Labelling a fortified GADM map plotted with ggplot and geom_map

2018-03-19 Thread Bert Gunter
The r-sig-geo list, https://stat.ethz.ch/mailman/listinfo/r-sig-geo is often a better place to post such geographically related queries. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (ak

Re: [R] Struggling to compute marginal effects !

2018-03-19 Thread Bert Gunter
You are more likely to get a useful answer if you read **and follow** the posting guide linked below. In particular, show us the code that elicited the error. A small reproducible example would be even better, though may not be needed. Cheers, Bert Bert Gunter "The trouble with having an

Re: [R] Elements of Sets as dataframe column names

2018-03-19 Thread Bert Gunter
ld go about this. Effort would be required to climb the larning curve, but I suspect you would find it time well spent. 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 in hi

Re: [R] Sum of columns of a data frame equal to NA when all the elements are NA

2018-03-21 Thread Bert Gunter
is documented, which it is, I don't care. 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 in his "Bloom County" comic strip ) On Wed, Mar 21, 2018 at 10:26

Re: [R] Plotting Notched Box Plots Log Scale - Losing bottom portion of box plot

2018-03-21 Thread Bert Gunter
tive values. Limiting the y range can't help: the notches can't be plotted on a log scale. 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 in his "Bloom County"

Re: [R] How do I include a factor in a groupedData object? Meaning and use of inner and outer parameters

2018-03-22 Thread Bert Gunter
r-sig-mixed-models is likely to be a better list for such queries. 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 in his "Bloom County" comic strip ) On Thu, Mar

Re: [R] adjusted values

2018-03-22 Thread Bert Gunter
Tis list is about R programming issues; statistical questons are generally OT. The r-sig-mixed-models list would be a much better place to post your queries. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it.&quo

Re: [R] MCMCglmm multinomial model results

2018-03-24 Thread Bert Gunter
Does not the sum of probabilities (on the untransformed scale) = 1, whence only 4 outcome categories to predict? 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 in his &qu

Re: [R] Take average of previous weeks

2018-03-25 Thread Bert Gunter
5.00 6.67 8.00 9.00 > rowMeans(m[,1:2]) ## means of previous 2 [1] NA NA 2.0 4.0 6.0 7.5 8.5 9.5 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] Take average of previous weeks

2018-03-26 Thread Bert Gunter
The row means **are** new variables and can be put wherever you like. But all columns in a data frame **must** have the same number of rows, so you'll have to fill in missing values as appropriate. That's where you need to "adjust as necessary to your needs." -- Bert Bert

Re: [R] Creating the right table from lapply list

2018-03-28 Thread Bert Gunter
further detail to get useful help. Or wait for someone smarter to reply. 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 in his "Bloom County" comic strip ) On

Re: [R] Is it good practice to have a package depend on Rtools(for unziping of .7z and.rar files)? Crab legal?

2018-03-29 Thread Bert Gunter
r-package-devel is the right mailing list for your query, not here. 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 in his "Bloom County" comic strip ) On Thu,

Re: [R] PCA with random effects

2018-04-02 Thread Bert Gunter
reply here. 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 in his "Bloom County" comic strip ) On Mon, Apr 2, 2018 at 3:43 PM, David Sidhu wrote: > I have the re

Re: [R] parfm unable to fit models when hazard rate is small

2018-04-04 Thread Bert Gunter
Possible hint: 1. Look at the error message. 2. > 1/0 [1] Inf 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 in his "Bloom County" comic strip ) On Wed,

Re: [R] How to script the script sample into script "OR", please advice

2018-04-08 Thread Bert Gunter
instructions for providing a small reproducible example. 3. Search! e.g. on the rseek.org site, inputting "AUC" gave this, among others: https://www.r-bloggers.com/calculating-auc-the-area-under-a-roc-curve/ Cheers, Bert Bert Gunter "The trouble with having an open mind is that peo

Re: [R] Syntax roccomp-using R

2018-04-08 Thread Bert Gunter
ta and/or to do your "translation" work for you. -- 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 in his "Bloom County" comic strip ) On Sun, Apr 8, 2018

Re: [R] Question about subset

2018-04-08 Thread Bert Gunter
own subset version/method by making the trivial modification to that code. R is open source. Sometimes it's worthwhile to take advantage of this by making a simple modification to its code on your own before hunting for packages. Cheers, Bert Cheers, Bert Bert Gunter "The trouble with ha

Re: [R] linear regression with repeated measures

2018-04-09 Thread Bert Gunter
discussed. It sounds like you may also want to do some reading about mixed effects models to understand the issues involved, but as I found your post confusing, maybe I'm wrong about that. stats.stackexchange.com is another online venue for mostly statistics discussions. Cheers, Bert Bert G

Re: [R] convert numeric variables to factor

2018-04-09 Thread Bert Gunter
Just cast it! ?factor Bert Gunter "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, Apr 9, 2018 at 9:28 AM, Saif Tauheed wrote: > Dear Sir, &

Re: [R] convert numeric variables to factor

2018-04-09 Thread Bert Gunter
see also ?cut if this is what you mean. -- 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 in his "Bloom County" comic strip ) On Mon, Apr 9, 2018 at 9:28 AM, Saif Tauhee

Re: [R] iterative read - write

2018-04-17 Thread Bert Gunter
Suggestions? Yes. Don't do this. Instead, wrap your code in a function, use lapply() to apply it over your list of files, returning all results in one list, and then save the list in an .rdata file. Also, in future, please post in plain text, as html tends to get mangled on this plain text list

Re: [R] Removing columns from big.matrix which have only one value

2018-04-21 Thread Bert Gunter
Maybe base R's unique() function might be useful? It uses hashing I believe. Bert On Sat, Apr 21, 2018, 12:17 PM Jack Arnestad wrote: > I have a very large binary matrix, stored as a big.matrix to conserve > memory (it is over 2 gb otherwise - 5 million columns and 100 rows). > > r <- 100 > c

Re: [R] How to visualise what code is processed within a for loop

2018-04-30 Thread Bert Gunter
these are interfaces to C language code, and so are probably much more efficient than anything you (or I) can do at the R level. Of course, if this is mainly a programming exercise for you, than this is largely irrelevant. Cheers, Bert Bert Gunter "The trouble with having an open mind

Re: [R] Specifying priors in a multi-response MCMCglmm

2018-05-01 Thread Bert Gunter
yet more irreproducible psychological research. 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 in his "Bloom County" comic strip ) On Tue, May 1, 2018 at 2:15 PM, M

Re: [R] Calling the curve function with a character object converted into an expression

2018-05-02 Thread Bert Gunter
o work for any text. curve(myf, from = 0, to = 10) ## myf is now the name of a function that executes the parsed text. *** I would appreciate any wiser R programmers correcting any misunderstanding or error in my explanation *** Cheers, Bert Bert Gunter "The trouble with having an

Re: [R] Calling the curve function with a character object converted into an expression

2018-05-02 Thread Bert Gunter
Typo: should be NULL not NUL of course An alternative approach closer to your original attempt is to use do.call() to explicitly evaluate the expr argument: w <- "1 + x^2" do.call(curve, list(expr = parse(text = w), ylab ="y")) Cheers, Bert Bert Gunter "The trouble

Re: [R] MCMCglmm - metric of the estimates

2018-05-03 Thread Bert Gunter
The r-sig-mixed-models list would be a better place for this post if you do not get an answer here. 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 in his "Bloom Coun

Re: [R] adding overall constraint in optim()

2018-05-03 Thread Bert Gunter
e r-sig-finance list might be a better place for you to post your query. 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 in his "Bloom County" comic strip ) On Thu, May

Re: [R] Package for Molecular Properties

2018-05-04 Thread Bert Gunter
... In addition, you may wish to also post on the Bioconductor list for this sort of thing. -- 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 in his "Bloom County" comic str

Re: [R] Regression model fitting

2018-05-04 Thread Bert Gunter
These is essentially a statistical question, which are generally consider off topic here. So you may not get a satisfactory reply. stats.stackexchange.com is probably a better venue for your post. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming

Re: [R] Discovering patterns in textual strings

2018-05-04 Thread Bert Gunter
that I've missed. You may also find it useful to check this "task view" out for possibilities: https://cran.r-project.org/web/views/NaturalLanguageProcessing.html Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking

Re: [R] Discovering patterns in textual strings

2018-05-05 Thread Bert Gunter
: > pats [1] "abc" "abcd" "e""f" This gives you the four separate patterns that you could then use to group your records, perhaps by: > lapply(pats,function(x)grep(paste0("^", x,"([_. ]|$)"), z)) [[1]] [1] 1 2 3 4 [[2]] [1] 5 6

Re: [R] Discovering patterns in textual strings

2018-05-05 Thread Bert Gunter
;abcd", "e","f") ## Create vector of patterns of same length as z, many of which are repeated > pats <- sub("^(.+)[. _].*","\\1",z) ## Now can use tapply() to get indices if desired ## Note that the patterns label the groups > tapply(seq_a

Re: [R] Adding Year-Month-Day to X axis

2018-05-05 Thread Bert Gunter
. 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 in his "Bloom County" comic strip ) On Sat, May 5, 2018 at 11:14 AM, Gregory Coats wrote: > I am using R 3.5.0 for

Re: [R] read.csv and Decimal places

2018-05-07 Thread Bert Gunter
mmary(), plot() etc. -- 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 in his "Bloom County" comic strip ) On Mon, May 7, 2018 at 9:10 AM, Richard M. Heiberger wrote: >

Re: [R] Installing required packages with an R package

2018-05-07 Thread Bert Gunter
This is better posted on the R-packages mailing list, not here. 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 in his "Bloom County" comic strip ) On Mon, May

Re: [R] Installing required packages with an R package

2018-05-07 Thread Bert Gunter
Thanks, Jeff. I stand corrected. -- 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 in his "Bloom County" comic strip ) On Mon, May 7, 2018 at 12:22 PM, Jeff Newmiller

Re: [R] Discovering patterns in textual strings

2018-05-07 Thread Bert Gunter
You seem to be using semantics to make your choices, not merely rules-based patterns. But in any case, I cannot help. Perhaps someone else with more experience at this sort of thing or who is smarter can. -- Bert Bert Gunter "The trouble with having an open mind is that people keep c

Re: [R] Request for information

2018-05-08 Thread Bert Gunter
See here: https://cran.r-project.org/web/views/MachineLearning.html Also search! e.g. at rseek.org ... 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 in his "Bloo

Re: [R] Bilateral matrix

2018-05-08 Thread Bert Gunter
or in base R : ?xtabs?? as in: xtabs(~previous_location + current_location,data=x) (You can convert the 0s to NA's if you like) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Be

Re: [R] Average of results coming from B=100 repetitions (looping)

2018-05-08 Thread Bert Gunter
essage: In mean.default(z) : argument is not numeric or logical: returning NA > class(z) [1] "list" > z <- unlist(z) > mean(z) [1] 3 Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it.&qu

Re: [R] Systemfit

2018-05-10 Thread Bert Gunter
y to get useful answers if you follow the guidelines of this list -- which also means that you should post in **plain text,** not HTML, which often gets mangled by the list server. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sti

Re: [R] Tackling of convergence issues in gamlss vs glm2

2018-05-10 Thread Bert Gunter
references (which I have obviously not). You might also check the package code, though this often leads to C code resources, which is kinda tough. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkele

Re: [R] the first name of the first column

2018-05-10 Thread Bert Gunter
936 12 Perhaps you neeed to spend time with an R tutorial that covers indexing of data frames and matrices, an absolutely basic R operation? (I am not clear from your question if this is your problem). Cheers, Bert Bert Gunter "The trouble with having an open mind is that peopl

Re: [R] the first name of the first column

2018-05-10 Thread Bert Gunter
o get rid of the column names: > dimnames(md)[[2]] <- NULL > md [,1] [,2] [,3] [,4] [1,] 8.36 0.44 6.90 0.50 [2,] 8.78 0.58 21.16 0.24 [3,] 16.52 2.28 27.58 0.80 [4,] 42.22 14.22 34.70 31.90 Bert Gunter "The trouble with having an open mind is that people k

Re: [R] add one variable to a data frame

2018-05-11 Thread Bert Gunter
s no need for this at all. 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 in his "Bloom County" comic strip ) On Fri, May 11, 2018 at 11:39 AM, Sarah Goslee wrote:

Re: [R] Systemfit

2018-05-15 Thread Bert Gunter
Unless there is good reason not to, always cc the list -- there are lots of smarter folks than I on it who can help. I may or may not have time to look at this. Hopefully someone else will. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sti

Re: [R] Bilateral matrix

2018-05-16 Thread Bert Gunter
1 1 1 e 1 1 0 > lvls <- sort(union(x,y)) > x <- factor(x, levels = lvls) > y <- factor(y, levels = lvls) > xtabs( ~ x + y) y x a b c d e a 0 0 1 0 0 b 0 0 0 0 1 c 0 0 1 0 0 d 0 0 1 1 1 e 0 0 1 1 0 Cheers, Bert Bert Gunter "The trouble with having an open

Re: [R] Raster extract by polygon generating NAs

2018-05-16 Thread Bert Gunter
Better posted on the r-sig-geo list, I think. -- 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 in his "Bloom County" comic strip ) On Wed, May 16, 2018 at 8:11 AM, J

Re: [R] exclude

2018-05-17 Thread Bert Gunter
6 15 NY 50 51 57 98 183 230 > ## for counts just do: > xtabs( ~ stat + year, data = tdat[tdat$stat %in% keep, ]) year stat 2003 2004 2006 2007 2009 2010 AL211111 NY111 223 Cheers, Bert Bert Gunter "The trouble wi

Re: [R] exclude

2018-05-17 Thread Bert Gunter
eers, 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 in his "Bloom County" comic strip ) On Thu, May 17, 2018 at 7:15 PM, Val wrote: > Thank you Bert and Jim, > Jim, FYI

Re: [R] Split a data.frame

2018-05-19 Thread Bert Gunter
... yes, but note that: which(data[[col]] %in% s can be replaced directly by match: match(data[[col]], s) Corner cases (nothing matches, etc.) would also have to be checked and probably should sort the matched row numbers for safety. Cheers, Bert Bert Gunter "The trouble with having an

Re: [R] Scale

2018-05-20 Thread Bert Gunter
You can draw your own axes. Set las =1. See ?par plot(survfit(Y~addicts$clinic), fun="cloglog", las=1) 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 in his

Re: [R] Plot qualitative y axis

2018-05-21 Thread Bert Gunter
See ?barplot and set the horiz argument to TRUE. (This is in the base R plotting version. The ggplot2 and lattice systems have other ways of doing this) Note: if you search on e.g. "barplots in R" or similar, you should find numerous examples with code. Cheers, Bert Bert Gu

Re: [R] draw borders of bars inside of the rectangles in a barplot

2018-05-21 Thread Bert Gunter
=T, border= "black", space=c(0.08,1), col=rep(c('gray50', 'white'),5)) instead. 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 in his "Bloom

Re: [R] mapping groups of states without interior borders

2018-05-21 Thread Bert Gunter
Bert Gunter "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 21, 2018 at 10:02 AM, Simon, Heather wrote: > I have been using the "

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
Others may have greater insight, but my response is: Exactly what did or didn't happen that makes you say the code didn't work? That is, what did or didn't you get when you ran it compared to your expectations? Cheers, Bert Bert Gunter "The trouble with having an open mind

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
k down how exactly. Your tryCatch call seems to be fine, however. -- 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 in his "Bloom County" comic strip ) On Tue, May 22, 2

Re: [R] Using tryCatch in a for loop

2018-05-22 Thread Bert Gunter
r function should be: function(w) {"somestuff"} not function(w) {cat("somestuff")} As usual, apologies if I have misunderstood. Caveat emptor. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -

Re: [R] Trouble building R 3.5.0 under Ubuntu 18.04

2018-05-22 Thread Bert Gunter
case that might help. 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 in his "Bloom County" comic strip ) On Tue, May 22, 2018 at 3:47 PM, Steve Gutreuter wrote

Re: [R] coef does not work for my ASReml model

2018-05-23 Thread Bert Gunter
?str str(cov.asr2) Does not: coefs(fcov.asr2) give you what you want ? --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 in his "Bloom County" comic strip ) On Tue, M

Re: [R] Manipulation of data.frame into an array

2018-05-24 Thread Bert Gunter
5 [14,]216 [15,]107 [16,]218 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 in his "Bloom County" comic strip ) On Thu, May

Re: [R] Predictions from a Cox model - understanding centering of binary/categorical variables

2018-05-24 Thread Bert Gunter
satisfactory response here). 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 in his "Bloom County" comic strip ) On Thu, May 24, 2018 at 8:56 AM, Bonnett, Laura wrote

Re: [R] how to make the code more efficient using lapply

2018-05-25 Thread Bert Gunter
many of us means greater code clarity. 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 in his "Bloom County" comic strip ) On Fri, May 25, 2018 at 9:09 AM, MacQueen

Re: [R] update.packages() after updating R version

2018-05-26 Thread Bert Gunter
n will only allow it if all the packages to be updated are in a single library, when that library will be used." -- 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 in his "

Re: [R] help on the R package Softmaxreg

2018-05-28 Thread Bert Gunter
... who can be found by R's ?maintainer function. A web search on "R softmaxreg package" also seemed to bring up relevant info. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka

Re: [R] How to generate a conditional dummy in R?

2018-05-28 Thread Bert Gunter
up with to clarify your meaning. Or continue to wait for someone smarter to respond. 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 in his "Bloom County" comic strip ) O

Re: [R] aggregate and list elements of variables in data.frame

2018-06-07 Thread Bert Gunter
which() is unnecessary. Use logical subscripting: ... t$id[t$A ==x] Further simplification can be gotten by using the with() function: l <- with(t, sapply(unique(A), function(x) id[A ==x])) Check this though -- there might be scoping issues. Cheers, Bert On Thu, Jun 7, 2018, 6:49 AM Massimo

Re: [R] Calculate focal values for neighboring cells that are located at the raster edge from the function "focal" in the R package "raster"

2018-06-08 Thread Bert Gunter
The r-sig-geo list is often a better place to post for such "geographically" related questions, especially if you don't get a helpful response here. But R is open source, so typing raster:::focal at the command line prompt will show you the function code if it is written in R. Whether that is

<    1   2   3   4   5   6   7   8   9   10   >