Re: [R] distribution freq

2016-02-26 Thread Duncan Murdoch
ant the density, you want differences in the cumulative probability. So if your class runs from 4 to 8 cm, use something like pgamma(8, shape, rate) - pgamma(4, shape, rate) or the equivalent but a little obscure diff(pgamma(c(8, 4), shape, rate)) Duncan Murdoch P.S. Please keep discussion on t

Re: [R] formatting expressoion(paste with line shift

2016-02-26 Thread Duncan Murdoch
On 26/02/2016 7:37 AM, Duncan Murdoch wrote: On 26/02/2016 7:08 AM, Troels Ring wrote: (pHi <- seq(1,8)) #This gets formatted well but I want subscript for 2 in pCO2 plot(pHi,type="s",axes=FALSE,xlab="",lwd=4, main=paste("Theoretical experiment using SID = 0

Re: [R] distribution freq

2016-02-26 Thread Duncan Murdoch
have a huge interval from 96 fo 4. If I put diff(pgamma(c(96,8), shape, rate)) I obtaining the same values for all classes. Please post some sample data and the calculations you're trying to do. (And please try to post in plain text; code tends to be unreadable if posted in HTML.) D

Re: [R] Annoying startup error message

2016-02-26 Thread Duncan Murdoch
space. Duncan Murdoch Sarah On Fri, Feb 26, 2016 at 12:01 PM, Lars Bishop wrote: > Thank you Ulrik. I actually don't want to install SparkR, just don't want > to have that error message when R starts. For some reason, R is trying to > load the package every time it sta

Re: [R] Annoying startup error message

2016-02-26 Thread Duncan Murdoch
uot;/Users/lars/Downloads/spark-1.6.0-bin-hadoop2.6/bin/spark" Sys.unsetenv("SPARK_HOME") Sys.getenv("SPARK_HOME") [1] "" R doesn't look at that variable, so that would not be the cause. Duncan Murdoch Thanks again for you help! Lars. On Fri, Feb 26,

Re: [R] Version 3.2.3: package not available error with https

2016-02-29 Thread Duncan Murdoch
build, e.g. possibly an out of date or missing libcurl. What does capabilities("libcurl") say? Duncan Murdoch Warning message: package ‘RCurl’ is not available (for R version 3.2.3) If I choose the menu entry "(HTTP mirrors)" I get the list of HTTP mirrors with which I am

Re: [R] Functional programming?

2016-03-02 Thread Duncan Murdoch
On 02/03/2016 11:47 AM, Roger Koenker wrote: I have a (remarkably ugly!!) code snippet (below) that, given two simple functions, f and g, generates a list of new functions h_{k+1} = h_k * g, k= 1, …, K. Surely, there are vastly better ways to do this. I don’t particularly care about the ret

Re: [R] specify size of box around legend

2016-03-11 Thread Duncan Murdoch
and L 3 have the same height? You can add blank entries as fillers to L 1. Duncan Murdoch __ 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://w

Re: [R] specify size of box around legend

2016-03-11 Thread Duncan Murdoch
On 11/03/2016 9:50 AM, Rainer M Krug wrote: Duncan Murdoch writes: > On 11/03/2016 9:01 AM, Rainer M Krug wrote: >> Hi >> >> assume the following code: >> >> --8<---cut here---start->8--- >> plot(1,1) >> leg

Re: [R] Utils - View mode - Filter

2016-03-13 Thread Duncan Murdoch
ould expect it to work with another system, such as the host MacOS. I wouldn't be surprised if View() used to run something like edit(). So the OP and David should update their RStudio. Duncan Murdoch __ R-help@r-project.org mailing list -- To

Re: [R] doubt clarification

2016-03-15 Thread Duncan Murdoch
e(all.2015$Day, "%d-%m-%y") (and be careful of the quotes: these are regular ASCII quotes, not directional quotes which some editors will insert). Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://s

Re: [R] Truncated file upon reading a text file with 0xff characters

2016-03-15 Thread Duncan Murdoch
it the tests to readLines; read.table is much more complicated, and isn't necessary to illustrate the problem. It just confuses things by bringing it into the discussion. You should also avoid bringing text mode connections into the discussion unless they are necessary. Duncan Murdoc

Re: [R] Persistent state in a function?

2016-03-19 Thread Duncan Murdoch
x <- sample(1:3, 2) print(sprintf("d(%d, %d) = %f", x[1], x[2], myDist(x[1], x[2]))) } Use local() to create a persistent environment for the function. For example: f <- local({ x <- NULL function(y) { cat("last x was ", x, "\n&qu

Re: [R] How to reach the column names in a huge .RData file without loading it

2016-03-19 Thread Duncan Murdoch
d recommend if I wanted a portable textual format. JSON is close, but it can't handle the full range of data that R can handle (e.g. no Inf). dput() on a dataframe is text, but nothing but R can read it. Duncan Murdoch Best regards, Jan P.S.: I've seen .RData images containing many

Re: [R] Please guide -- Error during export in csv format

2016-03-21 Thread Duncan Murdoch
y.file1, row.names = F) The and similar strings represent Unicode characters. I would guess that they are being translated to the format before being used as a filename, and the < and > symbols are not allowed in filenames in Windows. This is a limitation of the way R handles

Re: [R] Persistent state in a function?

2016-03-21 Thread Duncan Murdoch
environment remains as the environment of f That's not quite the jargon we use. The environment of g would probably be the global environment. The thing that gets left behind is the evaluation frame (or environment) of the call g(). Its parent environment is the environment of g. Dunca

Re: [R] R studio kniter

2016-03-22 Thread Duncan Murdoch
I would write something like this: knit("texfile.rnw") That exact command works. It will produce a .tex file; if you want to continue on to produce a PDF, you need knit2pdf("texfile.rnw") instead. Duncan Murdoch __ R-help@r-pr

Re: [R] adding points in plot loop

2016-03-23 Thread Duncan Murdoch
m; if later points fall outside the plot area, they won't be shown. So you may need to work out xlim and ylim in advance. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listin

Re: [R] How to make a function aware of its own call arguments

2016-03-24 Thread Duncan Murdoch
Are you aware of any function what would query the original function call arguments no matter what happens in the function? The match.call() function does that, but I think you don't need that: f <- function(x = 1, ...) { x <- 2 match.call() } f(3) ## Prints: f(x = 3) Duncan Murdoch

Re: [R] Fwd: question on constrOptim

2016-03-24 Thread Duncan Murdoch
out the problem, simplify things enough to post to R-help, and post it there. It needs to be in a form that someone else can run. (Don't email it just to me, send it to the list.) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] R logo size in package information tab of Rstudio

2016-03-29 Thread Duncan Murdoch
hy is RStudio relevant here? I don't think RStudio does anything with the R help files other than to display them in its built-in browser. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailma

Re: [R] Accented characters, windows

2016-03-29 Thread Duncan Murdoch
to stop using Windows. At some point in the future the internal character handling in R needs an overhaul, but that's a really big, really thankless job. Perhaps Microsoft/Revolution will donate some programmer time to do it, but more likely, it will w

Re: [R] R logo size in package information tab of Rstudio

2016-03-30 Thread Duncan Murdoch
x27;re using an older version of it). I'm not completely up to date on RStudio, so it may be that you can fix it by updating. I've bcc'd support at RStudio to let them know about this; not sure if that will get through. Duncan Murdoch _

Re: [R] p values from GLM

2016-04-01 Thread Duncan Murdoch
mary(fitwean) give a matrix? Then it's colnames(summary(fitwean)$coefficients) you want, not names(fitwean). Duncan Murdoch P.S. If you had given a reproducible example, I'd try it myself. > > Thank you! > John > > John David Sorkin M.D., Ph.D. > Professor of Medicine &g

Re: [R] p values from GLM

2016-04-01 Thread Duncan Murdoch
On 01/04/2016 6:46 PM, Bert Gunter wrote: ... of course, whether one **should** get them is questionable... They're just statistics. How could it hurt to look at them? Duncan Murdoch http://www.nature.com/news/statisticians-issue-warning-over-misuse-of-p-values-1.19503#/ref-l

Re: [R] Extending the beta period for R 3.3.0 till April 25, Final release on May 3

2016-04-04 Thread Duncan Murdoch
://cran.rstudio.com/bin/windows/base/rtest.html Duncan Murdoch ___ r-annou...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] Fwd: as.Date gives NAs when transforming from factor

2016-04-05 Thread Duncan Murdoch
robably want a$Date <- as.Date(a$Date, format = "%d/%m/%Y") Duncan Murdoch Posible Solutions: I’ve read here that it has to do with the Sys Locale, and the solution was using: “LC_TIME”, “C”. But I didn’t have success. http://stackoverflow.com/questions/15566875/as-date-retu

Re: [R] File 1 is not in sorted order Error

2016-04-05 Thread Duncan Murdoch
Thanks in advance. Set the environment variable LC_COLLATE equal to C. Some parts of the R build system do this, and some parts use your locale's collation sequence. You need to make sure they're all consistent. Duncan Murdoch __ R-help@r-projec

Re: [R] HTML help -- as a single document for the entire package

2016-04-06 Thread Duncan Murdoch
window size - no page breaks - full text search across the entire manual. No, there isn't. Duncan Murdoch __ 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

Re: [R] HTML help -- as a single document for the entire package

2016-04-06 Thread Duncan Murdoch
ed to loop over all of them; it would also need to handle links between topics differently than it currently does, because some of them would be internal links, others would be external. The source for the function is in https://svn.r-project.org/R/trunk/src/library/tools/R/Rd2HTML.R. Duncan Mu

Re: [R] Question about R Ver.2.7.2 compatible with JAVA 8

2016-04-07 Thread Duncan Murdoch
JAVA 8? R 2.7.2 is very old --- it was released nearly 8 years ago. I think you're going to have to do the testing yourself, unless you're very lucky that someone remembers. Duncan Murdoch Regards Thirumurugan Rajamoorthy |thirumurugan.rajamoorthy...@ots

Re: [R] R.squared in summary.lm with weights

2016-04-08 Thread Duncan Murdoch
re expecting consistency where there needn't be any. Why do you see an inconsistency here? Those are different calculations. You get expressions like these if you assume observations have variance sigma^2/w, and you're trying to estimate sig

Re: [R] [FORGED] Re: identical() versus sapply()

2016-04-09 Thread Duncan Murdoch
If you want it as floating point, write it as 1. Duncan Murdoch __ 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-gu

Re: [R] Arguments to utils:::menuInstallPkgs

2016-04-09 Thread Duncan Murdoch
using winMenuAddItem). Duncan Murdoch For example: > utils:::menuInstallPkgs(loc=.libPaths()[2]) > utils:::menuInstallLocal(loc=.libPaths()[2]) Thanks, ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefon

Re: [R] How to print the graphs in landscape/portrait orientation

2016-04-09 Thread Duncan Murdoch
code unusable. - Do post self-contained examples. Even if I spent the time to edit your post into something I could run, it would fail, because I don't have copies of all the variables it uses. Duncan Murdoch __ R-help@r-project.org mailing list -

Re: [R] what is the faster way to search for a pattern in a few million entries data frame ?

2016-04-10 Thread Duncan Murdoch
ny good article/blogs or suggestion that can give me some guidance ? Didn't you post the same question yesterday? Perhaps nobody answered because your question is unanswerable. You need to describe what the strings are like and what the patterns are like if you want advice

Re: [R] [FORGED] Re: identical() versus sapply()

2016-04-11 Thread Duncan Murdoch
erformance is not always simple and easy to predict, but I think anyone who had experience with R would never use as(x, "numeric"). So this just isn't a problem worth fixing. Now, you might object that the documentation claims they are equivalent, but it certainly doesn't. T

Re: [R] [FORGED] Re: identical() versus sapply()

2016-04-11 Thread Duncan Murdoch
function'. That is different than saying 'as(x, "numeric") is the same as as.numeric(x)'. Duncan Murdoch I understand that it is challenging to write docs that are both clear and accurate; but I hope that is always the goal. Cheers, Bert Bert Gunter "The troub

Re: [R] formula argument evaluation

2016-04-12 Thread Duncan Murdoch
aluating it. It is not a legal R statement, so the parser signals an error. If you want to pass arbitrary strings to a function, you need to put them in quotes. Duncan Murdoch The addition sign "+" hasn't been evaluated, and I was hoping the "=" would not get

Re: [R] [FORGED] Re: [FORGED] Re: identical() versus sapply()

2016-04-12 Thread Duncan Murdoch
On 11/04/2016 11:34 PM, Rolf Turner wrote: On 12/04/16 14:45, Duncan Murdoch wrote: On 11/04/2016 10:18 PM, Bert Gunter wrote: "The documentation aims to be accurate, not necessarily clear." !!! I hope that is not the case! Accurate documentation that is confusing is not very u

Re: [R] Documentation: Was -- identical() versus sapply()

2016-04-12 Thread Duncan Murdoch
al version and commit it. I'll volunteer to participate in the approval and committing stage, but at first only for pages that I authored. If it turns out to be an efficient way to improve docs, then I'd consider other pages too. Duncan Murdoch ___

Re: [R] Documentation: Was -- identical() versus sapply()

2016-04-12 Thread Duncan Murdoch
On 12/04/2016 12:44 PM, David Winsemius wrote: > On Apr 12, 2016, at 8:31 AM, Sarah Goslee wrote: > > I am very interested in such a distributed documentation editing > project, and have some thoughts on how to make it workable for both > volunteers and core members who would need to review. > >

Re: [R] Documentation: Was -- identical() versus sapply()

2016-04-12 Thread Duncan Murdoch
ask if there are interested people and see what can be done about getting a framework set up to work on one of those documents. JN On 16-04-12 10:52 AM, Duncan Murdoch wrote: > On 12/04/2016 9:21 AM, ProfJCNash wrote: >> >>>> "The documentation aims to be accurate, n

Re: [R] Bug in by() function which works for some FUN argument and does not work for others

2016-04-15 Thread Duncan Murdoch
rizzo/Rx/Rx-errata.txt. They corrected "mean" to "colMeans". Duncan Murdoch by(data=brain[, -1], INDICES=brain$Gender, FUN=mean, na.rm=TRUE) brain$Gender: Female FSIQ VIQ PIQ Weight Height MRI_Count 111.900 109.450 110.450 137.200 65.765 862654.600

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Duncan Murdoch
in the third by taking the 2nd of a 4 colour palette, so x # gets twice the weight colorRampPalette(c(x, "#00"), space = "Lab")(4)[2] Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https:/

Re: [R] Mean of hexadecimal numbers

2016-04-16 Thread Duncan Murdoch
On 16/04/2016 12:33 PM, Atte Tenkanen wrote: Hm..., Should these two versions produce the same solution? I wouldn't expect them to. Duncan Murdoch Unfortunately and shame to confess, I don't know much about the colors in R: myColors <- c("#FF7C00","#00BF4

Re: [R] Merge sort

2016-04-19 Thread Duncan Murdoch
odify the x1 and x2 vectors, and I'd pre-allocate result to the appropriate length, rather than growing it in the while loop. But that was a different class! Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

Re: [R] Merge sort

2016-04-20 Thread Duncan Murdoch
. "Avoided" may be too strong: speed isn't always a concern, sometimes clarity is more important. Growing vectors is definitely expensive. Duncan Murdoch Thank you for your help! On 04/19/2016 11:51 PM, Duncan Murdoch wrote: On 19/04/2016 3:39 PM, Gaston wrote: Hello

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

2016-04-24 Thread Duncan Murdoch
no current affiliation By far the easiest ways to enter Windows file paths are using the file.choose() and choose.files() functions. Do something like filename <- file.choose() # navigate to the file mammals <- read.csv(filename) and you should be fine. The file.choose() function works on all p

Re: [R] 3D surface plot

2016-05-03 Thread Duncan Murdoch
x, y, labels, colours, etc. Duncan Murdoch Furthermore, I think I have to create a matrix using the formula above but I do not know how to do that in this connection. Can any body help me with the code for this purpose? Thanks a lot in advance. __

Re: [R] expression input to a function

2016-05-04 Thread Duncan Murdoch
ent from the actual function name, but it'll be fine in practice). It is also possible to pass expressions that aren't in functions, but it gets tricky, and you shouldn't do that in your first attempt. Duncan Murdoch __ R-help@r-project.

Re: [R] Antwort: Re: Re: sink(): Cannot open file

2016-05-10 Thread Duncan Murdoch
ackslash should be doubled (so it isn't interpreted as an escape for the "m" that follows it), or replaced with a forward slash. Duncan Murdoch R code goes here sink() with the expectation that I would create a file myfile.txt that would contain the output of my R program.

Re: [R] how to manipulate ... in the argument list

2016-05-11 Thread Duncan Murdoch
mmend a different pattern, i.e. include breaks as an argument, and possibly use is.missing(breaks) to determine when it has not been used. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/l

Re: [R] changing factor to numbers without getting NAs

2016-05-13 Thread Duncan Murdoch
ter(df$TSTMean), dec = ",", as.is = TRUE) instead of as.numeric(). A simpler approach might be to avoid getting the factor in the first place; if you read this data using read.table, there is the dec option to recognize a comma as the decimal separator. Duncan Murdoch __

Re: [R] problem with matrix

2016-05-16 Thread Duncan Murdoch
t just the three values over (or under) the diagonal and convert them in a vector like this: 45, 63.43495, 90 ? Thank's in advance See ?upper.tri. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.

Re: [R] RSTUDIO keeps crashing-please help me

2016-05-19 Thread Duncan Murdoch
here. If they do happen in plain R, try running with the --vanilla option. If that is fine, the problem is probably something you have in your saved workspace, or in one of the startup files. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUB

Re: [R] x-axis tick marks on log scale plot

2016-05-19 Thread Duncan Murdoch
7;ll get labels at some of those locations; R will leave some out, if it looks as though the labels will overlap. Using las=2 will make them perpendicular to the axis, and all should be drawn. Duncan Murdoch __ R-help@r-project.org mailing list -- To

Re: [R] Error creating named character vectors from column names in data frame.

2016-10-07 Thread Duncan Murdoch
ing) if it just refused to accept "a" where a name is needed, but at the time this was written, there was no other way to express a name that was syntactically a name, e.g. "bad name". Later the `bad name` notation was added, and it makes more

Re: [R] bquote in list to be used with do.plot()

2016-10-08 Thread Duncan Murdoch
solution? (I tries also with substitute() and expression() but I fail also) This seems to work: L <- list(x=1, y=1, ylab=bquote(expression(.(format(scaleY), scientific=FALSE)^"-1"))) do.call(plot, L) Duncan Murdoch __ R-help@r-pro

Re: [R] Opening or activating a URL to access data, alternative to browseURL

2016-10-11 Thread Duncan Murdoch
suggested the other day. What went wrong for you? Duncan Murdoch #1 browseURL('http://pick18.discoverlife.org/mp/20m?plot=2&kind=Hypoprepia+fucosa&site=33.9+-83.3&date1=2011,2012,2013&flags=build_txt: <http://pick18.discoverlife.org/mp/20m?plot=2&kind=H

Re: [R] can we visualize water flows with 3d in R?

2016-10-12 Thread Duncan Murdoch
lot3d to show spheres with radius depending on the flow rate, for example plot3d(cbind(long, lat, depth), type="s", col="blue", radius=flow/5) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see htt

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Duncan Murdoch
100 units also matters in my experiment. Any help would be greatly appreciated. I would simply rescale one row and add a second axis. For example, if d holds your matrix: scale <- max(d[1,])/max(d[2,]) adjusted <- d adjusted[2,] <- scale*adjusted[2,] barplot(adjusted, bes

Re: [R] barplot beside=TRUE - values differ on scales

2016-10-12 Thread Duncan Murdoch
e any transformation you like, not just a rescaling. If you want -2 for the 2nd row to be the same as 0 on the first row, just work out the transformation that achieves that, and use it. Duncan Murdoch thanks Adrian On Wed, Oct 12, 2016 at 12:42 PM, Duncan Murdoch wrote: > On 12/10/2016 12:20 PM

Re: [R] Visibility of libraries called from within functions

2016-10-13 Thread Duncan Murdoch
otation to get functions without putting them on the search list. For example, use xlsx::write.xlsx(data, file) If you are not sure if your user has xlsx installed, you can use requireNamespace() to check. Duncan Murdoch __ R-help@r-project.o

Re: [R] Antwort: Re: Visibility of libraries called from within functions

2016-10-13 Thread Duncan Murdoch
not loaded, the package will be loaded to make the call. So you don't need the requireNamespace call if you can be sure that xlsx will be found. You would normally use its return value (FALSE if the package is not found) to test whether it will be safe to make the xlsx::read.xlsx call. D

Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Duncan Murdoch
, there is also a QGIS plugin module that can do this, I believe. These software packages do facilitate representing the flow in 3D. Do you know any sample figures online that would show the type of graph that is usually used here? Duncan Murdoch Tom On Wed, Oct 12, 2016 at 6:12 PM,

Re: [R] can we visualize water flows with 3d in R?

2016-10-13 Thread Duncan Murdoch
up to Marna to say whether any of those figures are like what she wants to produce from her data. Duncan Murdoch Best, Tom On Thu, Oct 13, 2016 at 9:20 AM, Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: On 13/10/2016 8:35 AM, Thomas Adams wrote: All, Ver

Re: [R] Share R.net dll without having to share R script code?

2016-10-14 Thread Duncan Murdoch
t you share code of the original and your modifications. Duncan Murdoch __ 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/po

Re: [R] Difficulties with setting working directory

2016-10-15 Thread Duncan Murdoch
problem by asking R to make the change: setwd(choose.dir()) or setwd("a/specific/directory") Duncan Murdoch __ 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] tar()/untar() argument symmetry

2016-10-18 Thread Duncan Murdoch
On 18/10/2016 12:38 PM, Roebuck,Paul L wrote: Any reason untar() has an "exdir" argument (the equivalent of "tar -C"), but tar() does not? Because you can specify the source directory in the files argument using list.files(). There's no need to duplicate that i

Re: [R] rsync: failed to connect to cran.r-project.org (137.208.57.37): No route to host (113)

2016-10-19 Thread Duncan Murdoch
obably be fixed pretty quickly. However, it's now after office hours, so if the problem is actually in Vienna, it might not be fixed until tomorrow. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz

Re: [R] read.table() question

2016-10-19 Thread Duncan Murdoch
I don't get that from those 9 observations, so there's likely something else going on further down in the file. Try which(is.na(as.numeric(as.character(rain$station to find out which lines are causing problems for that column, and similarly for rain$amount. Duncan Murdoch

Re: [R] Using with() to avoid $ ?

2016-10-23 Thread Duncan Murdoch
ables. It would likely get very confused if there were two copies of them, one in one environment, one in another. So I'd advise to use one form or the other, i.e. don't use with(), or if you do, don't use data=. Duncan Murdoch Bert (But see inline below) On Oct 23,

Re: [R] Prevent a table from crossing page boundary using rmarkdown/pandoc

2016-11-03 Thread Duncan Murdoch
a float, LaTeX will try not to split it. You can do that by specifying the caption arg to kable(). I don't know if you can specify where the float appears or if you're stuck with the default. Duncan Murdoch In my report's context, the table is so short that breaking it acro

Re: [R] When customizing last line, the code stops working

2016-11-03 Thread Duncan Murdoch
of lapply() (or maybe of do.call()). Write the last line as union <- do.call(rbind, lapply(paste0("dt_sp_", 1:length(sp)), get, envir = environment())) and it works. Duncan Murdoch Thanks in advance for any help! Frank S. all.sp <- function(age.u, open, close) { requi

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread Duncan Murdoch
uot;1970-01-01". If James is using zoo his code would be okay. If he's not, he would have got an error, so I think he must have been. Duncan Murdoch Jim On Sun, Nov 6, 2016 at 12:10 PM, James Hirschorn wrote: This seemed odd so I wanted to check: > x <- foreach(i=1:1

Re: [R] Pesky file encoding problem

2016-11-06 Thread Duncan Murdoch
e behaviour.) So what you could do is something like this: crlf <- "\r\n" outfile = "output.arp" cat('Title="data"', crlf, file=outfile, append=FALSE) cat('DataType=DNA', crlf, file=outfile, append=TRUE) etc. Duncan Murdoch

Re: [R] AdehabitatHR Write Spatial Polygon Problem

2016-11-08 Thread Duncan Murdoch
re trying to export it, but you are creating a SpatialPoints object, and the error message says something wants a SpatialPolygonsDataFrame object. So you need to convert it. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and mor

Re: [R] Error in Summary.factor(c(24L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, :

2016-11-12 Thread Duncan Murdoch
, 34L, 35L, : ‘min’ not meaningful for factors You'll need to give a minimal reproducible example (i.e. something others can run, but not containing a lot of unnecessary stuff) if you want help with this. Duncan Murdoch __ R-help@r-projec

Re: [R] value matching %in% for a number pair

2016-11-12 Thread Duncan Murdoch
ist(c(3, 4), S) [1] FALSE Duncan Murdoch __ 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 commented

Re: [R] Error in Summary.factor(c(24L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, :

2016-11-12 Thread Duncan Murdoch
expression experiments using maSigPro program. Who but you can run this? We don't have "blood". Duncan Murdoch des_blood=make.design.matrix(blood, degree=11) On Sat, Nov 12, 2016 at 7:54 PM, Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: On 12/11/2016 7:33

Re: [R] Question about expression parser for "return" statement

2016-11-13 Thread Duncan Murdoch
- Mean)^2)/Variance)) Duncan Murdoch I'm guessing it is intentional; but since there is no warning about ignoring the rest of the expression, it could lead to hard-to-find bugs. Thanks, Dave Here's an example ... dnorm(2, 0, 1) normalDensityFunction = function(x, Mean, Variance) { #

Re: [R] Question about expression parser for "return" statement

2016-11-13 Thread Duncan Murdoch
On 13/11/2016 6:47 AM, Duncan Murdoch wrote: On 13/11/2016 12:50 AM, Dave DeBarr wrote: I've noticed that if I don't include parentheses around the intended return value for the "return" statement, R will assume the first parenthetical expression is the intended return va

Re: [R] Question about expression parser for "return" statement

2016-11-13 Thread Duncan Murdoch
On 13/11/2016 7:58 AM, Duncan Murdoch wrote: On 13/11/2016 6:47 AM, Duncan Murdoch wrote: On 13/11/2016 12:50 AM, Dave DeBarr wrote: I've noticed that if I don't include parentheses around the intended return value for the "return" statement, R will assume the first parenth

Re: [R] Question about expression parser for "return" statement

2016-11-14 Thread Duncan Murdoch
Sometimes it is fine to use return(x), but it shouldn't be used routinely. Duncan Murdoch -- Sent from my phone. Please excuse my brevity. On November 13, 2016 3:47:10 AM PST, Duncan Murdoch wrote: >On 13/11/2016 12:50 AM, Dave DeBarr wrote: >> I've noticed that i

Re: [R] Question about expression parser for "return" statement

2016-11-14 Thread Duncan Murdoch
tive for Research in Education http://www.ecu.edu/cs-acad/aa/StemCore East Carolina University Phone: 252-737-5229 On Sun, 2016-11-13 at 13:35 -0500, Duncan Murdoch wrote: On 13/11/2016 7:58 AM, Duncan Murdoch wrote: On 13/11/2016 6:47 AM, Duncan Murdoch wrote: On 13/11/2016 12:50 AM, Dave DeBarr wrote: I

Re: [R] for loop is looping only once

2016-11-17 Thread Duncan Murdoch
length(kpis) is zero. 1:0 is a length 2 vector, not a length 0 one.) Duncan Murdoch HTH Ulrik On Thu, 17 Nov 2016 at 12:18 wrote: Hi All, I need to execute a loop on variables to compute several KPIs. Unfortunately the for loop is executed only once for the last KPI given. The code below

Re: [R] Inconsistency of 1^NA=1 vs. 1.1^NA=NA

2016-11-17 Thread Duncan Murdoch
if there's only one possibility (as for example NA | TRUE gives TRUE). As far as I can see, 1 raised to any power (even infinite ones) should give 1, so the answer looks fine to me. That's not true of any of the other bases you mention (just as NA | FAL

Re: [R] Help with R

2016-11-19 Thread Duncan Murdoch
hope to talk to you all soon. You need to tell R where the "Seal_Island_Map.png" file is sitting. The "system.file(...)" call you used says it's a file in the "png" package, but it's not. The easiest way to find a file is to use the file.choose() func

Re: [R] browser() pre 3.1 behaviour

2016-11-23 Thread Duncan Murdoch
a loop is being executed (copy pasted to the R interface). This doesn't really parse for me. Could you please post detailed instructions for what you're doing and describe what you're seeing? Duncan Murdoch So I have to cancel this browser or confirm each iteration of the

Re: [R] Identifying Gender

2016-12-01 Thread Duncan Murdoch
recover it from the CRAN archive and see if you can get it to build. Look for it in <https://cran.r-project.org/src/contrib/Archive>. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/m

Re: [R] "Patched " version listed on CRAN mirrors is actually Oct RC version

2016-12-05 Thread Duncan Murdoch
has been released. Is there a real patched version somewhere? What URL are you using? The Windows binary at https://cloud.r-project.org/bin/windows/base/rpatched.html appears to be up to date. Duncan Murdoch David Watson NASA - MSFC Mail Code ES62 Phone 256-544-1300 FAX 256-544-2964

Re: [R] See section 'Good practice' in '?data'.

2016-12-10 Thread Duncan Murdoch
On 10/12/2016 10:13 AM, Witold E Wolski wrote: To which document "See section 'Good practice' in '?data'." refers too? It refers to the help page for the data() function, which you see by typing ?data in the console. Duncan Murdoch Found the following ca

Re: [R] Function implemented in R returns the wrong value

2016-12-11 Thread Duncan Murdoch
t you are using constructs like log(dnorm(x)) (e.g. log(phi_t0)) instead of dnorm(x, log = TRUE). The dnorm(x) value will underflow to zero, and taking the log will give you -Inf. Using the "log = TRUE" argument avoids the underflow. Duncan Murdoch rm(list=ls()) library(

Re: [R] Log plus one transformation in R

2016-12-13 Thread Duncan Murdoch
for log and log1p, R is open source, so you could, but those are likely coming from system libraries, so it isn't easy to see how the approximations are being done. Duncan Murdoch so I need to rely on the kindness of others to explain the differences between the computations performe

Re: [R] R Statistical Application - Windows 10

2016-12-21 Thread Duncan Murdoch
do. Duncan Murdoch Best regards, Kevin McKee Consultant - TEKsystems [[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

Re: [R] Extracting non-matching elements of one vector from another

2016-12-31 Thread Duncan Murdoch
On 31/12/2016 1:36 PM, Dan Abner wrote: Hi all, I have 2 vectors and need to extract only the elements from v2 that do not appear in v1. What is the most efficient way to do this? In the example below, I need to extract "var1". v1<-"b0" v2<-c("b0","

Re: [R] Generating a Special Histogram

2017-01-05 Thread Duncan Murdoch
= breaks[1]) vals <- x[keep] for (j in seq_along(vals)) { rect(breaks[i], j-1, breaks[i+1], j) text(mids[i], j-0.5, vals[j]) } } }) } x <- round(rnorm(20, mean=166, sd=4)) myhist(x) Duncan Murdoch __

Re: [R] [FORGED] Re: Generating a Special Histogram

2017-01-05 Thread Duncan Murdoch
On 05/01/2017 5:21 PM, Rolf Turner wrote: On 06/01/17 10:31, Jim Lemon wrote: Hi Dan, This may help if your data is in the format below: waffle.mat<-matrix(c(rep(NA,14),137,135,rep(NA,6),144,149, rep(NA,3),150,152,159,157,154, NA,163,164,164,161,162,165,164,rep(NA,5),179,173,173, rep(NA,4),1

Re: [R] if i paste this into my windows 3.3.2 R console, it crashes

2017-01-07 Thread Duncan Murdoch
so; write to me privately and I'll create one for you (with your choice of associated email address). Duncan Murdoch Jim On Sat, Jan 7, 2017 at 8:31 PM, Anthony Damico wrote: hi, should i file this on https://bugs.r-project.org/ ? thanks # crash R with this command dir.create(

<    4   5   6   7   8   9   10   11   12   13   >