[R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Dear R-List, I want to have descriptive stats in a special form and cannot figure out a nice solution.

[R] How to optimizing the code for calculating the launch time

2014-08-05 Thread Lingyi Ma
My dataset: Item_IdYear_Month B65623262 201204 B58279745 201204 B33671102 201204 B36630946 201204 B63270151 201204 B63270133 201204 I have written my code to calculate one more column which is the product maturity time as the following:

Re: [R] Normal probability plot examples for Wikipedia (was qqnorm with histogram?)

2014-08-05 Thread peter dalgaard
Not that I want to get deeply involved with this, but techniques that allow you to take the random variation of the plots into account are badly needed in practice. I mean, running qqnorm(rnorm(10)) a dozen times _ought_ to cure you of overinterpreting plots that are not bang-on a straight line

[R] Generate quasi-random positive numbers

2014-08-05 Thread Frederico Mestre
Hello all: Is it possible to generate quasi-random positive numbers, given a standard deviation and mean? I need all positive values to have the same probability of selection (uniform distribution). Something like: runif(10, min = 0, max = 100) This way I'm generating random positive numbers

[R] Library(mice) too slow for my dataset

2014-08-05 Thread Mª Teresa Martinez Soriano
Hi to everyone I have a big dataset (40.000 columns (variables) and 50 rows) I want to impute a lot of  variables  with  library(mice), the problem is that this process is too slow (because of my dataset, the library is brilliant). I am looking some options like Amazon web services, ( 

Re: [R] Generate quasi-random positive numbers

2014-08-05 Thread Ted Harding
On 05-Aug-2014 10:27:54 Frederico Mestre wrote: Hello all: Is it possible to generate quasi-random positive numbers, given a standard deviation and mean? I need all positive values to have the same probability of selection (uniform distribution). Something like: runif(10, min = 0, max =

Re: [R] Generate quasi-random positive numbers

2014-08-05 Thread Martyn Byng
Hi, As a slight aside, did you mean pseudo-random or quasi-random? http://en.wikipedia.org/wiki/Pseudorandom_number_generator http://en.wikipedia.org/wiki/Low-discrepancy_sequence runif gives a sequence of pseudo-random numbers, for quasi-random numbers you will need something else, for

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Jim Lemon
On Tue, 5 Aug 2014 11:36:36 AM Alain D. wrote: Dear R-List, I want to have descriptive stats in a special form and cannot figure out a nice solution. df- as.data.frame(cbind(i1=rep(+),i2=rep(+,10),i3=rep(-,10),i4=c(rep( -,2),0,rep(-,7)),i5=rep(+,10),i6=c(rep(-,9),+),i7=c(rep(+,4),0

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Thank you Jim, this is a good step in the right direction. But is there also a way to get the output in a nice dataframe with VAR1 to VAR 1 to 9 as rows? Best wishes Alain Jim Lemon j...@bitwrit.com.au hat am 5. August 2014 um 14:35 geschrieben: On Tue, 5 Aug 2014 11:36:36 AM Alain D.

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread arun
You could try: lv - levels(unique(unlist(df))) as.data.frame(t(apply(df, 2, function(x) table(factor(x, levels=lv)     +  - 0 i1 10  0 0 i2 10  0 0 i3  0 10 0 i4  0  9 1 i5 10  0 0 i6  1  9 0 i7  9  0 1 i8  4  2 4 i9  7  1 2 A.K. On Tuesday, August 5, 2014 5:36 AM, Alain D.

Re: [R] Normal probability plot examples for Wikipedia (was qqnorm with histogram?)

2014-08-05 Thread Spencer Graves
Thanks to Charles Berry for suggesting iris{datasets} and to Peter Dalgaard for suggesting Confidence Intervals as produced by qqPlot{car}. Spencer On 8/5/2014 2:55 AM, peter dalgaard wrote: Not that I want to get deeply involved with this, but techniques that allow you to take the random

[R] keep information on the number of warnings

2014-08-05 Thread Luis Borda de Agua
Dear David, Once again, thank you very much for your email. I believe I understand why I got a different number of warnings”. It seems that when you type length(warnings) you keep the information on the run before the last. I come up with a simple example called testing (you will need to

Re: [R] extract descriptive stats for categorial data from dataframe

2014-08-05 Thread Alain D.
Great! This is exactly what I was locking for! Thank you very much, arun. Best wishes Alain arun smartpink...@yahoo.com hat am 5. August 2014 um 16:47 geschrieben: You could try: lv - levels(unique(unlist(df))) as.data.frame(t(apply(df, 2, function(x) table(factor(x, levels=lv)

[R] Optim function collectively for all Rows in a dataframe

2014-08-05 Thread Sumit Khanna
Hello, In the following code, I need to calculate parameters par_1,par_2,par_3,seperately for all the rows in casted data-frame . how may I avoid the for loop because it is taking too much time , as in I want to calculate optimized parameters(initial values 0.2,0.25,0.3 ,,, so that I get

[R] break loop with keypress

2014-08-05 Thread William Simpson
This works, but it is not quite what I need: par(mar=rep(0,4)) while(1) { img1-matrix(runif(2500),50,50) dev.hold(); image(img1,useRaster=TRUE); dev.flush() img2-matrix(runif(2500),50,50) dev.hold(); image(img2,useRaster=TRUE); dev.flush() } I would like to do this: while(!kbhit())

[R] Calculation of weighted network centrality measures

2014-08-05 Thread Jiang Jenny
Hello, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales Australia. Currently my research project involves the calculating of some network centrality measures in R, which are degree, closeness, betweenness and eigen vector. However I am

[R] Calculation of weighted network centrality measures

2014-08-05 Thread Jiang Jenny
Hello, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales Australia. Currently my research project involves the calculating of some network centrality measures in R, which are degree, closeness, betweenness and eigen vector. However I am

Re: [R] Library(mice) too slow for my dataset

2014-08-05 Thread Arne H . Schulz
Dear Teresa, using such services will only speed up the imputations significantly if you can split up/parallelize your code. And maybe you can use more cores on your local machine by using packages like doSNOW, foreach and/or plyr. There are a lot of examples on the web. Kind regards Arne

Re: [R] Calculation of weighted network centrality measures

2014-08-05 Thread Sarah Goslee
Hi, This list doesn't allow most kinds of attachments. Please see the following link for some ideas on best practices for formulating your question and provided a reproducible example: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example The posting guide

[R] (no subject)

2014-08-05 Thread Jiang Jenny
Hello, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales Australia. Currently my research project involves the calculating of some network centrality measures in R, which are degree, closeness, betweenness and eigen vector. However I am

[R] object of type 'closure' is not subsettable

2014-08-05 Thread Frederic Ntirenganya
Dear All, I am getting this error: Error in boxplot$Month : object of type 'closure' is not subsettable The following is the codes i am using to produce the boxplot I need for this daily rainfall data. ## reading the data rm(list=ls(all=TRUE))

Re: [R] object of type 'closure' is not subsettable

2014-08-05 Thread Sarah Goslee
On Tue, Aug 5, 2014 at 7:33 AM, Frederic Ntirenganya ntfr...@gmail.com wrote: Dear All, I am getting this error: Error in boxplot$Month : object of type 'closure' is not subsettable probably because your dataframe is box_plot while boxplot is the name of a function. Try box_plot$Month Sarah

Re: [R] (no subject)

2014-08-05 Thread Sarah Goslee
By my count this is the third time you've posted this. Please do not do that. Please do read the posting guide. Please do not try to attach files that the list software will remove. Instead, put enough data and code in the body of your email that others on the list can reproduce your problem.

[R] Package gptk, no default option

2014-08-05 Thread Gyanendra Pokharel
Hi there, Could someone explain the input options in the function gpCreat(q,d,X,y,options) in package gptk? I tried looking at the program gpOptions.R but did not get the way to input the option Many thanks Gyan .. Gyanendra Pokharel University of Guelph Guelph, ON

[R] The R Journal, Volume 6, Issue 1

2014-08-05 Thread Deepayan Sarkar
Dear All, The latest issue of The R Journal is now available at http://journal.r-project.org/archive/2014-1/ Many thanks to all contributors, and apologies for the delay. Regards, -Deepayan ___ r-annou...@r-project.org mailing list

Re: [R] object of type 'closure' is not subsettable

2014-08-05 Thread Jeff Newmiller
boxplot is a function (closure). You probably meant bungoma_boxplot$Month? Please read the Posting Guide. One point it mentions is that this is a plain text mailing list... HTML format email is not a what-you-see-is-what-we-see format.

[R] big data?

2014-08-05 Thread Spencer Graves
What tools do you like for working with tab delimited text files up to 1.5 GB (under Windows 7 with 8 GB RAM)? Standard tools for smaller data sometimes grab all the available RAM, after which CPU usage drops to 3% ;-) The bigmemory project won the 2010 John Chambers

[R] doubleYScale from latticeExtra, problems with style

2014-08-05 Thread Troels Ring
Dear friends - below is a small example showing a problem I have understanding doubleYScale from latticeExtra - R version 3.0.2 (2013-09-25) -- Frisbee Sailing Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) Both obj1 and obj2 are

Re: [R] big data?

2014-08-05 Thread Peter Langfelder
Have you tried read.csv.sql from package sqldf? Peter On Tue, Aug 5, 2014 at 10:20 AM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: What tools do you like for working with tab delimited text files up to 1.5 GB (under Windows 7 with 8 GB RAM)? Standard tools for

[R] Equivalent of read.table for object rather than file

2014-08-05 Thread sbihorel
Hi, Let's say that I have a scalar character object called tmp which stores the entire content of an ASCII file. Is there a function that would process tmp the same way read.table() would process the content of the original ASCII file? The content of tmp will come from a database, and I want

Re: [R] qqnorm with histogram?

2014-08-05 Thread Greg Snow
Not a single function, but the subplot function in the TeachingDemos package can be used to add the histogram and/or density plot in the empty part of a qqplot. On Sun, Aug 3, 2014 at 1:38 PM, Spencer Graves spencer.gra...@structuremonitoring.com wrote: Does a function exist that

Re: [R] Equivalent of read.table for object rather than file

2014-08-05 Thread Prof Brian Ripley
On 05/08/2014 18:29, sbihorel wrote: Hi, Let's say that I have a scalar character object called tmp which stores the entire content of an ASCII file. Is there a function that would process tmp the same way read.table() would process the content of the original ASCII file? The content of tmp

[R] Revolutions blog: July 2014 roundup

2014-08-05 Thread David Smith
Revolution Analytics staff and guests write 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 missed them, here are some articles related

Re: [R] Equivalent of read.table for object rather than file

2014-08-05 Thread sbihorel
Hi, Thanks for the info. Unfortunately, read.table() does not have the text argument in the version of R that I can use. Do you know when was this argument introduced? Sebastien On 05/08/2014 18:29, sbihorel wrote: / Hi, // // Let's say that I have a scalar character object called tmp which

Re: [R] Equivalent of read.table for object rather than file

2014-08-05 Thread Prof Brian Ripley
On 05/08/2014 19:15, sbihorel wrote: Hi, Thanks for the info. Unfortunately, read.table() does not have the text argument in the version of R that I can use. Do you know when was this argument introduced? No, but the posting guide asked you to update *before posting* (have you yet read it?:

Re: [R] big data?

2014-08-05 Thread David Winsemius
On Aug 5, 2014, at 10:20 AM, Spencer Graves wrote: What tools do you like for working with tab delimited text files up to 1.5 GB (under Windows 7 with 8 GB RAM)? ?data.table::fread Standard tools for smaller data sometimes grab all the available RAM, after which CPU usage drops

[R] Frequencies for a list of vectors

2014-08-05 Thread Marie-Pierre Sylvestre
Dear R users, I have a list of vectors (list is called HTNlist). Each vector is of length 1 to 4 and takes only 0 and 1 as values. E.g. head(HTNlist) $`30008` [1] 1 0 1 0 $`60008` [1] 0 0 1 0 $`90008` [1] 0 0 1 0 $`17` [1] 1 $`130001` [1] 0 1 $`130007` [1] 1 0 1 0 I would like to

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread Rui Barradas
Hello, Maybe something like table(unlist(lapply(HTNlist, paste, collapse = ''))) (Untested, it's a bad idea not to use ?dput to give a data example.) Use dput(head(HTNlist)) # paste the output of this in a mail Hope this helps, Rui Barradas Em 05-08-2014 18:39, Marie-Pierre Sylvestre

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread William Dunlap
You can those vectors into character strings and pass them to table(). E.g., d - list(`30008`=c(1,0,1,0), `60008`=c(0,0,1,0), `90008`=c(0,0,1,0), `17`=1, `130001`=c(0,1), `130007`=c(1,0,1,0)) dChar - vapply(d, FUN=function(di)paste(di, collapse= ), FUN.VALUE=) dTable - table(dChar)

[R] R script in batch mode — Echoing messages to windows shell

2014-08-05 Thread Dominic Comtois
I have an R script which is to be run in batch mode from a Windows shell and I need to echo messages to this shell (reporting that this step has succeeded and that other failed, and so on). A combination of R CMD BATCH myscript.R con and options(echo=FALSE) is not really an option since I also

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread Peter Alspach
Alternatively, use sapply instead of lapply marieData - list('30008'=c(1,0,1,0), '60008'=c(0,0,1,0), '90008'=c(0,0,1,0), '17'=1, '130001'=c(0,1)) marieData $`30008` [1] 1 0 1 0 $`60008` [1] 0 0 1 0 $`90008` [1] 0 0 1 0 $`17` [1] 1 $`130001` [1] 0 1 table(sapply(marieData,

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread William Dunlap
Using vapply instead of sapply or unlist(lapply) here gives you a little more safety. vapply insists that you supply a FUN.VALUE argument that gives a prototype (type and length) of the expected output of FUN. It will stop if FUN returns something unexpected. Compare the following where I

Re: [R] R script in batch mode — Echoing messages to windows shell

2014-08-05 Thread David Winsemius
On Aug 5, 2014, at 1:53 PM, Dominic Comtois wrote: I have an R script which is to be run in batch mode from a Windows shell and I need to echo messages to this shell (reporting that this step has succeeded and that other failed, and so on). A combination of R CMD BATCH myscript.R con and

Re: [R] break loop with keypress

2014-08-05 Thread Greg Snow
You could create a tcltk window that looks for a button click and/or key press and when that happens change the value of a variable. Then in your loop you just look at the value of the same variable and break when the value changes. On Tue, Aug 5, 2014 at 6:13 AM, William Simpson

[R] weighted network centrality measures by network size

2014-08-05 Thread Jenny Jiang
Dear R-help, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales Australia. Currently my research project involves the calculating of some network centrality measures in R, which are degree, closeness, betweenness and eigenvector. However

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread peter salzman
hi, this may be overkill but i have a general function that tabulates lists of anything. it works on vectors as in your example. the input is a list and the output is a list with 2 elements 1) list of unique values and 2) a matching vector of counts. to that out[[1]][[k]] occurs out[[2]][k]

Re: [R] Frequencies for a list of vectors

2014-08-05 Thread peter salzman
it needs a lappend function lappend - function(lst, obj) { lst[[length(lst)+1]] - obj return(lst) } On Tue, Aug 5, 2014 at 10:59 PM, peter salzman peter.salzmanu...@gmail.com wrote: hi, this may be overkill but i have a general function that tabulates lists of anything. it works

[R-es] R y algo rendimiento

2014-08-05 Thread Marcuzzi, Javier Rubén
Estimados Hoy mientras me distraía leyendo al azar, vi un artículo sobre R para altos rendimientos, yo no dispondo de esos requerimientos informáticos, sin embargo les paso el hipervínculo por si a alguno le resulta interesante y puede aplicarlo.