Re: [R] Function argument and scope

2016-11-13 Thread Jim Lemon
Hi Bernardo, I don't think that your function is doing anything like you expect it to do: test <- data.frame(var1=c("a","b","c"),var2=c("d","e","f")) test var1 var2 1ad 2be 3cf You have a data frame with two columns, the first thing you do is extract the first value in th

Re: [R] question on mean, sum

2016-11-13 Thread Berend Hasselman
In addition to Petr's remarks: - why are you doing sum(mtcars)[1]? Do you want the sum of first column of mtcars? In that case you should do sum(mtcars[,1]). - similar remarks apply to your use of mean and sd. Have you read an introduction to R? Berend > On 14 Nov 2016, at 04:01, moku...

Re: [R] question on mean, sum

2016-11-13 Thread PIKAL Petr
Hi Your HTML formatted message is scrambled so it is hard to understand what is your problem. The probable cause is the fact that sum, mean and sd behave differently when applied to different objects (vector, data.frame, ...) Post in plain text together with at least result of str(mtcars) Chee

[R] question on mean, sum

2016-11-13 Thread mokuram
Hi, I am working on functions such as sum(), mean() ... > sum(mtcars)[1] 13942.2> mean(mtcars)[1] NAWarning message:In > mean.default(mtcars) : NA> sd(mtcars)Error in is.data.frame(x) : ()'double' why got different reply?Is this a BUG for the current version of R?my version info:version.string

Re: [R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Sidoti, Salvatore A.
Hi Jim, Nice to see you again! First of all, apologies to all for bending the rules a bit with respect to the mailing list. I know this is a list for R programming specifically, and I have received some great advice in this regard in the past. I just thought this was an interesting applied prob

[R] Function argument and scope

2016-11-13 Thread Bernardo Doré
Hello list, my first post but I've been using this list as a help source for a while. Couldn't live without it. I am writing a function that takes a dataframe as an argument and in the end I intend to assign the result of some computation back to the dataframe. This is what I have so far: myFunc

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

2016-11-13 Thread Jeff Newmiller
I find your response here inconsistent... either including `return` causes a "wasted" function call to occur (same result achieved slower) or the parser has an optimization in it to prevent the wasted function call (only behaviorally the same). I carefully avoid using the return function in R.

Re: [R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Michael Friendly
Salvatore, I won't comment on whether to use log weight "to increase the correlation" -- that depends on whether that makes sense, and whether the relationships with other variables is more nearly linear. Try this with your pca of the correlation matrix: biplot(pca_morpho) You'll see that

Re: [R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Jim Lemon
Hi Salvatore, Depending upon your concept of "size" the use of the weighted sum may well suit your purpose. The first principal component, being three lengths and a mass, is likely to be strongly related to any sensible concept of "size". My comment was meant to ensure that the local definition of

Re: [R] Question about using ggplot

2016-11-13 Thread Dominik Schneider
past versions of ggplot2 used to accept family as an argument directly, but the latest ggplot2 (perhaps starting with v2?) requires method.args=list(). So the online sources you found using family directly were for an older version of ggplot. On Sun, Nov 13, 2016 at 8:18 AM, wrote: > Hi. I’m a s

Re: [R] Question about using ggplot

2016-11-13 Thread Ben Tupper
Hi, It's hard to know for sure, but perhaps the spelling of 'binomial' is not correct? Ben > On Nov 13, 2016, at 10:18 AM, overholi...@ajou.ac.kr wrote: > > Hi. I’m a student from South Korea, and I’m studying R by myself. > While I am studying, I have a trouble dealing with ggplot(especially,

[R] Question about using ggplot

2016-11-13 Thread overholic10
Hi. I’m a student from South Korea, and I’m studying R by myself. While I am studying, I have a trouble dealing with ggplot(especially, about parameter ‘family’) > b <- biopsy > b$classn[b$class == "benign"] <- 0 > b$classn[b$class == "malignant"] <- 1 > ggplot(b, aes(x = V1, y = classn)) + geom_p

[R] how to use the fontchooser tcl tk widget ?

2016-11-13 Thread Cleber N.Borges
hello all r users, somebody has a example how to use fontchooser widget? I haven't success in my try :-( Thanks Cleber > library( tcltk ) # in R-devel, > tclVersion() [1] "8.6.4" > tclvalue( tcl('tk::fontchooser', 'show', command='' ) ) Error in (function (name, pos = -1L, envir = as.environm

Re: [R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Jim Lemon
Hi Salvatore, If by "size" you mean volume, why not directly measure the volume of your animals? They appear to be fairly small. Sometimes working out what the critical value actually means can inform the way to measure it. Jim On Sun, Nov 13, 2016 at 4:46 PM, Sidoti, Salvatore A. wrote: > Let'

Re: [R] [FORGED] How to remove box in Venn plots (Vennerable package, uses grid) - similar to bty="n" in standard plots

2016-11-13 Thread Paul Murrell
Hi Can you supply some example code? You might get some joy from grid.ls() to identify the box followed by grid.remove() to get rid of it; some example code would allow me to provide more detailed advice. Paul On 12/11/16 05:12, DE LAS HERAS Jose wrote: I'm using the package Vennerable to

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 parenthetical expression is

Re: [R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Bert Gunter
While you may get a reply here, this list is about R programming, not about statistics. So 1. Do your homework and read a tutorial on PCA on the web or elsewhere. Isn't this what a PhD student is supposed to do? 2. Post on a statistics list like stats.stackexchange.com. 3. Consult your professor

Re: [R] Is this foreach behaviour correct?

2016-11-13 Thread Henrik Bengtsson
On Nov 13, 2016 13:54, "Henrik Bengtsson" wrote: > > It looks like a bug. I don't think c.Date() is every called, because: > > > trace(c.Date, tracer = quote(message("c.Date() called"))) > Tracing function "c.Date" in package "base" > [1] "c.Date" > > Tracing works: > > > c(as.Date(1L), as.Da

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 value ... even if that par

Re: [R] Is this foreach behaviour correct?

2016-11-13 Thread Henrik Bengtsson
It looks like a bug. I don't think c.Date() is every called, because: > trace(c.Date, tracer = quote(message("c.Date() called"))) Tracing function "c.Date" in package "base" [1] "c.Date" Tracing works: > c(as.Date(1L), as.Date(10001L)) Tracing c.Date(as.Date(1L), as.Date(10001L)) on ent

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

2016-11-13 Thread Duncan Murdoch
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 value ... even if that parenthetical expression is only part of a larger

[R] Principle Component Analysis: Ranking Animal Size Based On Combined Metrics

2016-11-13 Thread Sidoti, Salvatore A.
Let's say I perform 4 measurements on an animal: three are linear measurements in millimeters and the fourth is its weight in milligrams. So, we have a data set with mixed units. Based on these four correlated measurements, I would like to obtain one "score" or value that describes an individua

[R] tcl('tk::fontchooser', 'show') : How to use? R-devel Tcl 8.6

2016-11-13 Thread Cleber N.Borges
Hello, Somebody would indicate the correct way to use the option the fontchooser widget into tcltk package (in R-devel, Tcl 8.6) ? I tried to use as other traditional widgets but no success. (code below) Thanks Cleber > tt <- tktoplevel(); but <- ttkbutton( tt, text='Test'); tcl('pack', but ) >

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

2016-11-13 Thread Dave DeBarr
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 value ... even if that parenthetical expression is only part of a larger expression. Is this intentional? I'm guess