Re: [R] as.character(quote(x$y) ) = "$" "x" "y" not "x$y"?

2014-05-08 Thread Bert Gunter
Spencer: Hmmm Well, I don't get what's going on here -- as.character.default is internal -- but could you method-ize a simple synonym: asChar<- function(e,...)UseMethod("asChar") asChar.call <- function(e,...)deparse(e,...) asChar.default <- function(e,...)as.character(e,...) > asChar(xDy) [

[R] GLMNet Question for Multinomial Data For Determining The Right Number of Questions

2014-05-08 Thread bill messina
I just started to use the Glmnet function for doing analysis of multinomial data. See the attached code for the analysis of the Fisher iris data as an example. My question is. When I want to determine the coefficients for the best lambda value, it returns more than one set of coefficents.. Which

[R] How to write a loop in which i has to be in POSIX format?

2014-05-08 Thread peregrine
Hallo, I have a table in which I would like to insert the min and max values of another column (date and time in as.POSIXct Format). This is my row table, where "su" and "sa" are still the same as "Vollzeit": head(treat) Vollzeit Datum Zugnacht su

[R] how di I write a for loop in which i is in POSIX?

2014-05-08 Thread peregrine
Hallo, I have a table in which I would like to insert the min and max values of another colum (date and time in as.POSIXct Format). This is my row table, where "su" and "sa" are still the same as "Vollzeit": head(treat) Vollzeit Datum Zugnacht su

[R] Help with passing in name of XTS file into write.table as a variable.

2014-05-08 Thread yanni...@gmail.com
Hi y'all, I'm using quantmod's getSymbols function, which retrieves data in XTS format. I'm trying to pass "IBM" into the "ticker" variable, then write the table referencing "ticker." However, when I run the write.table command, it writes "IBM", not the data inside IBM. Do you have any thoughts

Re: [R] Error in split.default

2014-05-08 Thread Jim Lemon
On Thu, 8 May 2014 09:01:06 PM Jason Rupert wrote: > > split(df, Status) > > Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) : > object 'Status' not found > > > names(PCR_duplicatedCheck_df) > > [1] "Key" "MinCreated" "MaxUpdated" > [4] "Status" > > I am tot

Re: [R] set axis limit in lattice

2014-05-08 Thread Duncan Mackay
Luigi I suspect that it is in accessing the correct groups within the panel function I suggest that printing the values before plotting within the panel function may give you some idea. Without specific data I cannot suggest anything else Duncan -Original Message- From: Luigi Marongiu

[R] Error in split.default

2014-05-08 Thread Jason Rupert
> split(df, Status) Error in split.default(x = seq_len(nrow(x)), f = f, drop = drop, ...) :   object 'Status' not found > names(PCR_duplicatedCheck_df)  [1] "Key"  "MinCreated"  "MaxUpdated"   [4] "Status" I am totally confused...what do I need to try next? ___

Re: [R] as.character(quote(x$y) ) = "$" "x" "y" not "x$y"?

2014-05-08 Thread Spencer Graves
On 5/8/2014 8:05 PM, Bert Gunter wrote: [1] "x$y" Spencer: Does deparse(substitute(x$y)) [1] "x$y" do what you want? No: The problem is methods dispatch. class(quote(x$y)) = 'call', but as.character(quote(x$y)) does NOT go to "as.character.call". deparse(quote(x$y)) retur

Re: [R] as.character(quote(x$y) ) = "$" "x" "y" not "x$y"?

2014-05-08 Thread Bert Gunter
[1] "x$y" Spencer: Does deparse(substitute(x$y)) [1] "x$y" do what you want? Cheers, Bert -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Thu,

Re: [R] as.character(quote(x$y) ) = "$" "x" "y" not "x$y"?

2014-05-08 Thread Spencer Graves
"as.character.call" seems not to work as an alias for deparse. Consider the following: xDy <- quote(x$y) class(xDy) "call" as.character.call <- function(x, ...)deparse(x, ...) as.character(xDy) [1] "$" "x" "y" # fails str(xDy) # language x$y as.character.language <- function(x, ...)"langua

Re: [R] overdispersed zero inflated continuous data

2014-05-08 Thread Ben Bolker
Jenushka tulane.edu> writes: > > I'm a beginning R user. > > The data: Volume of nectar in flowers under 4 different treatments, > nested > for individual (measures were taken mutliple times from different > flowers of > the same individual- never the same flower). This is really more of

Re: [R] How can I make this nested loop faster?

2014-05-08 Thread William Dunlap
I cannot run your code because not all the variables are defined, but try not doing the nested replacements, rftab$masskg[...] <- newValue, in the loop. Instead, pull out masskg as a new stand-along object before the start of the loop and put it back into rftab at the end of the loop. E.g., someth

[R] How can I make this nested loop faster?

2014-05-08 Thread Ludwig Hilger
Hello everybody, I have written a nested for-loop, but as length(uc) > 170,000, this would take VERY long. I have tried to use sapply or something but I cannot get it to work, I would be happy if someone could point out to write this more efficiently. Thank you all, Ludwig ergsens <- data.frame(

Re: [R] Capture change in variable in R

2014-05-08 Thread David Winsemius
On May 8, 2014, at 9:49 AM, Abhinaba Roy wrote: > Hi R helpers, > > I have a dataframe like > > ID Yr_Mnth AMT_PAID AMT_DUEpaidToDue > CS0026A201301 320.48 19040.168319328 > CS0026A2013024881.31157080.310753119 > CS0026A2

[R] Capture change in variable in R

2014-05-08 Thread Abhinaba Roy
Hi R helpers, I have a dataframe like ID Yr_Mnth AMT_PAID AMT_DUEpaidToDue CS0026A201301 320.48 19040.168319328 CS0026A2013024881.31157080.310753119 CS0026A2013037609.04255850.297402384 CS0026A201304

Re: [R] group by and merge two dataframes

2014-05-08 Thread arun
Hi, May be: indx <- !duplicated(as.character(interaction(df1[,-3]))) merge(df1[indx,],df2) A.K. On Thursday, May 8, 2014 12:34 PM, Massimo Bressan wrote: yes, thank you for all your replies, they worked out correctly indeed... ...but because of my fault, by then working on my real data I ful

Re: [R] group by and merge two dataframes

2014-05-08 Thread Massimo Bressan
yes, thank you for all your replies, they worked out correctly indeed... ...but because of my fault, by then working on my real data I fully realised that I should have mentioned something that is changing (quite a lot, in fact) the terms of the problem... please would you consider the follow

Re: [R] R for Android

2014-05-08 Thread Kevin E. Thorpe
Thanks. I guess I could have searched for that. Apologies. I'll have to try it on my tablet. Kevin On 05/08/2014 11:57 AM, Jeremy Miles wrote: It exists: https://play.google.com/store/apps/details?id=com.appsopensource.R No graphics. Jeremy On 8 May 2014 05:44, Kevin E. Thorpe mailto:ke

Re: [R] R for Android

2014-05-08 Thread Jeremy Miles
It exists: https://play.google.com/store/apps/details?id=com.appsopensource.R No graphics. Jeremy On 8 May 2014 05:44, Kevin E. Thorpe wrote: > This is a question asked purely out of idle curiosity (and may also be in > wrong list). Are there plans for porting R to Android devices or > chro

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Simon Wood
Hi Mark, The problem here is that the constructor expects there to be at least one observation per location. The nb.l list has neighbourhood information for 166 locations, while the 'obs' data contains observations for only 99 of them (unique(obs$xy.idx)). The solution probably requires more

Re: [R] group by and merge two dataframes

2014-05-08 Thread arun
Hi, May be this helps:  merge(unique(df1),df2) A.K. On Thursday, May 8, 2014 5:46 AM, Massimo Bressan wrote: given this "bare bone" example: df1 <- data.frame(id=rep(1:3,each=2), item=c(rep("A",2), rep("B",2), rep("C",2))) df2 <- data.frame(id=c(1,2,3), who=c("tizio","caio","sempronio"))

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Mark Payne
Hi Roger and Simon, Thanks for the replies. Simon's suggestion of an isolated or missing neighbourhood doesn't hold either. I've attached the code below - its my attempt to solve the FELSPLINE sausage using mrf rather than a soap smoother. Its a bit convoluted, but should run ok. I thought this w

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Simon Wood
Hi Mark, I'm not sure what is happening here - there is no chance that nb.l contains a neighbourhood not in the levels of obs$xy.idx, I suppose? i.e. is all(names(nb.l)%in%levels(obs$xy.idx)) also TRUE? Here is some code illustrating what nb should look like (and in response to Roger Bivand

Re: [R] Outlier Detection with k-Means

2014-05-08 Thread marioger
Thank you very much. This was exactly what I was looking for. -- View this message in context: http://r.789695.n4.nabble.com/Outlier-Detection-with-k-Means-tp4690098p4690186.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pr

[R] R for Android

2014-05-08 Thread Kevin E. Thorpe
This is a question asked purely out of idle curiosity (and may also be in wrong list). Are there plans for porting R to Android devices or chromebooks? Maybe it's as simple as compiling the source, but I don't know what tools are available. One of the current advantages of R is it runs on all

Re: [R] group by and merge two dataframes

2014-05-08 Thread Rui Barradas
Hello, There are some alternatives without using sqldf or another package. 1. tmp2 <- aggregate(item ~ id, data = df1, FUN = unique) Then merge() like you've done. 2. tmp3 <- merge(df1, df2) tmp3[!duplicated(tmp3), ] Hope this helps, Rui Barradas Em 08-05-2014 10:44, Massimo Bressan escr

Re: [R] MRF smoothers in MGCV - specifying neighbours

2014-05-08 Thread Roger Bivand
Mark Payne gmail.com> writes: > > Hi, > > Does anyone have an example of a Markov Random Field smoother (MRF) in MGCV > where they have specified the neighbourhood directly, rather than supplying > polygons? Does anyone understand how the rules should be? Based on the > columb example, I have s

[R] group by and merge two dataframes

2014-05-08 Thread Massimo Bressan
given this "bare bone" example: df1 <- data.frame(id=rep(1:3,each=2), item=c(rep("A",2), rep("B",2), rep("C",2))) df2 <- data.frame(id=c(1,2,3), who=c("tizio","caio","sempronio")) I need to group the first dataframe "df1" by "id" and then merge with the second dataframe "df2" (again by "id")

[R] problem in r-code

2014-05-08 Thread thanoon younis
dear all members is there anyone explain to me the code below and how can i transfer this code to winbugs program. q[i,1]=qnorm(runif(1,min=.5,max=1),0,1) thanks in advance thanoon [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] R / JMP interface

2014-05-08 Thread Robert Douglas Kinley
thanks Michael. That fits in with the response from JMP and with the experience of colleagues. Guess I'll just stick with R :) cheers Bob -Original Message- From: Meyners, Michael [mailto:meyner...@pg.com] Sent: 08 May 2014 07:20 To: Samuel J Gardner; Robert Douglas

Re: [R] Fitting a Mixture of Noncentral Student t Distributions to a one-dimensional sample

2014-05-08 Thread Ingmar Visser
Hi Johannes, Below code gives good results for me; note that trying multiple starting is often important in fitting mixture models, even in simple cases like this. Note also that the sigma and nu parameters in gamlssMX are fitted on a log scale, hence the possible occurrence of negative results. ht