[R] Cannot install package write.xls

2016-10-07 Thread T.Riedle
Dear R users, I am trying to export my results to excel using write.xls or write.table but I cannot install the packages. Instead, I get the message Warning in install.packages : package 'write.table' is not available (for R version 3.3.1) What can I do? [[alternative

[R] how to work ttkspinbox ?

2016-10-07 Thread Cleber N.Borges via R-help
hello all, somebody have a example of use of ttkspinbox ? I tried to use like others widgets but I get error. Thanks in advanced for any help cleber ### > library( tcltk ) > > t <- tktoplevel() > > spin <- ttkspinbox( t ) Error in structure(.External(.C_dotTclObjv, objv),

Re: [R] Font problem --- SOLVED.

2016-10-07 Thread Rolf Turner
On Mon, Oct 3, 2016 at 7:55 AM, Rolf Turner wrote: Dunno exactly whom I should ask about this problem, but I thought I'd start with good old r-help. I have recently acquired a new laptop, and have installed Ubuntu 16.04 on it. Still having some teething problems.

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

2016-10-07 Thread David Winsemius
> On Oct 7, 2016, at 10:44 AM, Jorge Cimentada wrote: > > Hi Bert, > > Yes, I'm aware of the difference between a and "a" but in terms of object > classes I don't see the difference between "a" and names(mtcars)[1]. > They're both strings. They are not both "strings".

Re: [R] gsub() could not replace my string

2016-10-07 Thread William Dunlap via R-help
Either backslash the square brackets, as they have a special meaning (character range) in regular expressions, or use the fixed=TRUE argument to indicate that your pattern is not a regular expression. > gsub("\\[NA\\]NA%", "", "[NA]NA%abcde") [1] "abcde" > gsub("[NA]NA%", "", "[NA]NA%abcde",

[R] gsub() could not replace my string

2016-10-07 Thread Christofer Bogaso
Hello again, I have few many string elements, and some of those elements contain a special phrase as '"[NA]NA%", which I planned to replace by some Blank. So I tried with below code in R > gsub("[NA]NA%", "", "[NA]NA%abcde") [1] "[NA]NA%abcde" It appears that, my code could not replace

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

2016-10-07 Thread Duncan Murdoch
On 07/10/2016 1:44 PM, Jorge Cimentada wrote: Hi Bert, Yes, I'm aware of the difference between a and "a" but in terms of object classes I don't see the difference between "a" and names(mtcars)[1]. They're both strings. However, for creating a named character vector, this works: c("a" = "b)

Re: [R] prcomp(): How do I multiply two matrices

2016-10-07 Thread peter dalgaard
You need to check your theory, and the dimensions of your data structures. Typically, data is (n x p) and your rotation matrix is (p x p) so pre-multiplying by coef1 fits like a round peg in a square hole. Post-multiplying has a better chance, but I have long forgotten whether you need to

[R] prcomp(): How do I multiply two matrices

2016-10-07 Thread T.Riedle
Dear R-users, I am trying to do a principal components analysis using the attached data. My code looks as follows. I want to calculate the time series of the principal components (PC) . To this end, I transform the coefficients and the data into matrices and employ a matrix multiplication but

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

2016-10-07 Thread Jorge Cimentada
Hi Bert, Yes, I'm aware of the difference between a and "a" but in terms of object classes I don't see the difference between "a" and names(mtcars)[1]. They're both strings. However, for creating a named character vector, this works: c("a" = "b) But this doesn't c(names(mtcars)[1] = "b") For

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

2016-10-07 Thread Bert Gunter
I think you have R semantics confused. What do you think c("a" = "b") means? Note that: > c("a" = "b") a "b" > a Error: object 'a' not found And of course: class("a") # character class("b") # character but this has *nothing* to do with the line immediately above it. Have you gone

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread William Dunlap via R-help
foreach's '.export' argument lists the objects that should be copied to the environment in which the expression is to be evaluated, which is not the global environment. In your example, environment(formula) is the global environment so lm(formula, data=d, weights=weights) only looks in the

Re: [R] date comparison doesn't match value

2016-10-07 Thread Sarah Goslee
Hi Heather, I can't duplicate your problem: "looks like a date" is not helpful. If you use dput() to provide actual data, then maybe we can actually help you. Providing sessionInfo() would also help, as some time problems may be OS-related. Meanwhile, see if working thru this can help you get it

[R] date comparison doesn't match value

2016-10-07 Thread Simon, Heather
I am running into trouble when trying to compare date fields in my dataset. When I view a field, it looks like it is a date in 2011: > alldata$new.date.local[1] [1] "2011-07-01 12:08:07 EDT" However, when I try to compare it to a character string, it seems to think it is equal to sometime

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread Bos, Roger
Bill, Thanks for your help. Not that I ever doubted you, but I tried your method on my actual data and I can confirm it does work. I guess I am still wondering why using .export in foreach doesn’t allow the variable to be found as that method would seem to be the most straightforward.

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

2016-10-07 Thread Jorge Cimentada
I'm sorry, there was a typo. The result is still the same: c("a" = "b") # named character vector class("a") # character class("b") # character c(names(mtcars)[1] = names(mtcars)[2]) # error class(names(mtcars)[1]) # character class(names(mtcars)[2]) # character Thanks, Jorge Cimentada

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

2016-10-07 Thread Jorge Cimentada
Hi everyone, I was hoping someone would explain why this doesn't work. c("a" = "b") # named character vector class("a") # character class("b") # character c(names(mtcars)[1] = names(mtcars[2]) # error class(names(mtcars)[1]) # character class(names(mtcars)[2]) # character Thanks, Jorge

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread William Dunlap via R-help
Using the temporary child environment works because model.frame, hence lm, looks for the variables used in the formula, subset, and weights arguments first in the data argument and then, if the data argument is not an environment, in the environment of the formula argument. Bill Dunlap TIBCO

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread William Dunlap via R-help
A more general way is to change the environment of your formula to a child of its original environment and add variables like 'weights' or 'subset' to the child environment. Since you change the environment inside a function call it won't affect the formula outside of the function call. E.g.

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread Bos, Roger
All, I figured out how to get it to work, so I am posting the solution in case anyone is interested. I had to use attr to set the weights as an attribute of the data object for the linear model. Seems convoluted, but anytime I tried to pass a named vector as the weights the foreach loop

Re: [R] weighted regression inside FOREACH loop

2016-10-07 Thread Thierry Onkelinx
Dear Roger, Maybe you want to return(mod) instead of return(mod$coef) Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht

[R] weighted regression inside FOREACH loop

2016-10-07 Thread Bos, Roger
I have a foreach loop that runs regressions in parallel and works fine, but when I try to add the weights parameter to the regression the coefficients don’t get stored in the “models” variable like they are supposed to. Below is my reproducible example: library(doParallel) cl <-

[R] Revolutions blog: September 2016 Roundup

2016-10-07 Thread David Smith via R-help
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests have written about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. In case you

Re: [R] (no subject)

2016-10-07 Thread John Dougherty
On 6 Oct 2016 07:55:28 - "abhishek pandey" wrote: > kindly solve my problem sir. > > The answer obviously is 42. JWDougherty __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see