Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-25 Thread Marius Hofert
Dear Paul, Thanks. Redrawing the points solves it for the minimal example, but what happens if you have plot(.., type=b) like below? Actually, originally I wanted to use just grid (without mixing it with base graphics), but I couldn't find an equivalent for plot(.., type=b). Also, later on, I

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-25 Thread arun
HI, In a text file of 6834 words, I compared your program with a modified program. sapply(strsplit(txt1, ),length) #[1] 6834 #your program system.time({ txt1-tolower(scan(text_file,character,sep=\n)) pattern - (\\b[A-Za-z]+\\b) match - gregexpr(pattern,txt1) words.txt - regmatches(txt1,match)

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-25 Thread arun
HI, In the previous email, I forgot to add unlist(). With four paragraphs, sapply(strsplit(txt1, ),length) #[1] 4850 9072 6400 2071 #Your code: system.time({ txt1-tolower(scan(text_file,character,sep=\n)) pattern - (\\b[A-Za-z]+\\b) match - gregexpr(pattern,txt1) words.txt -

Re: [R] Strange data frame behavior

2012-09-25 Thread Jeff Newmiller
This has nothing to do with data frames and everything to do with how factors behave. The levels of a factor are not necessarily linked with the content of the factor. For example, a factor representing Male and Female has both of those levels even if all the data in a subset represents Male.

Re: [R] Strange data frame behavior

2012-09-25 Thread PIKAL Petr
Hi -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Raoni Rodrigues Sent: Tuesday, September 25, 2012 7:22 AM To: r-help@r-project.org Subject: [R] Strange data frame behavior Hello all, I don't understand a strange

Re: [R] mapping data from table to .csv template

2012-09-25 Thread PIKAL Petr
Hi your data are difficult to read so I make my own set.seed(111) sender-sample(letters[1:5], 20, replace=T) receiver-sample(letters[1:5], 20, replace=T) xtabs(~sender+receiver) receiver sender a b c d e a 1 1 3 1 0 b 0 1 0 1 1 c 1 3 2 2 0 d 0 1 0 0 1 e 0 0 0 1 0

Re: [R] mapping data from table to .csv template

2012-09-25 Thread Heramb Gadgil
Try the following code. It is basic but effective; *setwd(/home/user2/Documents)* *Test_matrix=read.csv(Trial.csv,header=T) # The 1st table that you have considered * *Test_matrix=as.matrix(Test_matrix)* *Writer=function(mat){u=unique(mat[,Subject])* *l=length(u)*

[R] Add-on Package

2012-09-25 Thread Kizito Omala
I have downloaded a package 'combniat' , it now exists in the library. I even loaded it using: library(combinat). But when I call the function tosscoin(1), I instead get an error message: Error: could not find function tosscoin. Kindly help. Kizito.

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
Hi, Thanks for helping me with this one. To save you time, the following is the code for the tables I uploaded as jpegs that you may not have received: dat1-data.frame(Species=paste(Species,1:3),Site1=c(5,NA,4),Site2=c(3,2,4),Site3=c(NA,5,NA))

Re: [R] Add-on Package

2012-09-25 Thread Berend Hasselman
On 25-09-2012, at 09:04, Kizito Omala kizrom...@gmail.com wrote: I have downloaded a package 'combniat' , it now exists in the library. I even loaded it using: library(combinat). But when I call the function tosscoin(1), I instead get an error message: Error: could not find function

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Heramb Gadgil
We can have something like this; *Data1-data.frame(Site1=c(5,NA,4),Site2=c(3,2,4),Site3=c(NA,5,NA)) Data2-data.frame(TraitType1=c(1,2,3),TraitType2=c(2,4,2),TraitType3=c(5,1,1)) * *rownames(Data1)-paste(Species,1:3)* *rownames(Data2)-paste(Species,1:3)*

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread PIKAL Petr
Hi thanks for data. Probably others can come with better solution with library(reshape) you can put your data to better form dat2.m-melt(dat2) dat1.m-melt(dat1) merge them dat-merge(dat1.m, dat2.m, by=Species) and finally compute required values select one site temp-dat[dat[,2]==Site3

[R] multinomial MCMCglmm

2012-09-25 Thread Vaniscotte Amélie
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set is a trapping data set, where the observation at each trap (1 or 0 for different species) have been aggregated per traplines (i.e sum over 25 traps).

[R] boxplot names italic

2012-09-25 Thread Wolf Sarah
Hello I have two boxplots and want the names to be in italic, which works fine, except that the second name (Sinapis) is raised, compared to the first name: bicran-c(0.55,0.25,0.6,0.83,0.11,0,0.67,1.36,0.9,1.09) bicsin-c(0.09,0.53,0.45,0.38,1.18,0.45,0.78,1.17,1.22,1.4)

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Rui Barradas
Hello, Try the following. countTrait - function(x) length( unique(x[x != 0]) ) presence - 1*(!is.na(dat1[-1])) result - apply(presence, 2, function(x) apply(dat2[, -1]*x, 2, countTrait)) result - t(result) rowSums(result) #Site1 Site2 Site3 # 5 7 3 Hope this helps, Rui Barradas Em

[R] corrgram

2012-09-25 Thread paladini
Hallo, I have a question concerning the function correlogram from library(corrgram). Is it possible do write the variable names not in the diagonal but on the left and at the buttom of the graphic? I searched the manual and tried a lot but didn't get it. Thank you very much and best

[R] calculation of diversity confidence interval

2012-09-25 Thread Michael Eisenring
Dear R-help members. Maybe this is not the right platform to ask this, but I'm looking desperately for a test which is calculating confidence intervals from diversity measurements (non-normaly distributed) (fishers alpha diversity). I was checking the package vegan but there seems to be nothing

[R] how to specify the multinomial distribution in R

2012-09-25 Thread zhijie zhang
Dear All, Could we specify the multinomial distribution in R when doing Bayesian data analysis through R2WinBUGS? See below for my issues. t2[i,1:2] ~ dmulti(p2[i,1:2],n2[i]) #t2[] is a matrix with two columns, the problem is how to specify it in R p2[i,1] - (p[i] * s1[t[i]] * s2[t[i]] + (1 -

Re: [R] Problem with R script

2012-09-25 Thread Jim Lemon
On 09/24/2012 11:15 PM, Woo Back Lee wrote: To whom I concern, I am a recent user of program R I do not know how to explain this but after I installed the program the words on the scrpit does R console does not appear clear but something square(?)/Cube(?) which seems like the words are broken

Re: [R] boxplot names italic

2012-09-25 Thread Jim Lemon
On 09/25/2012 06:08 PM, Wolf Sarah wrote: Hello I have two boxplots and want the names to be in italic, which works fine, except that the second name (Sinapis) is raised, compared to the first name: bicran-c(0.55,0.25,0.6,0.83,0.11,0,0.67,1.36,0.9,1.09)

[R] Bug or misunderstanding of par(pin)?

2012-09-25 Thread Vera Thiemig
Dear all, I am currently trying to create a plot showing multiple single plots, for which the important issue is that the size of each plot region (not figure region!) has to be of a fixed dimension (in my case: width=1 inch, height= 0.87 inches). I tried to use pin to fix the plotting region to

Re: [R] R for commercial use

2012-09-25 Thread mlell08
Hi, On 24.09.2012 16:21, Zastko,Samuel ALB co-mw wrote: Hi everyone, want to use R in our company but have to complete an intern questionnaire first. Can anyone help? Thanks in advance! Here the questions I’m not sure about: 1. Is R a Clientsoftware / Serversoftware / Systemsoftware?

[R] how to pass a function to a function inside a function

2012-09-25 Thread Al Ehan
Hi, I'm trying to compile two functions into one function. the first funtion is called 'fs' which is self-made function, another function is from the built-in 'integration' function that is copy-paste-edited. If built separatey, these functions work well. However that is not the case if combines

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
Fantastic help - thanks guys. Heramb, Pikal and Rui all came up with solutions. I prefer Rui's as it seems the simplest. I'm going to try and work through them to understand exactly what's going on at each stage. Thanks again all, Ben Gillespie Research Postgraduate School of Geography

Re: [R] how to pass a function to a function inside a function

2012-09-25 Thread Rui Barradas
Hello, Your function creates the vector 'x', then creates the function fs(), then returns the function just created. It _never_ reaches the line intgrt - function(lower) { and therefore never creates this last function. Now supposed it did. In the very end you make the same mistake, you

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-25 Thread Martin Maechler
arun smartpink...@yahoo.com on Mon, 24 Sep 2012 19:59:35 -0700 writes: HI, In the previous email, I forgot to add unlist(). With four paragraphs, sapply(strsplit(txt1, ),length) #[1] 4850 9072 6400 2071 #Your code: system.time({

Re: [R] Bug or misunderstanding of par(pin)?

2012-09-25 Thread Sarah Goslee
Hi Vera, You need to do it in two steps, I think because the different parameters you're trying to set interact. par(mfrow=c(3,4),mai=c(0.04,0.04,0.04,0.04), omi=c(0.2,0.32,0.32,2.16)) par(pin=c(1,0.87)) for(i in 1:12) plot(1:10, 1:10) For this level of control, you probably also want to

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
Excellent - thanks so much. Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: arun [smartpink...@yahoo.com] Sent: 25 September 2012

[R] multinomial MCMCglmm

2012-09-25 Thread Vaniscotte
Dear all, I would like to add mixed effects in a multinomial model and I am trying to use MCMCglmm for that. The main problem I face: my data set is a trapping data set, where the observation at each trap (1 or 0 for several species) have been aggregated per trapline (i.e. 25 traps). Therefore

Re: [R] Mean calculation of groups

2012-09-25 Thread Bert Gunter
Nico: 1. Thanks for the example. 2. Please read -- or at least peruse -- the tutorial, An Introduction to R (or other tutorial that you might find on the Web, there are many) to familiarize yourself with R's features. 3. This is an example of what the apply() family of functions can do, so you

[R] RGL plot : cex and zlim arguments do not work

2012-09-25 Thread Stephane Chantepie
Dear all, I have a quiet simple problem (shared by a collegue) but no solution at yet. The arguments I use in bbox3d or text3d do not have any effect on the graph. I need to use 'cex' and 'zlim' but It does not work. Maybe my problem could appear trivial but I have spent a lot of time on that. If

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-25 Thread Milan Bouchet-Valat
Le lundi 24 septembre 2012 à 16:29 -0700, mcelis a écrit : I am working with some large text files (up to 16 GBytes). I am interested in extracting the words and counting each time each word appears in the text. I have written a very simple R program by following some suggestions and examples

[R] Error in Johnson Fit

2012-09-25 Thread prajamitra bhuyan
Dear Sir/Madam, As mentioned in help, R reports error while fitting Johnson distribution by method of moments. I have used moments from Weibull distribution and hence it is well within the feasible area and try to fit Johnson distribution using method of moments. As for example, shape=0.5 #

[R] Three Stage Sampling of categorical variable using 'survey' in R

2012-09-25 Thread Kristof
For a sanitation project in Bangladesh I need to design a three stage sample survey to be representative of around 40 million people. I find myself suddenly with several challenges with which I struggle and would be gratefully for any help. As the questions are linked I kept them together rather

[R] extract all data frames from a list remove NAs

2012-09-25 Thread Dimitris r
hi, steps taken : files-lapply(list.files(),read.csv,header=T) numberOfFiles-length(list.files()) good-lapply(files,complete.cases) cleanDataSets-list() for (i in 1:numberOfFiles){ cleanDataSets[i]=files[[i]][good[[i]],] } with this loop for some reason i get only the first column from

[R] add a data frame to my data frame

2012-09-25 Thread Tagmarie
Hello, Once again I feel so dumb. Can anyone help me? I have a data frame somewhat like that: myframe - data.frame (ID=c(Ernie, Ernie, Bert, Bert), Timestamp=c(24.09.2012 09:00, 25.09.2012 09:00, 24.09.2012 10:00, 25.09.2012 10:00), Hunger=c(1,1,2,2) ) myframestime - as.POSIXct

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Rui Barradas
Hello, You must run the line defining function countTrait first in order to create it. Then run the rest. Rui Barradas Em 25-09-2012 13:42, Benjamin Gillespie escreveu: Hi Rui, thanks, but I get this: result - apply(presence, 2, function(x) apply(dat2[, -1]*x, 2, countTrait)) Error in

[R] REML - quasipoisson

2012-09-25 Thread Greg Dropkin
hi I'm puzzled as to the relation between the REML score computed by gam and the formula (4) on p.4 here: http://opus.bath.ac.uk/22707/1/Wood_JRSSB_2011_73_1_3.pdf I'm ok with this for poisson, or for quasipoisson when phi=1. However, when phi differs from 1, I'm stuck. #simulate some data

[R] geom_line: How to plot two data sets having different maximum X-axis values in a single plot?

2012-09-25 Thread Jim mikeself
Hello, I just started to learn R and ggplot2. Can someone help? How to plot two data sets having different maximum X-axis values in a single plot? For example, I have two data sets showed below. Using position as X, and count as Y, how can I plot them out in different color lines within a

Re: [R] Mean calculation of groups

2012-09-25 Thread Rui Barradas
Hello, Or ?tapply. ave will return a vector with the length of the input, tapply just one value per group. ave(test$Score, test$Name, FUN = mean) # 24 values tapply(test$Score, test$Name, FUN = mean) # 3 values Hope this helps, Rui Barradas Em 25-09-2012 15:54, Bert Gunter escreveu:

[R] Recategorizing Nominal variable

2012-09-25 Thread Michael Leitson
Hello, I would like to take a data set of doctors, and recategorize them into numbers. For example, John Doe would be assigned as 1 Jane Doe would be assigned as 2 Does anyone know how to do this in R? It seems quite easy, yet I cannot find the code. Thank you, Michael Leitson

Re: [R] Plotting of regsubsets adjr2 values not correct

2012-09-25 Thread Bert Gunter
1. You failed to tell us that you are using the leaps package. 2. You are lost statistically. I strongly recommend that you seek out local statistical help. At the very least, post on a statistical Help list, which this is _not_. 3. FWIW: What you are trying to do is quite unwise. That is why I

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread arun
Hi Ben, Just a modification of Petr's solution with library(data.table): dat1-data.frame(Species=paste0(Species,1:3),Site1=c(5,NA,4),Site2=c(3,2,4),Site3=c(NA,5,NA))  dat2-data.frame(Species=paste0(Species,1:3),Trait1=1:3,Trait2=c(2,4,2),Trait3=c(5,1,1)) library(data.table) library(reshape)

Re: [R] Recategorizing Nominal variable

2012-09-25 Thread Bert Gunter
Unless you have good reason and know what you're doing, **don't do this!** It is just asking for trouble. ... and yes, it is easy. Have you gone through the Intro to R tutorial that I believe would provide you the information to do this? Cheers, Bert On Tue, Sep 25, 2012 at 6:22 AM, Michael

Re: [R] RGL plot : cex and zlim arguments do not work

2012-09-25 Thread Duncan Murdoch
On 25/09/2012 11:07 AM, Stephane Chantepie wrote: Dear all, I have a quiet simple problem (shared by a collegue) but no solution at yet. The arguments I use in bbox3d or text3d do not have any effect on the graph. I need to use 'cex' and 'zlim' but It does not work. Maybe my problem could

Re: [R] R for commercial use

2012-09-25 Thread Kjetil Halvorsen
well, R includes a Turing-complete programming language, so I guess It really is difficult to answer NO to any of this questions? They do not seem very precise. Kjetil On Tue, Sep 25, 2012 at 9:15 AM, mlell08 mlel...@gmail.com wrote: Hi, On 24.09.2012 16:21, Zastko,Samuel ALB co-mw wrote: Hi

Re: [R] Recategorizing Nominal variable

2012-09-25 Thread R. Michael Weylandt
On Tue, Sep 25, 2012 at 2:22 PM, Michael Leitson michael.leit...@wellstar.org wrote: Hello, I would like to take a data set of doctors, and recategorize them into numbers. For example, John Doe would be assigned as 1 Jane Doe would be assigned as 2 Does anyone know how to do this in R?

Re: [R] add a data frame to my data frame

2012-09-25 Thread jim holtman
Is this what you want: myframe2 ID Hungermyframestime 1 Ernie 1 2012-09-24 09:00:00 2 Ernie 1 2012-09-25 09:00:00 3 Bert 2 2012-09-24 10:00:00 4 Bert 2 2012-09-25 10:00:00 environ2 ID Temp Rain envirotime 1 Ernie 25 0.1 2012-09-24 09:00:00 2

Re: [R] add a data frame to my data frame

2012-09-25 Thread Sarah Goslee
How about: merge(myframe2, environ2, all.x=TRUE, by.x=c(ID, myframestime), by.y=c(ID, envirotime)) IDmyframestime Hunger Temp Rain 1 Bert 2012-09-24 10:00:00 2 NA NA 2 Bert 2012-09-25 10:00:00 2 272 3 Ernie 2012-09-24 09:00:00 1 25 0.1 4 Ernie 2012-09-25

Re: [R] corrgram

2012-09-25 Thread Kevin Wright
Claudia, When you are asking a question about a particular _package_, you should try to contact the package maintainer with the question. Now, to answer your question...There is no simple way. You can always use the grid package to annotate plots however you like. Here is an example that shows

Re: [R] Recategorizing Nominal variable

2012-09-25 Thread Bhupendrasinh Thakre
you may want to look at recode command in car package. Again as Bert said it depends on what are you trying to achieve. Best Regards, Bhupendrasinh Thakre *Disclaimer :* The information contained in this communication is confidential and may be legally privileged. It is intended solely for

Re: [R] corrgram

2012-09-25 Thread Bert Gunter
Inline: On Tue, Sep 25, 2012 at 8:42 AM, Kevin Wright kw.s...@gmail.com wrote: Claudia, When you are asking a question about a particular _package_, you should try to contact the package maintainer with the question. Now, to answer your question...There is no simple way. You can always use

[R] nlme function examples for dose-respone

2012-09-25 Thread Christof Kluß
Hi, I want to fit nonlinear dose-response curves, as fun(X,a,b,c), for each of our 5 trail locations. Our data basis is something like location plot year dose response For each location there are 4 plots as repetitions (over 3 years). So the interactions location*year and location*plot should

Re: [R] nlme function examples for dose-respone

2012-09-25 Thread Bert Gunter
1. Post on R-sig-mixed-models instead. Much more expertise and relevance there. 2. I would forget about mixed effects and treat the locations as fixed. With only 5, you don't have enough information to estimate the variance component with any precision anyway. 3. Feel free to ignore (2) and

Re: [R] nlme function examples for dose-respone

2012-09-25 Thread Christof Kluß
Hi, thx Bert, I forward the question. I forgot a detail. For each (location, plot, year) combination there are 6 (dose, response) pairs. $ plot: Factor w/ 4 levels 1,2,3,4: $ location : Factor w/ 5 levels loc1,loc2,..: $ year: Factor w/ 3 levels 2009,2010,..: $ dose: num 27.3 32.7 57.2 33 183.1

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread Benjamin Gillespie
You're good! Thanks again :) Ben Gillespie Research Postgraduate School of Geography University of Leeds Leeds LS2 9JT Tel: +44(0)113 34 33345 Mob: +44(0)770 868 7641 http://www.geog.leeds.ac.uk/ From: arun [smartpink...@yahoo.com] Sent: 25 September

Re: [R] Install of R-2.15.1 for Windows (64 bit) on application server

2012-09-25 Thread Uwe Ligges
On 24.09.2012 23:14, dthomas wrote: Hi, I'm looking to install ‘R’ on an application server which we can give plenty of resource to, and actually run the program from a terminal server. Do you know if this is possible, and if so are there any special installation instructions required?

Re: [R] corrgram

2012-09-25 Thread Kevin Wright
Um, Bert, did you try my example? It uses grid graphics to annotate a base-graphics plot. Kevin On Tue, Sep 25, 2012 at 10:50 AM, Bert Gunter gunter.ber...@gene.com wrote: Inline: On Tue, Sep 25, 2012 at 8:42 AM, Kevin Wright kw.s...@gmail.com wrote: Claudia, When you are asking a question

Re: [R] extract all data frames from a list remove NAs

2012-09-25 Thread Rui Barradas
Hello, I've made up two equal data.frames consisting of two columns each, one df with NAs, the other without and then ran your code. It returned the two columns of both df's without NAs, complete cases only. So it might be better for you to post the data sets where your code fails. Or

[R] (core) designation on Task View

2012-09-25 Thread k schoenfelder
Hello, Does the (core) designation in the CRAN Task View indicate packages that provide basic/recommended functionality in that domain? I don't see it documented anywhere on the site. Thanks for your help. __ R-help@r-project.org mailing list

Re: [R] Script to count unique values from two linked matricies

2012-09-25 Thread arun
Hi Ben, No problem. The code could be collapsed to 2 steps: library(data.table) library(reshape) datm-merge(melt(dat1),melt(dat2),by=Species) dat3-data.frame(unlist(lapply(lapply(split(datm,datm$variable.x),function(x) data.table(x[!is.na(x$value.x),])),function(x)

Re: [R] add a data frame to my data frame

2012-09-25 Thread arun
HI, I guess this is what you are looking for: merge(myframe2,environ2, by=ID) # ID Hunger    myframestime Temp Rain  envirotime #1  Bert  2 2012-09-24 10:00:00   27    2 2012-09-25 10:00:00 #2  Bert  2 2012-09-25 10:00:00   27    2 2012-09-25 10:00:00 #3 Ernie  1

Re: [R] (core) designation on Task View

2012-09-25 Thread Bert Gunter
They indicate that they are part of the core distribution that comes with every R installation. Don't know where this is documented. -- Bert On Tue, Sep 25, 2012 at 8:24 AM, k schoenfelder kscho...@gmail.com wrote: Hello, Does the (core) designation in the CRAN Task View indicate packages

Re: [R] (core) designation on Task View

2012-09-25 Thread Bert Gunter
I retract my previous claim. I don't know what it means either. -- Bert On Tue, Sep 25, 2012 at 8:24 AM, k schoenfelder kscho...@gmail.com wrote: Hello, Does the (core) designation in the CRAN Task View indicate packages that provide basic/recommended functionality in that domain? I don't

Re: [R] (core) designation on Task View

2012-09-25 Thread Achim Zeileis
On Tue, 25 Sep 2012, k schoenfelder wrote: Hello, Does the (core) designation in the CRAN Task View indicate packages that provide basic/recommended functionality in that domain? Sort of. It's really just a switch for giving the user a choice to just install the most important or all

Re: [R] (core) designation on Task View

2012-09-25 Thread Uwe Ligges
On 25.09.2012 19:42, Bert Gunter wrote: I retract my previous claim. I don't know what it means either. -- Bert On Tue, Sep 25, 2012 at 8:24 AM, k schoenfelder kscho...@gmail.com wrote: Hello, Does the (core) designation in the CRAN Task View indicate packages that provide

Re: [R] extract all data frames from a list remove NAs

2012-09-25 Thread Rui Barradas
Hello, You should have kept it in the R-Help list, the odds of having more answers would be greater. There was a bug in the loop. It should be cleanDataSets[[i]] not cleanDataSets[i]. Anyway, I've simplified it a bit. fls - list.files(pattern = *.csv) files - lapply(fls, read.csv,

[R] Extrapolating Cox predicted risk

2012-09-25 Thread petretta
Dear all I generated predicted risk of death for each subject in the study by means of Cox proportional hazards model at 8 year of follow-up, a time point at which follow-up was more than 90% complete. It is possible to extrapolate to 10-year the predicted risk of each subjet by assuming

Re: [R] Memory usage in R grows considerably while calculating word frequencies

2012-09-25 Thread arun
Dear Martin, Thanks for testing the code.  You are right. I modified the code: If I test it for a sample text, txt1-Romney A.K. different, (= than other people.  Is it? OP's code: pattern - (\\b[A-Za-z]+\\b)  match - gregexpr(pattern,txt1)  words.txt - regmatches(txt1,match)  

Re: [R] Background color in a grid plot seems to interfere with plot()

2012-09-25 Thread Paul Murrell
Hi On 25/09/2012 6:10 p.m., Marius Hofert wrote: Dear Paul, Thanks. Redrawing the points solves it for the minimal example, but what happens if you have plot(.., type=b) like below? You can use points(..., type=b) Paul Actually, originally I wanted to use just grid (without mixing it with

Re: [R] Plotting of regsubsets adjr2 values not correct

2012-09-25 Thread Thomas Lumley
On Wed, Sep 26, 2012 at 3:03 AM, Maximilian Lklweryc maxlklwe...@gmail.com wrote: Hi, I want to make model selection with regsubsets. My code is: a-regsubsets(Gesamt ~ CommunistSocialist + CountrySize + GNI + Lifeexp + Schoolyears + ExpMilitary + Mortality + PopPoverty + PopTotal + ExpEdu

Re: [R] Three Stage Sampling of categorical variable using 'survey' in R

2012-09-25 Thread Thomas Lumley
On Wed, Sep 26, 2012 at 12:45 AM, Kristof bost...@irc.nl wrote: 1) SURVEY DESIGN So far I designed mainly two stage cluster surveys but never did a three stage cluster survey design. It seems that in the analysis only the PSU is taken into account and enumeration area. So whatever happens at

Re: [R] Regsubsets model selection

2012-09-25 Thread Thomas Lumley
Why have you asked this question three times? -- Thomas Lumley Professor of Biostatistics University of Auckland __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] mean-aggregate – but use unique for factor variables

2012-09-25 Thread Martin Batholdy
Hi, I have a data.frame which I want to aggregate. There are some grouping variables and some continuous variables for which I would like to have the mean. However there are also some factor-variables in the data-frame that are not grouping variables and I actually would like to aggregate

Re: [R] mean-aggregate – but use unique for factor variables

2012-09-25 Thread Bert Gunter
In the absence of data via dput() or other wise I would assume that if you made your function FUN something like: function(x) if(is.factor(x)) unique(x) else mean(x) (or maybe length(unique(x)) as first clause) you'd get what you want. No? On Tue, Sep 25, 2012 at 2:32 PM, Martin

Re: [R] appropriate test in glm when the family is Gamma

2012-09-25 Thread Ben Bolker
粕谷 英一 ekasuscb at kyushu-u.org writes: Which test is most appropriate in glm when the family is Gamma? In the help page of anova.glm, I found the following “For models with known dispersion (e.g., binomial and Poisson fits) the chi-squared test is most appropriate, and for those with

[R] Write table with data in other .csv template

2012-09-25 Thread s.s.m. fauzi
Hi, I have a table with data, as below: dput(table): structure(list(Adrian.Cole = c(0L, 0L, 0L, 0L, 0L, 0L), Alison.Wong = c(0L, 0L, 0L, 0L, 0L, 0L), Andrei.Savu = c(0L, 0L, 0L, 0L, 0L, 0L), Bruno.Dumon = c(0L, 0L, 0L, 0L, 0L, 0L), Edward.J..Yoon = c(0L, 0L, 0L, 0L, 0L, 0L), Eugene.Koontz =

Re: [R] Write table with data in other .csv template

2012-09-25 Thread Jeff Newmiller
Thanks for posting dput data, but I don't understand your question. are you familiar with cbind? Is there duplication of column names in your input table and template? Are they always duplicated in the template? What characteristics of the template are you trying to preserve? Column order?

Re: [R] Write table with data in other .csv template

2012-09-25 Thread s.s.m. fauzi
Hi Jeff, Thank you for the respond. I'm not really familiar with cbind. Anyway, there is a duplication in my input and the template, and I want to preserve the column order. Shukor On Wed, Sep 26, 2012 at 11:30 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: Thanks for posting dput data,

[R] small negative values instead of zeros in nested loop

2012-09-25 Thread Cristina Fdez . Aragón
Hi,I am trying to run a code with a series of nested for loops, here is a simplified version of it: J-seq(0,1,0.2) D-seq(0,1,0.2) for (x in 1:10) { for (j in

Re: [R] small negative values instead of zeros in nested loop

2012-09-25 Thread Jim Holtman
FAQ 7.31 then look at 'all.equal' Sent from my iPad On Sep 25, 2012, at 19:39, Cristina Fdez. Aragón cf_ara...@hotmail.com wrote: Hi,I am trying to run a code with a series of nested for loops, here is a simplified version of it: J-seq(0,1,0.2)D-seq(0,1,0.2)

Re: [R] Write table with data in other .csv template

2012-09-25 Thread Jeff Newmiller
Perhaps you might try template[ , names(tbl) ] - tbl where I have used tbl instead of table, for reasons previously mentioned. --- Jeff NewmillerThe . . Go Live...

Re: [R] Write table with data in other .csv template

2012-09-25 Thread s.s.m. fauzi
Hi Jeff, Do I need to call the .csv template to perform this operation? Shukor On Wed, Sep 26, 2012 at 11:50 AM, Jeff Newmiller jdnew...@dcn.davis.ca.uswrote: Perhaps you might try template[ , names(tbl) ] - tbl where I have used tbl instead of table, for reasons previously mentioned.

Re: [R] boxplot of different colors

2012-09-25 Thread Elaine Kuo
hello Richard, Thank a lot. The plot is breathtaking. I would like to make three modifications. Please kindly help and thanks. 1. making outliers from dash to empty circle (pch=2) I tried plot.symbol as the code below but failed. 2. making font size of axis (levels) larger to 1.2 unsure where

Re: [R] Write table with data in other .csv template

2012-09-25 Thread s.s.m. fauzi
Hi Jeff, I got it...Thank you for your help! On Wed, Sep 26, 2012 at 11:53 AM, s.s.m. fauzi ssmf...@gmail.com wrote: Hi Jeff, Do I need to call the .csv template to perform this operation? Shukor On Wed, Sep 26, 2012 at 11:50 AM, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:

[R] Simulating from probit

2012-09-25 Thread Tjun Kiat Teo
Is there anyway to simulate random deviates from probit ? Tjun Kiat __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented,

[R] error about xtable and addmargins

2012-09-25 Thread Niklas Fischer
Dear all, Tried to add column margins of a sample data. The data was extracted from xtable library, it gives erroro the below, appreciated if you have any idea. Bests, head(iris) irisk-head(iris) table-xtable(irisk,digits=2) table2 - xtable(addmargins(as.matrix(irisk), 2), digits = 0) Error

Re: [R] Write table with data in other .csv template

2012-09-25 Thread Jeff Newmiller
CSV files are on disk, with filenames. You can call them whatever you want, but they are not variables in R. Data frames are variables in memory. You can read any CSV file into any data frame you like, but it replaces the original contents of the data frame completely. You can also write a

Re: [R] Rows not common in dataframes

2012-09-25 Thread Chintanu
Thank you for your assistance - Arun, Milan, Rui. Much appreciated. In a related note, I have never been sure of how and when to use the binary operator, %in%. If you could share any easy explanation to it, that would be very useful. Cheers, Chintanu === On

Re: [R] Rows not common in dataframes

2012-09-25 Thread Jeff Newmiller
%in% returns a logical vector. You should experiment with that operator without the indexing to complicate things for a bit to understand it. If you read the Introduction to R sections on indexing, they describe three kinds of indexing. You can only use string indexing to access by name or

Re: [R] Three Stage Sampling of categorical variable using 'survey' in R

2012-09-25 Thread Kristof
Dear Thomas, Thanks a lot for your reply which helps a lot. *From:* Thomas Lumley-2 [via R] [mailto: ml-node+s789695n4644179...@n4.nabble.com] *Sent:* 25 September 2012 22:49 *To:* Kristof *Subject:* Re: Three Stage Sampling of categorical variable using 'survey' in R On Wed, Sep 26, 2012