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

2016-10-07 Thread Duncan Murdoch
ed 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 sense to use that. If y

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

2016-09-29 Thread Duncan Murdoch
don't know the easiest way to do that. 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

Re: [R] Closed list?

2016-09-29 Thread Duncan Murdoch
with subject "[R] Architect from Open Analytics" on Sept 10. No responses to it; I guess nobody else uses that package. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-h

Re: [R] using read.csv2()

2016-09-29 Thread Duncan Murdoch
want, or you can convert after the fact with as.numeric(as.character(don$var3)) Duncan Murdoch Thanks a lot for your answer. With my best regards, Pascale Voirin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list --

Re: [R] 32 and 64 bit R

2016-09-26 Thread Duncan Murdoch
choose to break that. 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] How to add overall xlabel and ylabel?

2016-09-25 Thread Duncan Murdoch
=...), then use mtext(..., outer = TRUE). 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

Re: [R] curve() doesn't seem to use the whole range of x? And Error: longer object length is not a multiple of shorter object length

2016-09-25 Thread Duncan Murdoch
If you actually want to plot line segments using your original data, use lines(). (You'll likely need to sort your x values into increasing order if you do that, or you'll get a pretty ugly plot.) Duncan Murdoch On 25 Sep 2016, at 16:01, Matti Viljamaa <mvilja...@kapsi.fi> wrote: I’m

Re: [R] R freezing issue when checking to see if variable belongs to two different vectors

2016-09-23 Thread Duncan Murdoch
manually. But at least we only need to do that once per user.) If you can't make this happen reproducibly, it probably won't get investigated. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman

Re: [R] `head` doesn't show all columns for an empty data.frame

2016-09-22 Thread Duncan Murdoch
rows> (or 0-length row.names) If you do that, head() works: > head(test) [1] CodeNameAddress Sun.Hrs Mon.Hrs <0 rows> (or 0-length row.names) So this is a bug in openxlsx. It's also a well-known limitation of the S3 object system: you can easily create things t

Re: [R] separate commands by semicolon

2016-09-19 Thread Duncan Murdoch
at important (I am trying to simulate a normal R console), and parse only if it syntactically correct. I was merely curious if this could be done, likely using regular expressions (surely strsplit doesn't solve it). Best, Adrian See the section on "partial parsing" in the ?parse help page.

Re: [R] NaN Log-lik value in EM algorithm (fitting Gamma mixture model)

2016-09-14 Thread Duncan Murdoch
alculate log likelihoods is that rounding error gives you a negative likelihood, and then log(lik) comes out to NaN. You just need to look really closely at each step of your calculations. Avoid using log(); use the functions that build it in (e.g. instead of log(dnorm(x)), use dnorm(x, log =

Re: [R] why data.frame, mutate package and not lists

2016-09-14 Thread Duncan Murdoch
data.frame, but when I reflect on the typical way a seasoned R programmer approaches list and data.frames that is basically what they are communicating. I believe it is intended to be a requirement. You can construct things with class "data.frame" that don't have that structure, but lots of

Re: [R] More tube-like lines3D?

2016-09-13 Thread Duncan Murdoch
of them, things will slow down noticeably. 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

Re: [R] with and evaluation

2016-09-08 Thread Duncan Murdoch
ss computerese is analogous to taxlawese. Familiar words have entirely different meanings. Carl Sutton CPA [[alternative HTML version deleted]] This is really hard to read, because you posted in HTML. If you don't get a useful answer, please try again in plain text. Duncan Murdoch __

Re: [R] R-specific Software Requirement Specification

2016-09-08 Thread Duncan Murdoch
may accidentally edit the Roxygen comments at the same time. It's more work for Harold to notice that his spec has been changed than if it is in a separate file. Duncan Murdoch Create a package, put it on github, and away you go. On 9/8/2016 9:53 AM, Doran, Harold wrote: Then from the R

Re: [R] R-specific Software Requirement Specification

2016-09-07 Thread Duncan Murdoch
for such work. The Rd help pages do some of this. They aren't so good at describing the class hierarchy but are good at specifying individual functions. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https

Re: [R] readBin documentation error

2016-09-03 Thread Duncan Murdoch
implies 'what = "character"' unless it happens to contain one of those strings), so this is a way to allow a common readable abbreviation. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz

Re: [R] source() does not include added code

2016-08-31 Thread Duncan Murdoch
ng a closing parenthesis. I'd have hoped for an error message about that, and I get one with a similar example. Not sure why you didn't. > source('test.R') Error in source("test.R") : test.R:4:0: unexpected end of input 2: message("bad" 3: Duncan Murdoch _

Re: [R] How to test existence of an environment and how to remove it (from within functions)?

2016-08-29 Thread Duncan Murdoch
sly calculated values. There are ways to get old values to timeout automatically, etc. Duncan Murdoch x.cols <- get("cached.obj", .my_environ) } else { # time-consuming part (+ cache) x.cols <- split(x, col(x)) Sys.sleep(1)

Re: [R] possible error in stem() function?

2016-08-29 Thread Duncan Murdoch
pen in that the 480's do precede the 490's. Duncan Murdoch If I remove one value from the input, then the result appears correct: x <- c(479,482,487,493,494,494,495,496,497,498,498,499,503,504,507,507,508, + 510,511,512,514,516,520,524,525,525,527,534,536,542,545,546,5

Re: [R] How to test existence of an environment and how to remove it (from within functions)?

2016-08-29 Thread Duncan Murdoch
r than purely locally within the evaluation frame of the call. You need to create the variable "persistent" there, or the assignment would go to the global environment, which is bad. This gives > aux(1) > aux(2) Previous arg was 1 > aux(3) Previous arg was 2 Duncan Murdo

Re: [R] Leaflet package error while adding Polygons

2016-08-27 Thread Duncan Murdoch
is also a recommendation of the posting guide (see the footer for the URL). Duncan Murdoch Thanks, Jaya ​ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman

Re: [R] persp fail with non-equidistant dates

2016-08-22 Thread Duncan Murdoch
ple for others to try. You might want to select a subset of your data if it's too big or too private to post here. Duncan Murdoch Thanks, Tomas Bayer On 22/08/2016 11:17 AM, Tomas Bayer wrote: Hello, when I plotted non-equidistant data in 3D (using persp and contour), it was ended with

Re: [R] persp fail with non-equidistant dates

2016-08-22 Thread Duncan Murdoch
s in the third. Using your variable names, you'd want z[i,j] to correspond to y[i] and x[j]. If you just have a collection of (y, x, z) triples, you'll need to do some pre-processing to fit a surface and produce the required inputs. Duncan Murdoch __

Re: [R] Retrieving data from survey in R Studio

2016-08-18 Thread Duncan Murdoch
Sorry, we don't do homework on this list. You should ask your instructor. Duncan Murdoch On 18/08/2016 5:19 AM, Barathan Roy Pinas wrote: Hello, I have been given a .csv file and it is not loading. This is what I did. survey=read.csv("http://www.maths.usyd.edu.au/u/UG/IM/STAT2

Re: [R] How to set the window size in rgl for full hd resolution

2016-08-17 Thread Duncan Murdoch
() 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, minimal, self-contained

Re: [R] Help with non standard evaluation and require function

2016-08-14 Thread Duncan Murdoch
gave an example where they differ, here's another: > f(1+2) x + (1 + 2) Duncan Murdoch It is probaby a very trivial problem but I find hard to figure out ho substitute works. Thanks a lot again for the help! Cheers, Luca On Aug 12, 2016 20:14, "David Winsemius" <dwinsem...@comca

Re: [R] R Studio: Run script upon saving or exiting

2016-08-13 Thread Duncan Murdoch
to do that. 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, minimal, self

Re: [R] Help with non standard evaluation and require function

2016-08-12 Thread Duncan Murdoch
eed this for the install.packages call. You should have been able to figure this out from the ?require help page. It is mentioned twice, and is used in one of the examples. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see ht

Re: [R] Continuation-parsing / trampoline / infinite recursion problem

2016-08-11 Thread Duncan Murdoch
On 10/08/2016 1:28 PM, Duncan Murdoch wrote: On 10/08/2016 1:10 PM, Thomas Mailund wrote: That did the trick! I was so focused on not evaluating the continuation that I completely forgot that the thunk could hold an unevaluated value… now it seems to be working for all the various

Re: [R] Continuation-parsing / trampoline / infinite recursion problem

2016-08-10 Thread Duncan Murdoch
the function thunklist[[2]] (or something else if i has been modified in the meantime), and things will go bad. That's why it's important to force both f and ... in make_thunk. Duncan Murdoch thunk_factorial <- function(n, continuation = identity) { if (n == 1) { continuat

Re: [R] Continuation-parsing / trampoline / infinite recursion problem

2016-08-10 Thread Duncan Murdoch
ecause that forces evaluation of both arguments. I suspect you would have problems with make_thunk <- function(f, ...) function() do.call(f, list(...)) for exactly the same reasons as the original; I'm surprised that you found it appears to work. Duncan Murdoch Thanks a lot!

Re: [R] Continuation-parsing / trampoline / infinite recursion problem

2016-08-10 Thread Duncan Murdoch
te ..., so its value can change between the time you make the thunk and the time you evaluate it. I think you could force the evaluation within make_thunk by changing it to make_thunk <- function(f, ...) { list(...); function() f(…) } and then would be able to skip the force() in your thunk_f

Re: [R] BaseX

2016-08-09 Thread Duncan Murdoch
uite striking that all "digits" are 12 or less -- I suspected an error at first. But it's right: sum(c(4, 12, 9, 2)*62^(3:0)) is 1e6. Duncan Murdoch On Tue, Aug 9, 2016 at 10:42 AM, <ruipbarra...@sapo.pt> wrote: > Hello, > > As for base 58 or base 62 I don't know

Re: [R] RGL library loading issues

2016-08-05 Thread Duncan Murdoch
n't do any testing on those versions any more. Did you install from source? Which version of rgl did you install? Duncan Murdoch library(rgl) ^C ^D Finally I had to kill -1 . what could be the issue? appreciate your help. Thanks Adrian X window systemm X quartz 2.7.9 (xorg-server 1.1

Re: [R] Fwd: only plot borders of a region in a scatter plot

2016-08-04 Thread Duncan Murdoch
a lot :P The second problem is easy: just change your NA values to some new ID value, or change the test from basiinID == ID to !is.na(basiinID) & basiinID == ID The first one looks harder. Duncan Murdoch Cheers, Zun Yin On Thu, Aug 4, 2016 at 5:09 PM, Bert Gunter <bgunter.4...@gm

Re: [R] Fwd: only plot borders of a region in a scatter plot

2016-08-04 Thread Duncan Murdoch
On 04/08/2016 11:03 AM, William Dunlap via R-help wrote: If 'basinID' is the matrix of basin identifiers you could draw an outline of the basin with identifier 'ID' with coutour( basiinID == ID, level=0.5) Note the typo: that should be contour( basiinID == ID, level=0.5) Duncan Murdoch

Re: [R] Multiple plot in a page

2016-08-03 Thread Duncan Murdoch
there.) Just drop it. Duncan Murdoch On Wed, Aug 3, 2016 at 4:55 PM, Jim Lemon <drjimle...@gmail.com> wrote: Hi Roslina, You only specify space for two plots in: par(mfrow=c(1,2)) However, you only try to plot two plots, so I will assume that you only want two. You haven't defined "x&qu

Re: [R] Read output:

2016-08-02 Thread Duncan Murdoch
got a long name, so you may have made an error typing it. I recommend using f <- file.choose() to put the correct filename into f, then read.csv(f, header = TRUE) to read it. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIB

Re: [R] type of objects in last session

2016-08-01 Thread Duncan Murdoch
ticed everything is type "character". Obviously wrong answer. So How can I have the right answer ? Thanks The ls.str() function probably does what you want. If you wanted to do it with sapply (e.g. because you want just typeof(), not everything else), you need to take account of the fac

Re: [R] SegFault when trying to install an inhouse package

2016-07-28 Thread Duncan Murdoch
d the rgl.init problems by setting the environment variable RGL_USE_NULL to TRUE before running anything. That should help on your 3.2.3 servers. It's possible that the segfault on the other system is related, but I'd guess it's something else. Tracking down segfaults can be hard: you'll nee

Re: [R] Visualization of a Convex Hull in R (Possibly with RGL)

2016-07-26 Thread Duncan Murdoch
ieve with a few lines of code. Any ideas would be welcome. The convex hull of a set of spheres isn't a polyhedron (parts of the spheres will appear in it, and it will have curved edges). Shapes like that are hard to draw in rgl. Duncan Murdoch __ R-hel

Re: [R] Date Time in R

2016-07-26 Thread Duncan Murdoch
t;%m-%d-%y") If that doesn't work, you'll need to post something reproducible. Duncan Murdoch I also need to create weekdays from this date variable but until i get this resolved i cant find a weekday. For weekday i have used: eir$week<- (eir$date) eir$week<- weekdays(as.Date(eir$week)) c

Re: [R] Soft Question: Where to find this reference.

2016-07-25 Thread Duncan Murdoch
Google Books can give details. The ISBN is 0534167640. 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/post

Re: [R] Help installing Rcmdr on Mac

2016-07-21 Thread Duncan Murdoch
'application/x-gzip' length 5456133 bytes (5.2 MB) == downloaded 5.2 MB That part was fine. Duncan Murdoch ? If someone could please help me, I would be very grateful. It is quite urgent! Many thanks in advance Judy Munday [[alternative

Re: [R] Build command in library(devtools)

2016-07-20 Thread Duncan Murdoch
is used to build current R (and all of its packages), so of course it works there (though we may not have tested on the latest version of Windows, and devtools is its own project, unrelated to Rtools). Duncan Murdoch On 7/19/2016 4:38 PM, John McKown wrote: On Tue, Jul 19, 2016 at 3:15 PM, Steven

Re: [R] findAssocs in TM package in R help?

2016-07-18 Thread Duncan Murdoch
work to me. But some assignments aren't homework. Duncan Murdoch On Mon, Jul 18, 2016 at 5:09 AM, Duncan Murdoch <murdoch.dun...@gmail.com <mailto:murdoch.dun...@gmail.com>> wrote: On 17/07/2016 6:31 PM, Shivi Bhatia wrote: Hi Team, Please suggest. On Sun, J

Re: [R] findAssocs in TM package in R help?

2016-07-17 Thread Duncan Murdoch
. You should ask your instructor for help. Duncan Murdoch Now I need to run findAssocs from my dtm with some word say 'like' with a correlation of 0.70 but as far as i have been researching it tells it this function is only viable when we have more than 1 doc however in my case i only have 1. So

Re: [R] writing a matrix to a file with trailing zeroes

2016-07-17 Thread Duncan Murdoch
9 -1.1 -1.0 -0.1 -0.4 1.2 -0.8 1.3 6.0 2.5 write(round(t(x2),1),file="") -1.4 5 -0.9 -1.1 -1 -0.1 -0.4 1.2 -0.8 1.3 6 2.5 write(round(t(x2),1),file="",ncol=2) -1.4 5 -0.9 -1.1 -1 -0.1 -0.4 1.2 -0.8 1.3 6 2.5 Still no luck. I need the 5 in the first line to be 5.0 and t

Re: [R] Matrix

2016-07-16 Thread Duncan Murdoch
; > Desired output > A A 3 > A B 4 > A C 5 > B B 7 > B C 8 > C C 9 Yes, use matrix indexing. I don't think the 3600 values are going to be very easy to read, but here's how to produce them: m <- matrix(1:3600, 60, 60) indices <- expand.grid(row = 1:60, col = 1:60)

Re: [R] Please help: cannot import files from Windows into R

2016-07-14 Thread Duncan Murdoch
e\Desktop\Ran_mine_play_data.txt Can someone help me resolve this?? How did you produce the file Ran_mine_play_data.txt? If you saved it from Word, you need to tell it to save in plain Ascii format. I don't have a copy of Word to look at, so I can't tell you how that is described, but it is pr

Re: [R] BCa Bootstrapped regression coefficients from lmrob function not working

2016-07-06 Thread Duncan Murdoch
at a set of fixed locations. Duncan Murdoch Best S - Mail original - De : peter dalgaard <pda...@gmail.com> À : varin sacha <varinsa...@yahoo.fr> Cc : Bert Gunter <bgunter.4...@gmail.com>; R-help Mailing List <r-help@r-project.org> Envoyé le : Mercredi 6 juillet 2

Re: [R] Sweave vs. R CMD Rd2pdf --no-clean --force

2016-07-04 Thread Duncan Murdoch
5-06-18) That's not the latest version. Duncan Murdoch Platform: x86_64-apple-darwin10.8.0 (64-bit) Running under: OS X 10.7.5 (Lion) locale: [1] C attached base packages: [1] tools stats4splines parallel datasets [6] compiler graphics grDevices stats grid [11] utils

Re: [R] Problem with utils package

2016-07-04 Thread Duncan Murdoch
are you determining that? Are you using packageVersion("utils")? The version of a base package should always match the version of R, so if you've really got 3.0.2 there, something is seriously wrong. Duncan Murdoch On an older version of R (3.1.2) which I am running on a Windo

Re: [R] Antwort: Re: Antwort: Re: Antwort: Re: Installing from source on Windows 7: tibble [RE OPENED]

2016-06-30 Thread Duncan Murdoch
that, the Makefiles in R (or in your package, if you have one) chooses. The COMPILED_BY definition is not involved in that decision. Duncan Murdoch Kind regards Georg Von:Duncan Murdoch <murdoch.dun...@gmail.com> An: g.maub...@weinwolf.de, Kopie: r-help@r-project.org Datum:

Re: [R] linking vignettes in a man page

2016-06-29 Thread Duncan Murdoch
/ in a package can be viewed You can give \url{} style links, for example the grid package has \url{../doc/grid.pdf} in the package?grid help topic. Similarly, ../..//help/ will link from a vignette to help topic ?alias. Duncan Murdoch __ R-help

Re: [R] Antwort: Re: Antwort: Re: Installing from source on Windows 7: tibble [SOLVED]

2016-06-29 Thread Duncan Murdoch
n "C:\R-Project\Rtools\"? gcc-4.6.3 was installed that way. The 4.6.3 compiler was compiled for "multilib" operation: the same compiler took command line options to distinguish between 32 bit and 64 bit compiles. The newer version doesn't support that, so we need two separ

Re: [R] Antwort: Re: Installing from source on Windows 7: tibble

2016-06-29 Thread Duncan Murdoch
tatus -- cut -- What else could I do? You seem to have missed the second part of my advice, describing what to do with the two Makeconf files. Duncan Murdoch Kind regards Georg Von:Duncan Murdoch <murdoch.dun...@gmail.com> An: g.maub...@weinwolf.de, r-help@r-project.org, D

Re: [R] Installing from source on Windows 7: tibble

2016-06-29 Thread Duncan Murdoch
w_32/bin/ You need to make sure you don't have an environment variable named BINPREF defined, or it will override these settings. (If you were building just one architecture, you could do the setting by environment variable, but not if you are trying to build both archs in one call.) Duncan Mur

Re: [R] termplot intervals - SE or CI?

2016-06-28 Thread Duncan Murdoch
a rough 95% confidence interval, is that right? I would assume they are what the help file says, but if I wasn't sure, I'd work them out for a simple case from first principles, and compare to what the code gives. Duncan Murdoch Many thanks, Eric Goodwin Scientific data analyst | Coastal

Re: [R] (sin asunto)

2016-06-28 Thread Duncan Murdoch
On 28/06/2016 5:46 AM, Monse Buenaño wrote: Excuse me, I want to change my e-mail adress, where I receive your e-mails. Can you help me? Follow the link below: R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help Duncan Murdoch

Re: [R] How to create these variables in R?

2016-06-28 Thread Duncan Murdoch
. Your rules are a little ambiguous (are 0 and 1 the only possible values?) so I won't try, but it should be straightforward for you to write the loop. A2 and A3 are easy: A2 <- as.numeric(A1 %in% 1:2) A3 <- as.numeric(A1 > 2) Duncan Murdoch See the example below for ill

Re: [R] object 'add.expr' not found

2016-06-27 Thread Duncan Murdoch
ed to find what other function is using add.expr; there are no other base functions that use it. 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 pos

Re: [R] Antwort: RE: Antwort: Fw: Re: Subscripting problem with is.na()

2016-06-27 Thread Duncan Murdoch
, if row or column contains more than one value). Duncan Murdoch Kind regards Georg Von:PIKAL Petr <petr.pi...@precheza.cz> An: "g.maub...@weinwolf.de" <g.maub...@weinwolf.de>, Kopie: "r-help@r-project.org" <r-help@r-project.org> Datum: 2

Re: [R] rgl and rglwidget: Weird behaviour than animating lines

2016-06-23 Thread Duncan Murdoch
own document. However, when I try to do that with this one, it fails, because you use r1 without defining it. You might want to think about deleting everything unnecessary as well: if you want to illustrate problems with lines, just show lines. You should also say what vers

Re: [R] check broken links in a column

2016-06-21 Thread Duncan Murdoch
n seq_along(urls)) { if (inherits(try(readLines(urls[i], 1), silent = TRUE), "try-error")) result[i] <- FALSE else result[i] <- TRUE } You can put together something more sophisticated with tryCatch(), which would make it easier to catch the warning messages when t

Re: [R] About the parameters of rotationMatrix

2016-06-21 Thread Duncan Murdoch
(UserMatrix) } You are rotating by a constant amount about a sequence of parallel vectors. Only the length of the vectors is changing. If you want to see a change, you need to use a different rotation axis, or a different amount of rotation. Duncan Murdoch

Re: [R] better loop for simulation

2016-06-18 Thread Duncan Murdoch
On 18/06/2016 6:12 PM, Naresh Gurbuxani wrote: I want to calculate a function many times over. My solution below works, but does not seem very elegant. # my function to run many times over stud.score <- function(n.questions, mult.choice = 2) { prob.success <- 1 / mult.choice

Re: [R] messy code found when reading CSV file on win 10 system

2016-06-15 Thread Duncan Murdoch
you should do: Start R without RStudio, e.g. using Rgui. See if the problem persists. If so, post the details here. If not, move over to the RStudio help forums. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] AR1 model using ARIMA

2016-06-14 Thread Duncan Murdoch
On 14/06/2016 7:46 AM, T.Riedle wrote: Dear R users, I have not received any help regarding my problem. Please read the posting guide (see the link at the bottom of every message). If you don't post reproducible code, it's much harder to help you. Duncan Murdoch The rolling window AR1

Re: [R] save rgl.sphere plot

2016-06-10 Thread Duncan Murdoch
knitr and rglwidget. For example, put this in example.Rmd: --- title: "Example" author: "Duncan Murdoch" date: "June 10, 2016" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` ```{r} options(rgl.useNULL = TRUE) libra

Re: [R] create an empty data frame and then fill in it (and then evaluate the mean of semi-hourly data for each day)

2016-06-10 Thread Duncan Murdoch
, function(x) round(mean(df_snow$snow[df_snow$day == x], na.rm=T)), 0) The 0 at the end is an example of the numeric function result you want, so that vapply() knows to create a numeric vector. Duncan Murdoch day snow NA NULL NA.1 NULL NA.2

Re: [R] R install on AIX 7

2016-06-09 Thread Duncan Murdoch
. It also mentions an "R on AIX" project; I don't know if that is still active. Duncan Murdoch My ultimate goal is to integrate R with microstrategy and my microstrategy server is on AIX 7, so i need to have R installed over there before i can install integration pack. Any suggesti

Re: [R] Importing data from a text file with no separator

2016-06-09 Thread Duncan Murdoch
On 09/06/2016 8:56 AM, Federman, Douglas wrote: ?read.fwf There is a data import/export document on cran.r-project.org And included with R distributions. It's one of the manuals, and will be accessible via the help menu in front ends that have one. Duncan Murdoch -Original

Re: [R] create an empty data frame and then fill in it

2016-06-09 Thread Duncan Murdoch
df_year$hs_MteBove <- ... 2. Create your columns with the right length from the beginning: df_year <- data.frame(day = rep(as.Date(NA), 182), ...) I don't like this solution as much. Duncan Murdoch __ R-help@r-project.org mailing list -- To

Re: [R] create an empty data frame and then fill in it

2016-06-09 Thread Duncan Murdoch
df_year$hs_MteBove <- ... 2. Create your columns with the right length from the beginning: df_year <- data.frame(day = rep(as.Date(NA), 182), ...) I don't like this solution as much. Duncan Murdoch __ R-help@r-project.org mailing list -- To

Re: [R] Faster Multivariate Normal

2016-06-07 Thread Duncan Murdoch
and just make one call to dmvnorm. Duncan Murdoch Thank you Harold library(mvtnorm) ### Create parameters for MVN mu <- c(0,0,0,0) cov <- matrix(.2, ncol= 4,nrow=4) diag(cov) <- 1 sigma <- as.matrix(cov) ### Create nodes and expand to 4 dimensions for quadrature dm <- length

Re: [R] detecting if a variable has changed

2016-06-05 Thread Duncan Murdoch
On 05/06/2016 2:13 PM, Bert Gunter wrote: Nope, Ted. I asked for a O(log(n)) solution, not an O(n) one. I don't think that's possible with a numeric vector. Inserting an entry at a random location is an O(n) operation, since you need to move all following values out of the way. Duncan

Re: [R] Request for help

2016-06-03 Thread Duncan Murdoch
structions contained in it, doing lots of previewing to make sure it looks okay. Run checks reasonably frequently to find your errors and omissions. Duncan Murdoch Finally, google! -- there are many other tutorials on this on the web. Cheers, Bert Bert Gunter "The trouble with havi

Re: [R] Query about Text Preprocessing (Encoding)

2016-05-29 Thread Duncan Murdoch
support for those is mixed. - You need to make sure your graphics device supports your alphabet. Not all graphics devices have character support for all languages. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Application of "merge" and "within"

2016-05-28 Thread Duncan Murdoch
16 13 3 3 1 1 G1 D1 3 19 13 6 4 1 1 G1 D1 4 12 13 -1 5 1 1 G1 D1 5 19 13 6 Just use s <- within(s, db <- b - bl) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/

Re: [R] colored table

2016-05-28 Thread Duncan Murdoch
, or what? Duncan Murdoch Function values that I would like to print in the table x.eq.minus1 x.eq.zero x.eq.plus1 y.eq.minus1 -20 10-5 y.eq.zero -10 6 22 y.eq.plus1-8

Re: [R] Shaded areas in R

2016-05-26 Thread Duncan Murdoch
hould also send your questions to R-help, not privately. I've cc'd my response there. 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 ht

Re: [R] Shaded areas in R

2016-05-26 Thread Duncan Murdoch
x,y) in this case, or any other function that allows me to draw a shaded area under the curve on a time series basis? Times and dates just print like characters, they aren't actually characters. For example, x <- Sys.Date() + 1:20 y <- rnorm(20) plot(y ~ x) polygon(c(x, x[20],

Re: [R] strange error

2016-05-25 Thread Duncan Murdoch
avoid the problem by using Windows 10? Or is there anything else I can do? This is an RStudio problem, not an R problem. One solution is to make the "Plots" pane bigger. There may be others -- you'll have to contact RStudio for help with it. Duncan Murdoch ___

Re: [R] print all variables inside function

2016-05-23 Thread Duncan Murdoch
t: fprint(exmp1). Why create them first? Just do something like this: knowns <- c( pa=0.35 pb=0.35 pc=0.30 pad=0.015 pbd=0.010 pcd=0.020) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.eth

Re: [R] meaning of lm( y~., data=mydat ), is it a language feature, is it documented, is it supported?

2016-05-23 Thread Duncan Murdoch
eature of the R language? Where can I find it documented? I would hate to write code that is dependent on a non-supported, non-documented language feature. It is documented in the Introduction to R manual (hidden in section 11.5, "Updating fitted models"), and in ?formula, which ?lm ref

Re: [R] rjags crashes RStudio every time it tries to load

2016-05-20 Thread Duncan Murdoch
? The package does seem to load successfully in regular R, but I would prefer not to be constrained to that platform if possible. Since this is RStudio-specific, you'll need to ask on one of the RStudio forums. Duncan Murdoch __ R-help@r-project.org

Re: [R] stopifnot() doesnt work as I expect it to. Are my expectations correct?

2016-05-20 Thread Duncan Murdoch
t's an example where the proposed behaviour makes sense. But stopifnot(is.data.frame(df)); stopifnot(is.integer(df$ID)) isn't that much harder to type, and it already does what you want. Duncan Murdoch f(data.frame(ID=4:7)) # [1] 4 7 f(4:7) # Error in df$ID : $ operator is invalid for ato

Re: [R] stopifnot() doesnt work as I expect it to. Are my expectations correct?

2016-05-20 Thread Duncan Murdoch
those errors, so I don't think I'd change it. 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 a

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

2016-05-19 Thread Duncan Murdoch
t 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 UNSUBSCRI

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

2016-05-19 Thread Duncan Murdoch
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 UNSUBSCRIBE and

Re: [R] problem with matrix

2016-05-16 Thread Duncan Murdoch
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.ethz.ch/mailman

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] how to manipulate ... in the argument list

2016-05-11 Thread Duncan Murdoch
d 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/listinfo/r-

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

2016-05-10 Thread Duncan Murdoch
ash 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. John J

Re: [R] expression input to a function

2016-05-04 Thread Duncan Murdoch
rom 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.org mailing list --

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] Using read.csv() to import data

2016-04-24 Thread Duncan Murdoch
on 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 platforms; choose.fil

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 every

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