Re: [R] readBin documentation error

2016-09-02 Thread Yucheng Song via R-help
Thanks for the reply. What I meant was that there is no int(), if you do a ?readBin, you will find it there. On Friday, September 2, 2016 6:31 AM, Jim Lemon wrote: Hi Yucheng, Have a look at "An Introduction to R" (get there with "help.start()"), section : 3.1

Re: [R] svytable: How do i create a table informing a third variable?

2016-09-02 Thread Juan Ceccarelli Arias
Thanks a lot. Your code does the trick. One last question: The tabulate produced is showing every cross in just one column. I mean, it presents the region by order and sex=1, and then again the region but by sex==2. Can i list or present as this: sex1 sex2 region1 323.

Re: [R] svytable: How do i create a table informing a third variable?

2016-09-02 Thread Anthony Damico
# mean svymean( ~ income_variable , NN ) svyby( ~ income_variable , ~ age + sex , NN , svymean ) # median svyquantile( ~ income_variable , NN ) svyby( ~ income_variable , ~ age + sex , NN , svyquantile , 0.5 ) On Fri, Sep 2, 2016 at 3:04 PM, Juan Ceccarelli Arias wrote: >

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Bert Gunter
Chuck: I think this is quite clever. But note that the which() is unnecessary: logical indicing suffices, e.g. df[!duplicated(df[,c("f","g")],fromLast = TRUE),] I thought that your approach would be faster because it moves comparisons from the tapply() to C code. But I was wrong. e.g. for 1e6

[R] svytable: How do i create a table informing a third variable?

2016-09-02 Thread Juan Ceccarelli Arias
Hello Im analyzing a survey and i need to obtain some statistics per groups. Im able to create a table with sex and age. However, if i want to know how much income earns the population by sex and age, i can't. Im loading the dataset as describe the line below NN <- svydesign(ids = ~1, data =

Re: [R-es] Ayuda con gráfico típico de histograma más linea

2016-09-02 Thread Carlos Ortega
Hola, Aproximación muy sencillita...con gráficos "base": #- datIn <- read.csv("pec.csv", header = TRUE, sep = ";", dec = ",") par(mfrow = c(2,1)) barplot( datIn$frec ,las = 1 ,col = "green" ,cex.axis = 0.7, col.axis = "red", font.axis = 2

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Charles C. Berry
On Fri, 2 Sep 2016, Bert Gunter wrote: [snip] The "trick" is to use tapply() to select the necessary row indices of your data frame and forget about all the do.call and rbind stuff. e.g. I agree the way to go is "select the necessary row indices" but I get there a different way. See below.

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Jun Shen
Hi Bert, This is the best method I have seen this year! do.call, rbind has just gone to museum :) It took ~30 second to get the results. You deserve a medal Jun On Fri, Sep 2, 2016 at 1:51 PM, Bert Gunter wrote: > This is the sort of thing that dplyr or the

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread ruipbarradas
Hello, Try ?aggregate, it's probably faster. With a made up data.frame, since you haven't provided us with a dataset, simout.s1 <- data.frame(SID = rep(LETTERS[1:2], 10), DOSENO = rep(letters[1:4], each = 5), value = rnorm(20)) res2 <- aggregate(simout.s1$value,

Re: [R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Bert Gunter
This is the sort of thing that dplyr or the data.table packages can probably do elegantly and efficiently. So you might consider looking at them. But as I use neither, let me suggest a base R solution. As you supplied no data for a reproducible example, I'll make up my own and hopefully I have

[R] Improve code efficient with do.call, rbind and split contruction

2016-09-02 Thread Jun Shen
Dear list, I have the following line of code to extract the last line of the split data and put them back together. do.call(rbind,lapply(split(simout.s1,simout.s1[c('SID','DOSENO')]),function(x)x[nrow(x),])) the problem is when have a huge dataset, it takes too long to run. (actually it's > 3

Re: [R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread Hadley Wickham
You can use readr::write_excel_csv() which adds a BOM that forces excel to read as UTF-8. Hadley On Friday, September 2, 2016, Erich Neuwirth wrote: > read_excel in Hadley’s readxl package > should handle your encoding problems. > Writing Excel files on a Mac,

Re: [R] problem writing .bil files in netcdf

2016-09-02 Thread Michael Sumner
On Fri, 2 Sep 2016 at 00:43 Abdoulaye SARR wrote: > Dear List, > > I have daily rainfall data in .bil format and can get info of the file > using rgdal: > > > library(rgdal) > > GDALinfo("/1981/v2p19810101.bil") > rows1600 > columns 1500 > bands 1 >

Re: [R] Off topic, but hopefully not totally irrelevant: on MS Excel and genomics

2016-09-02 Thread John McKown
On Fri, Sep 2, 2016 at 9:10 AM, John Kane wrote: > Over the last few years I came to the conclusion that using a spreadsheet > for anything more complicated than my shopping list was madness. > I am now reconsidering my position on shopping lists. > ​I got a real laugh out

Re: [R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread John Kane
An alternative to Erich Neuwirth's solution might be to use Apache OpenOffice or the (roughly) equivalent LibreOffice. I routinely use UTF-8 with these. John Kane Kingston ON Canada > -Original Message- > From: govo...@gmail.com > Sent: Fri, 2 Sep 2016 13:03:20 +0200 > To:

Re: [R] Off topic, but hopefully not totally irrelevant: on MS Excel and genomics

2016-09-02 Thread John Kane
Over the last few years I came to the conclusion that using a spreadsheet for anything more complicated than my shopping list was madness. I am now reconsidering my position on shopping lists. Thanks Bert. I have a small collection of spreadsheet errors that have been published here and there

Re: [R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread Erich Neuwirth
read_excel in Hadley’s readxl package should handle your encoding problems. Writing Excel files on a Mac, however, still is somewhat messy. And you probably should post this kind of question on r-sig-mac On 02 Sep 2016, at 13:03, Kai Mx wrote: > > Hi all, > > I am hoping

[R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread Kai Mx
Hi all, I am hoping for some advice on how to handle UTF-8 spreadsheet files in a Mac environment - sort of off-topic, but still relevant for hopefully a bunch of people. I am using R on Mac OS 10.10. Sometimes I have the urge to actually look at a large spreadsheet on the big screen or make

Re: [R] robumeta package - error

2016-09-02 Thread Michael Dewey
Dear Kristina I do not use that package so cannot offer any direct help but 1 - can you fit the model with any other combination of parameters? 2 - what happens if you vary rho? 3 - if your data-set is small and not confidential can you share it, otherwise can you show us str(anxiety_control)

Re: [R] readBin documentation error

2016-09-02 Thread Jim Lemon
Hi Yucheng, Have a look at "An Introduction to R" (get there with "help.start()"), section : 3.1 Intrinsic attributes: mode and length The distinction between numeric and integer modes in R may not be obvious, but it is important at times. Jim On Fri, Sep 2, 2016 at 5:47 AM, Yucheng Song via

Re: [R] plot.drm in "drc" package

2016-09-02 Thread PIKAL Petr
Hi I do not consider myself as an expert in drc. AFAIK in drc plotting you plot response against actual dose. You have 3 options Plot dose values in non log axis plot(mod, type="all", log="") Plot dose values in log axis plot(mod, type="all", log="x") or plot log(dose) values in non log axis

[R] readBin documentation error

2016-09-02 Thread Yucheng Song via R-help
Hi,  In the help or readBin, there is an "int", but actually there is no int(), do you mean some other types?  In fact, numeric() is kind of misleading, what does it mean? what Either an object whose mode will give the mode of the vector to be read, or a character vector of length one

[R] : Extra loops in order to fill in a 3D table

2016-09-02 Thread Harris Agiropoulos via R-help
Hello all, I would like to have two or maybe three extra “for”. One for changing beta_x with values 0.00 and 0.20 and the others for changing phi_x and phi_y with values 0.00, 0.30, 0.90. Does anyone know how to implement this? library(MASS) library(forecast) library(lmtest) library("dyn")