Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Jeff Newmiller
Suggested reading An Introduction to R, section 5.3 The Posting Guide, mentioned at the bottom of this message, which mentions that this is a pain text mailing list so don't post in HTML (it gets mangled). -- Sent from my phone. Please excuse my brevity. On March 24, 2016 10:09:46 PM PDT,

Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Hiroyuki Sato
Hello Ulrik Thank you for replying. The real data has many IDs( about 3,000 IDS). So I want to find missing values with function or something. If 104 not in s, then add 104 value with all column zero. And also real data has many columns( 80 ~ 5,000, columns. it is not fixed length ). So I would

Re: [R] How to add no data entries into current dataframe?

2016-03-24 Thread Ulrik Stervbo
Hi Hiroyuki, The row bind function rbind() is what you need s <- dcast(s,ID ~ CODE, value.var="VAR",sum) df2 <- data.frame(ID = c(104, 105), PDT1 = 0, PDT2 = 0, PDT3 = 0) rbind(s, df2) hope this helps Ulrik On Fri, 25 Mar 2016 at 05:52 Hiroyuki Sato wrote: > Hello

[R] How to add no data entries into current dataframe?

2016-03-24 Thread Hiroyuki Sato
Hello members Question Could you tell me how to add ID 100, 104, 105 values with zero? 1, Source data ID 100, 104 and 105 has no values. > s ID DATE VAR CODE 1 101 20160301 1 PDT1 2 102 20160301 1 PDT2 3 103 20160301 1 PDT3 4 103 20160302 1 PDT3 s <- structure(list(ID = c(101L, 102L, 103L,

[R] Trouble reshaping data to my satisfaction

2016-03-24 Thread Jennifer Sabatier
#I am having a lot of trouble reshaping this data. #This is just an examination of sample size on the margin of error that I did for a colleague. #Nothing complicated. #But restructuring the data...another story #Here's code to produce the dataset: n <- seq(1, 10, by=1) P <-

Re: [R] K mean clustering with extra constraints

2016-03-24 Thread Ranjan Maitra
Hannah, Let me see if I can understand your question. You have 10 observations of a single variable (perhaps some sort of price?). You also have an equivalence matrix between these observations (which you possibly called nodes) which stipulates if they are connected together or not. Given

Re: [R] R-help Digest, Vol 157, Issue 25

2016-03-24 Thread Boris Steipe
If the number of values are always the same, the proposed strategies will work for you. If they are not the same, you need a completely different approach. Most importantly, you will need to figure out which columns correspond to missing values. Is it always the last ones that are dropped? If

[R] K mean clustering with extra constraints

2016-03-24 Thread Tsai Rainbow
Hi, I am a new R user. I have seen the use of kmeans in clustering. However, I would like to ask how I can add more constraints to the kmeans. For example, I have a set of data for a 10 nodes network, price = c(84, 96, 57, 53, 90, 94, 81, 66, 93, 54) I want to use K mean to to group this set of

Re: [R] Export the result k-means cluster to CSV file

2016-03-24 Thread S Ellison
> Hello Everyone : i have  done the clustering  process by k-means cluster, > then i > try to save[Export ] the groups of clustering, to txt, or CSV files , how i > can do > that Depends what you want. You can save the whole object for reloading using save() The cluster members can be written

Re: [R] glmer() -> corrected AUC optimism by bootstraping technic bootMer() [internal validation of a mixed-effects-model]

2016-03-24 Thread Bert Gunter
1. I cannot find a question here. Maybe I missed it. Maybe you should be clearer. 2. You should most this on the mixed-models list, rather than here: https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep

Re: [R] package FD

2016-03-24 Thread Fabio Monteiro
Hi again Is there any way to check the relations between dbFD indexes? Function cor for example? I can't manage to put the informations correctly I want to see the relationships between the dbFD output (nbsp, sing.sp, FRic, FEve, FDiv, FDis and RaoQ) How should I type it? Thank you Fábio

Re: [R] Fwd: question on constrOptim

2016-03-24 Thread Jeff Newmiller
You are unlikely to get help on this without a reproducible example. One obvious possibility is that those values are already optimal. Another is that you are not invoking the optimization properly. -- Sent from my phone. Please excuse my brevity. On March 24, 2016 5:13:35 AM PDT, Anusha

Re: [R] R-help Digest, Vol 157, Issue 25

2016-03-24 Thread Burhan ul haq
Thanks to Boris Steipe, Jim Lemon and Ivan Calandra for replying. I messed up while copying, there are equal number of values for each country. @ Ivan, In case there were different number of values, and we wanted to fill in with 1) NA, or 2) "average of the rest of values" in the missing

Re: [R] Fwd: question on constrOptim

2016-03-24 Thread Duncan Murdoch
On 24/03/2016 8:13 AM, Anusha Kothapalli wrote: -- Forwarded message -- From: *Anusha Kothapalli* Date: Wednesday, March 23, 2016 Subject: question on constrOptim To: r-c...@r-project.org To Whom It May Concern, We are using constrOptim to maximize a log

[R] Fwd: question on constrOptim

2016-03-24 Thread Anusha Kothapalli
-- Forwarded message -- From: *Anusha Kothapalli* Date: Wednesday, March 23, 2016 Subject: question on constrOptim To: r-c...@r-project.org To Whom It May Concern, We are using constrOptim to maximize a log likelihood function. The constrOptim call returns

[R] glmer() -> corrected AUC optimism by bootstraping technic bootMer() [internal validation of a mixed-effects-model]

2016-03-24 Thread Andreu Ferrero Gmail
> > > I would like to do an internal validation of a discriminative ability of a > mixed effects models. > > Here is my scrip: > > ### > bootMer-> boot AUC# > ### > > library(lme4) > library(lattice) > data(cbpp) > > #fit a model >

[R] Export the result k-means cluster to CSV file

2016-03-24 Thread hehsham alpukhity via R-help
Hello Everyone : i have  done the clustering  process by k-means cluster, then i try to save[Export ] the groups of clustering, to txt, or CSV files , how i can do that #clusrer.data <- function(data,n) { miRNA.exp.cluster <- scale(t(miRNA.exp))

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

2016-03-24 Thread sbihorel
Thanks for the precision. On 3/24/2016 10:40 AM, Duncan Murdoch wrote: On 24/03/2016 10:28 AM, sbihorel wrote: Hi, Thanks for your suggestion. missing(x) works only if x is not altered within the function, which is not the case in my actual function (which is more complex than the example

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

2016-03-24 Thread S Ellison
> Are you aware of any function what would query the original function call > arguments no matter what happens in the function? Use missing() first. If you can't use missing() first, or use it early in a parent function and pass a flag, you could perhaps pass a copy of the parent function call

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

2016-03-24 Thread Duncan Murdoch
On 24/03/2016 10:28 AM, sbihorel wrote: Hi, Thanks for your suggestion. missing(x) works only if x is not altered within the function, which is not the case in my actual function (which is more complex than the example function I send in my previous post). That's not quite true: missing(x)

Re: [R] Problems installing docopt

2016-03-24 Thread Neale Ferguson
The problem was that this was in a Docker container which is based on a strip down base image. While I had restored glibc-common and its locale information, there was still stuff removed from glibc that was required. Reinstalled it and building cleanly. Thanks, Neale On 3/23/16, 11:53 PM, "David

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

2016-03-24 Thread sbihorel
Hi, Thanks for your suggestion. missing(x) works only if x is not altered within the function, which is not the case in my actual function (which is more complex than the example function I send in my previous post). Are you aware of any function what would query the original function call

Re: [R] Is there dpois equivalent for zero-inflated Poisson?

2016-03-24 Thread Michael Friendly
Neat! It would be nice to complete dzipois() with the corresponding rzipois() and pzipois() functions. I would have found these useful in my new book, http://ddar.datavis.ca -Michael On 3/23/2016 11:27 AM, Martin Maechler wrote: Thierry Onkelinx on Tue, 22

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

2016-03-24 Thread Jeff Newmiller
Don't provide a default value for c in the parameter list. Then you can use the missing() function to make decisions, including whether to generate a default value for c or not. -- Sent from my phone. Please excuse my brevity. On March 24, 2016 5:11:43 AM PDT, sbihorel

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

2016-03-24 Thread sbihorel
Hi, Please consider the following functions: myf1 <- function(x,fun){ if (is.null(fun)){ x } else { do.call(fun, list(x)) } } myf2 <- function(a=1, b=2, fun=NULL, c=myfun1(b,fun)){ if (myf1(b,fun)>0 & ){ c <- b } print(list(a,b,c)) } myf2(a=2,b=3,fun=exp)

Re: [R] Why missing values are not allowed in 'poly'?

2016-03-24 Thread Martin Maechler
> William Dunlap via R-help > on Wed, 23 Mar 2016 13:56:35 -0700 writes: > I don't know what is in R's poly(), but if it is like S+'s or TERR's then > one could do > if (anyNA(x)) { > nax <- na.exclude(x) > px <- poly(x = nax, degree =

Re: [R] Splitting a vector into data frame

2016-03-24 Thread Ivan Calandra
Hi! As Boris explained, if you do not always have the same number of values per country, you need to provide more details, e.g. should the empty cells be filled with NA? But if you do always have 20 values per country (unlike in your sample data), then this could work for you: mydf <-

Re: [R] Splitting a vector into data frame

2016-03-24 Thread Jim Lemon
Hi Burhan, As all of your values seem to be character, perhaps: country.df<-as.data.frame(matrix(temp.data,ncol=22,byrow=TRUE)[,2:21]) if there really are 2 country names and 20 values for each country. As Boris has pointed out, there are different numbers of values following the country names

Re: [R] Splitting a vector into data frame

2016-03-24 Thread Boris Steipe
Your data rows have different numbers of columns. Thus your problem is not sufficiently specified. B. On Mar 24, 2016, at 6:30 AM, Burhan ul haq wrote: > Hi, > > 1. I have scraped some data from the web, subset shown below > >> dput(temp.data) > c("Armenia", "Armenia",

[R] Splitting a vector into data frame

2016-03-24 Thread Burhan ul haq
Hi, 1. I have scraped some data from the web, subset shown below > dput(temp.data) c("Armenia", "Armenia", "43827", "39200", "35700", "36700", "39341", "30571", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", " 0", "0", "0", "0", "0", "Austria", "Austria", "135417", "166200", "144500",