[R] Plotting Mean in plotting degree distribution

2014-03-13 Thread Cyberstarlet
Hi, Please help! I need to plot a degree distribution. so far (see below) i have the following but the problem: i'm plotting the graph. instead I need to plot the degree distribution. library(igraph) dat- read.graph(file=tf.net, format=pajek) dat- as.undirected(dat, mode = c(each))

[R] Colorspace: bug in HLS conversion?

2014-03-13 Thread Michael Gauland
I just started using the colorspace package, and converting between RGB and HLS is not working as I expect. In particular, converting RGB(0,0,0) to HLS then back to RGB seems broken: # as(as(RGB(0, 0, 0), HLS), RGB) R G B [1,] 1 1 0 That is, converting black to HLS then back

[R] Error installing extrafonts from local zip file

2014-03-13 Thread Robin.Thomson
I am making my first submission to Plos One and am trying to install the extrafonts package to obtain Arial for the figures. extrafonts was archived at the end of last month so I downloaded first the extrafont_0.16.tar.gz file and then the older extrafont_0.15.tar.gz file. I selected Install

Re: [R] Colorspace: bug in HLS conversion?

2014-03-13 Thread Pascal Oettli
Hi, I cannot reproduce your result: R as(as(RGB(0, 0, 0), HLS), RGB) R G B [1,] 0 0 0 You probably should provide the output of sessionInfo(). Regards, Pascal On Thu, Mar 13, 2014 at 7:41 AM, Michael Gauland mikely...@amuri.net wrote: I just started using the colorspace package, and

Re: [R] Colorspace: bug in HLS conversion?

2014-03-13 Thread Achim Zeileis
On Wed, 12 Mar 2014, Michael Gauland wrote: I just started using the colorspace package, and converting between RGB and HLS is not working as I expect. In particular, converting RGB(0,0,0) to HLS then back to RGB seems broken: # as(as(RGB(0, 0, 0), HLS), RGB) R G B [1,] 1 1 0

[R] NAG (NAGFWrapper) or any optimization package recommended?

2014-03-13 Thread jpm miao
Hi, Is there any optimization package in R recommended for general purposes (constrained, unconstrained, etc)? Has anyone used the function in NAGFWrapper package http://www.nag.co.uk/numeric/R/r-package Are the optimization functions therein available for free? Thanks, Miao

Re: [R] Error installing extrafonts from local zip file

2014-03-13 Thread Prof Brian Ripley
On 13/03/2014 04:31, robin.thom...@csiro.au wrote: I am making my first submission to Plos One and am trying to install the extrafonts package to obtain Arial for the figures. extrafonts was archived at the end of last month so I downloaded first the extrafont_0.16.tar.gz file and then the

[R] UTF-8 characters in pandoc template variables using knitr

2014-03-13 Thread ONKELINX, Thierry
Dear all, Consider the simpel RMarkdown file below. I've saved it as test.md with UTF-8 encoding. Notice that I have embedded a custom pandoc variable 'test' in the file. This variable holds an UTF-8 character ©. %My title %The authorslist !--pandoc format: latex V: test:Copyright notice. ©

Re: [R] NAG (NAGFWrapper) or any optimization package recommended?

2014-03-13 Thread Berend Hasselman
On 13-03-2014, at 09:50, jpm miao miao...@gmail.com wrote: Hi, Is there any optimization package in R recommended for general purposes (constrained, unconstrained, etc)? See CRAN Task Views, Optimization. http://cran.r-project.org/web/views/ Has anyone used the function in

Re: [R] UTF-8 characters in pandoc template variables using knitr

2014-03-13 Thread Prof Brian Ripley
And what did the maintainer say? (See the posting guide.) On 13/03/2014 09:11, ONKELINX, Thierry wrote: Dear all, Consider the simpel RMarkdown file below. I've saved it as test.md with UTF-8 encoding. Notice that I have embedded a custom pandoc variable 'test' in the file. This variable

[R] replace duplicates with 0

2014-03-13 Thread catalin roibu
Dear all! Is there a possibility to replace all duplicates values in data frame with 0? Thank you very much! -- --- Catalin-Constantin ROIBU Lecturer PhD, Forestry engineer Forestry Faculty of Suceava Str. Universitatii no. 13, Suceava, 720229, Romania office phone +4 0230 52 29 78, ext.

Re: [R] replace duplicates with 0

2014-03-13 Thread Pascal Oettli
Hello, Dis you at least search? ?duplicated Regards, Pascal On Thu, Mar 13, 2014 at 9:35 PM, catalin roibu catalinro...@gmail.com wrote: Dear all! Is there a possibility to replace all duplicates values in data frame with 0? Thank you very much! -- --- Catalin-Constantin ROIBU

Re: [R] replace duplicates with 0

2014-03-13 Thread Rui Barradas
Hello, See ?duplicated Something like dat1[duplicated(dat1), ] - 0 Hope this helps, Rui Barradas Em 13-03-2014 12:35, catalin roibu escreveu: Dear all! Is there a possibility to replace all duplicates values in data frame with 0? Thank you very much!

Re: [R] replace duplicates with 0

2014-03-13 Thread Jorge I Velez
Hi Catalin, The following should give you some ideas: set.seed(123) x - rpois(50, 2) x idx - duplicated(x) x[idx] - 0 x Best, Jorge.- On Thu, Mar 13, 2014 at 11:35 PM, catalin roibu catalinro...@gmail.comwrote: Dear all! Is there a possibility to replace all duplicates values in data

[R] Downloading a RData file and problem with loading it

2014-03-13 Thread varin sacha
Hi all, I have downloaded the file 5.R.RData and I am trying to load it into R using load(5.R.RData)  But it doesn't work.What's wrong, Many thanks  [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Downloading a RData file and problem with loading it

2014-03-13 Thread Jeff Newmiller
Do you really think we can answer this? Ok, the file is not a valid RData file, or was corrupted in the file transfer. Was that helpful? If not, try being specific (what URL did this file come from? Which version of R? What was the output of session in sessionInfo()?) and posting in plain text

[R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
Hi  List, while running a script on a set of matrices I came into a case I would not have guessed to arrive. Below is  a small toy example to illustrate the case. Of course there is a simple workaround (using a simple test), but why does this occur, and shouldn’t it be corrected ? More probably I

[R] change date format

2014-03-13 Thread catalin roibu
Dear all! I have a new problem with the date format in a data frame. I have rainfall records extracted from an automatic meteo station. In the same data frame (with 1 records) the date is in 2 formats like that: 4/15/11 11:49 AM 5.6.11 2:51 PM My question is how to modify date format for all

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Sarah Goslee
Hi, Your basic problem seems to be that you expect R to take TM2[0, ] as meaning not to subset anything, rather than to take only row 0, which doesn't exist: R TM2[0,] [,1] [,2] [,3] There's a hint in ?[ which says: An index value of 'NULL' is treated as if it were

[R] Duplicate of columns when merging two data frames

2014-03-13 Thread Stefano Sofia
Dear list users, I have two data frames df1 and df2, where the columns of df1 are Sensor_RM Place_RM Station_RM Y_init_RM M_init_RM D_init_RM Y_fin_RM M_fin_RM D_fin_RM and the columns of df2 are Sensor_RM Station_RM Place_RM Province_RM Region_RM Net_init_RM GaussBoaga_EST_RM

Re: [R] change date format

2014-03-13 Thread MacQueen, Don
I would use gsub() to change instances like 5.6.11 to 5/6/11. Hopefully, both versions have month and day in the same order. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 3/13/14 6:57 AM, catalin roibu

Re: [R] Duplicate of columns when merging two data frames

2014-03-13 Thread MacQueen, Don
You have duplicates after merging because, although you know they are the same, the R merge() function does not. And the people who wrote that function knew that sometimes two columns with the same name are not identical. Since you know that the columns are identical, drop the column from one of

[R] outlier detection in nonlinear regression

2014-03-13 Thread anders . mehler
Dear useR's,   I have several biological data sets from laboratory experiments where a few experiments failed completely due to bacterial contamination. Such cases can easily be seen by eye as outliers.   Fitting a Michaelis-Menten kinetics works well with robust nonlinear regression from

Re: [R] Duplicate of columns when merging two data frames

2014-03-13 Thread Marc Schwartz
On Mar 13, 2014, at 10:19 AM, Stefano Sofia stefano.so...@regione.marche.it wrote: Dear list users, I have two data frames df1 and df2, where the columns of df1 are Sensor_RM Place_RM Station_RM Y_init_RM M_init_RM D_init_RM Y_fin_RM M_fin_RM D_fin_RM and the columns of df2 are

[R] R question about intraindividual variables

2014-03-13 Thread Nastassia Hajal
I am creating variables representing intraindividual means and standard deviations for longitudinal data with the following code: data$TraitHAPPYmean - with(data, ave(Happy, ID, FUN=function(x) mean(x, na.rm=TRUE) ) ) data$TraitHAPPYsd - with(data, ave(Happy, ID, FUN=function(x) sd(x,

[R] Estimate LA/AIDS elasticities with Heckman correction in R

2014-03-13 Thread Belinda Archibong
Hi, I've been trying to figure out the code to estimate the LA/AIDS model with the inverse mills ratio from the Heckman-2 step to correct for zero consumption in R with no luck. Could someone please direct me on how to do this in R? Thanks, Belinda A.

Re: [R] change date format

2014-03-13 Thread arun
Try: vec1 - c(4/15/11 11:49 AM, 6/12/12 2:30 PM, 5.6.11 2:51 PM) vec2 - gsub([.],/,vec1) A.K. On Thursday, March 13, 2014 9:57 AM, catalin roibu catalinro...@gmail.com wrote: Dear all! I have a new problem with the date format in a data frame. I have rainfall records extracted from an

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread arun
Hi, You could use:  TM2[!margin.Rows =thresh,!margin.Cols =thresh] # [,1] [,2] #[1,]    1    1 #[2,]    1    1 #[3,]    1    1 #For the first case: TM1[!margin.Rows =thresh,!margin.Cols =thresh] # [,1] [,2] #[1,]    1    1 #[2,]    1    1 A.K. On Thursday, March 13, 2014 10:02

Re: [R] Intraindividual means, SDs, and n's

2014-03-13 Thread arun
Hi, Try:  set.seed(42)  dat1 - data.frame(Happy=sample(c(NA,1:25),40,replace=TRUE),ID=rep(1:5,each=8))  with(dat1,ave(Happy,ID,FUN=function(x) sum(!is.na(x #or library(plyr)   ddply(dat1,.(ID),mutate,mean=mean(Happy,na.rm=TRUE),SD=sd(Happy,na.rm=TRUE),n=sum(!is.na(Happy))) #or you could

Re: [R] creating table with sequences of numbers based on the table

2014-03-13 Thread arun
Hi, Try: Either tab - read.table(text=pop Freq 1   1   30 2   2   25 3   3   30 4   4   30 5   5   30 6   6   30 7   7   30,sep=,header=TRUE) indx - rep(1:nrow(tab),tab$Freq) tab1 - transform(tab[indx,],ind=ave(seq_along(indx),indx,FUN=seq_along))[,-2] #or tab2 - 

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
Thank you Sarah, But no, I was not expecting this. For me integer(0) is not 0. That's why I finally tested length(unused.rows), which is 0 when unused.rows is integer(0). Olivier -Message d'origine- De : Sarah Goslee [mailto:sarah.gos...@gmail.com] Envoyé : jeudi 13 mars 2014 16:12 À :

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Sarah Goslee
On Thu, Mar 13, 2014 at 11:51 AM, Olivier ETERRADOSSI olivier.eterrado...@mines-ales.fr wrote: Thank you Sarah, But no, I was not expecting this. For me integer(0) is not 0. That's why I finally tested length(unused.rows), which is 0 when unused.rows is integer(0). Also from ?[ i, j, ...:

[R] How to get the adjusted R squared from GLS() estimator

2014-03-13 Thread Yuan, Rebecca
Hello, Although lm() gives a way to get the adjusted R squared by adjr2 - summary(mdl)$adj.r.squared I cannot find a way to extract the adjusted R squared from gls(), any hint? Thanks, Rebecca -- This message, and any

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
Thank you, Arun and Sarah I was not trying to take row 0 that does not exist, rather trying not to take (I wrote TM[- unused.rows,]) something that does not exist. So what I understand from Arun's answer is that I was badly using MINUS with a vector instead of NOT with a logical. Olivier

Re: [R] behaviour of rows and colomns suppression in a matrix

2014-03-13 Thread Olivier ETERRADOSSI
Yes, that's usually what I'm doing... Here I didn't guess that the answer was in [ ! I already noticed that it's sometimes easier to locate something very technical or statistically smart than obvious things (because we think we know, or think we have already read 10 times the basics...) ;-) O.

[R] SL 6.5 R from source; should I update texlive? if yes, how to point configure to new binary.

2014-03-13 Thread stephen sefick
Hello all, I would like to install R from source on a SL 6.5 box. I have everything I need except for inconsolata.sty and zi4.sty not found. I am thinking of installing latex 2013 from https://www.tug.org/texlive/. The tex binary will be installed in a different folder. 1. How do I tell

[R] create dataframe using structure ()

2014-03-13 Thread Luigi Marongiu
dear all, I have tried to create a dataframe using the structure() function, but it did not really work. In column 1 i have the row number, in column 2 and 3 factors (8 and 4 levels respectively) and in column 4 the actual data. any clue on what went wrong? best regards luigi

[R] centroid of diamond

2014-03-13 Thread al Vel
Hello R users, I am trying to make a baricentric diagram like the ternary plot, but with 4 edges. I want to know how to calculate the centroid of the diamond. The 4 edges are A, B, C, D. If value of A=B=C=D, then the point should be at the centre of the diamond. If AB and B=C=D=0, Then the point

[R] R bug on survival library Windows 7

2014-03-13 Thread CASTELLI christel
Dear All, I have updated my OS - Windows 7, and I found a situation where R stops working with reported error R for Windows GUI front-end has stopped working. My script worked before (on windows XP). The error occured when I perform this: coxph(Surv(time,event)~F11_rs2036914+frailty(n),

Re: [R] create dataframe using structure ()

2014-03-13 Thread William Dunlap
I have tried to create a dataframe using the structure() function, Why do you want to do this? but it did not really work. Use str() or dput() to compare this to a data.frame made in the usual way. You have .Names and class being arguments to list() instead of to structure() and you didn't

Re: [R] create dataframe using structure ()

2014-03-13 Thread Rui Barradas
Hello, You're misplacing one close parenthesis. See the commented lines below. structure(list( column_1 = 1:32, column_2 = structure(c(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8), .Label = c(Unstimulated, ESAT6, CFP10, Rv3615c, Rv2654,

Re: [R] R bug on survival library Windows 7

2014-03-13 Thread Ben Bolker
CASTELLI christel christel.CASTELLI at chu-nimes.fr writes: Dear All, I have updated my OS - Windows 7, and I found a situation where R stops working with reported error R for Windows GUI front-end has stopped working. My script worked before (on windows XP). The error occured when

Re: [R] creating table with sequences of numbers based on the table

2014-03-13 Thread Dennis Murphy
Less coding with plyr: tab - read.table(text=pop Freq 1 1 30 2 2 25 3 3 30 4 4 30 5 5 30 6 6 30 7 7 30,sep=,header=TRUE) # Function to do the work on each row f - function(pop, Freq) data.frame(ind = seq_len(Freq)) library(plyr) u -

Re: [R] creating table with sequences of numbers based on the table

2014-03-13 Thread Arunkumar Srinivasan
I think this'll be way simpler and also faster: ans - data.frame(pop = rep.int(tab$pop, tab$Freq), ind=sequence(tab$Freq)) Arun From: Dennis Murphy djmu...@gmail.com Reply: Dennis Murphy djmu...@gmail.com Date: March 13, 2014 at 9:57:20 PM To: arun smartpink...@yahoo.com Cc: R help

Re: [R] How to get the adjusted R squared from GLS() estimator

2014-03-13 Thread Greg Snow
Well if I had it and you asked nicely, then I would be happy to give it to you. Oh, you mean the gls function, not GLS as my initials (my parents are OLS and WLS, perhaps I was destined to regress), sorry. The gls function in the nlme package (is that the one that you are asking about? or is

Re: [R] creating table with sequences of numbers based on the table

2014-03-13 Thread William Dunlap
Or use sequence() and rep(), as in u1 - with(tab, data.frame(pop=rep(pop,Freq), ind=sequence(Freq))) I think that u1 is the same as your u. Bill Dunlap TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On

Re: [R] creating table with sequences of numbers based on the table

2014-03-13 Thread David Carlson
I think we're down to counting the number of characters in each solution! Arun's 3 two-line versus your two-line solution (not counting loading plyr). How about three short lines? pop - rep(1:nrow(tab), tab$Freq) ind - unlist(sapply(tab$Freq, seq_len)) tab2 - data.frame(pop, ind)

Re: [R] centroid of diamond

2014-03-13 Thread Rolf Turner
Your question makes absolutely no sense at all. See inline below. On 14/03/14 08:03, al Vel wrote: Hello R users, I am trying to make a baricentric diagram like the ternary plot, but with 4 edges. I want to know how to calculate the centroid of the diamond. Which centroid? A diamond

Re: [R] create dataframe using structure ()

2014-03-13 Thread arun
Hi, Try:  my.data - structure(list(column_1 = 1:32, column_2 = structure(c(1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8), .Label = c(Unstimulated, ESAT6, CFP10, Rv3615c, Rv2654, Rv3879, Rv3873, PHA), class = factor), column_3= structure(c(1, 1,

[R] boxplot with x-axis time

2014-03-13 Thread giuseppe calamita
Dear R-users, I want to plot boxplots of a single variable collected a few times during almost one year and I would like the x-axis to recognize the date-class of the variable. I found some topics in the archive but: - some questions were poorly posed

[R] Creating a box plot with whiskers when I only have mean, sd and n

2014-03-13 Thread Frederik Borup
Dear all, I want to create a boxplot with whiskers. I want to compare several studies. For each study I have 1. mean 2. standard deviation (sd) 3. name 4. number of observations (n) How can i do this in R ? normally I would type bxp or boxplot but this is not allowed when I only

[R] Negative binomial models and censored observations

2014-03-13 Thread Tim Marcella
Hi, I am working with hurdle models in the pscl package to model zero inflated overdispersed count data and want to incorporate censored observations into the equation. 33% of the observed positive count data is right censored, i.e. subject lost to follow up during the duration of the study. Can

Re: [R] Creating a box plot with whiskers when I only have mean, sd and n

2014-03-13 Thread Rolf Turner
On 14/03/14 08:52, Frederik Borup wrote: Dear all, I want to create a boxplot with whiskers. I want to compare several studies. For each study I have 1. mean 2. standard deviation (sd) 3. name 4. number of observations (n) How can i do this in R ? normally I would type bxp

[R] GLM vs GAM

2014-03-13 Thread Ehsan Karim
Dear R-list, I am wondering whether anyone could explain what'd be the difference between running a 'generalized additive regression' versus 'generalized linear regression' with splines.  Are they same models theoretically? My apologies if this is a silly question. Any comments or direction

Re: [R] Colorspace: bug in HLS conversion?

2014-03-13 Thread Michael Gauland
Achim Zeileis Achim.Zeileis at uibk.ac.at writes: Maybe you are using an old version of colorspace? For version 1.1-1 (from two years ago, version 1.2-4 is current) the NEWS file says: ... That was it--thanks! As a developer, I should know enough to check the release notes... --Mike

Re: [R] centroid of diamond

2014-03-13 Thread Jim Lemon
On 03/14/2014 06:03 AM, al Vel wrote: Hello R users, I am trying to make a baricentric diagram like the ternary plot, but with 4 edges. I want to know how to calculate the centroid of the diamond. The 4 edges are A, B, C, D. If value of A=B=C=D, then the point should be at the centre of the

Re: [R] Creating a box plot with whiskers when I only have mean, sd and n

2014-03-13 Thread Jim Lemon
On 03/14/2014 06:52 AM, Frederik Borup wrote: Dear all, I want to create a boxplot with whiskers. I want to compare several studies. For each study I have 1. mean 2. standard deviation (sd) 3. name 4. number of observations (n) How can i do this in R ? normally I would type