Re: [R] charToRaw(Œ) is not 8C in R console

2013-12-13 Thread Prof Brian Ripley
On 13/12/2013 07:03, 水静流深 wrote: in http://www.ascii-code.com/, you can see the the hex value of Å’ is 8C, I don't see that: that is two characters and they are C5 and 92 in that table. 8C is a AE ligature, there. And what the 'hex value' is depends on the locale: see the preamble of that

Re: [R] charToRaw(Œ) is not 8C in R console

2013-12-13 Thread Prof Brian Ripley
On 13/12/2013 07:59, Prof Brian Ripley wrote: On 13/12/2013 07:03, 水静流深 wrote: in http://www.ascii-code.com/, you can see the the hex value of Å’ is 8C, I don't see that: that is two characters and they are C5 and 92 in that table. 8C is a AE ligature, there. Typo: OE as in your subject

Re: [R] charToRaw(Œ) is not 8C in R console

2013-12-13 Thread peter dalgaard
On 13 Dec 2013, at 08:03 , 水静流深 1248283...@qq.com wrote: in http://www.ascii-code.com/, you can see the the hex value of Œ is 8C, (Looks like Brian got his version mangled in transmission.) Anything above 7F is not ASCII. Various 8-bit extensions put various non-ASCII characters at various

[R] how to use the readBin ?

2013-12-13 Thread 水静流深
how to use the readBin ? i want to write the extended ascii character `Œ` into a file named c:/testbin, and read it in the R console ,display it as `Œ` in R console. now i can write it . zz - file(c:/testbin, wb) writeBin(charToRaw(\u0152), zz) close(zz) when i open the file with

[R] how can i write the function into a file c:/mytest.R with cat function?

2013-12-13 Thread ????????
mytest-function(x,f){ sum(x*f)/sum(f) } cat(mytest,file=c:/mytest.R) Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'closure') cannot be handled by 'cat' how can i write the mytest function into a file c:/mytest.R with cat function?

Re: [R] Get average model after dredge function ran in a loop

2013-12-13 Thread Kamil Bartoń
You are trying to average coefficients from models fitted to different data (as you have manipulated Lat+Long values), you cannot do it using AIC weights. kamil On 2013-12-11 11:00, r-help-requ...@r-project.org wrote: Message: 26 Date: Tue, 10 Dec 2013 15:44:28 -0500 From: Catarina

Re: [R] freetype 2.5.2, problem with the survival package, build R 2.15.x with gcc 4.8.x

2013-12-13 Thread Terry Therneau
I was sent a copy of the data, and this is what I get on a different machine: fit - clogit(cc ~ addContr(A) + addContr(C) + addContr(A.C) + strata(set), data=pscc) Warning messages: 1: In fitter(X, Y, strats, offset, init, control, weights = weights, : Loglik converged before

[R] filter a data.frame

2013-12-13 Thread Mat
hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No. text 1 abc 2 def 3 ee 4 ff 5 gg I want now to filter No. 2 and 3, so my solution should be look like this one. No. text 2 def 3

Re: [R] Coxme time dependent

2013-12-13 Thread Terry Therneau
On 12/13/2013 05:00 AM, r-help-requ...@r-project.org wrote: i all, I am using the coxme function to fit random effects survival models. The base survival models show a typical J shaped curve where survival drops sharply then plateaus over time interval. I want to include a time covariate

Re: [R] filter a data.frame

2013-12-13 Thread Sarah Goslee
Try %in% instead of == Sarah On Friday, December 13, 2013, Mat wrote: hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No. text 1 abc 2 def 3 ee 4 ff 5 gg I want now to

Re: [R] how can i write the function into a file c:/mytest.R withcatfunction?

2013-12-13 Thread Gerrit Eichner
Hello, Ë®¾²Á÷Éî! mytest-function(x,f){ sum(x*f)/sum(f) } cat(mytest,file=c:/mytest.R) Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'closure') cannot be handled by 'cat' how can i write the mytest function into a file c:/mytest.R with cat

Re: [R] filter a data.frame

2013-12-13 Thread Gerrit Eichner
Hello, Mat, see below. hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No. text 1 abc 2 def 3 ee 4 ff 5 gg I want now to filter No. 2 and 3, so my solution should be look like this

Re: [R] method default for hclust function

2013-12-13 Thread David Carlson
I think the OP was asking about the agglomeration method in hclust(), not the distance measure in dist(). And the default in dist() is not absolute distance which is not an option, but Euclidean distance: dist(cbind(v, v)) 12345 2 1.414214

Re: [R] how can i write the function into a file c:/mytest.R with cat function?

2013-12-13 Thread William Dunlap
If you need to use cat() (why?) try using deparse() or format() on the function cat(mytest - , deparse(mytest), sep=\n, file=file) but dump() is easier dump(mytest,file=file) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From:

Re: [R] filter a data.frame

2013-12-13 Thread Mat
thanks together, out1 - out[(out$No %in% no.ind),] works perfectly :-) -- View this message in context: http://r.789695.n4.nabble.com/filter-a-data-frame-tp4682118p4682131.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] freetype 2.5.2, problem with the survival package, build R 2.15.x with gcc 4.8.x

2013-12-13 Thread Hin-Tak Leung
Thanks for taking the time to look at this issue with changes in the survival package. There are warnings (different ones) with any of the versions mentioned - so it is difficult to tell what to not ignore; -). In fact it is somewhat central and essential to the surrounding text 's argument

Re: [R] freetype 2.5.2, problem with the survival package, build R 2.15.x with gcc 4.8.x

2013-12-13 Thread David Winsemius
On Dec 11, 2013, at 7:30 PM, Hin-Tak Leung wrote: Here is a rather long discussion etc about freetype 2.5.2, problem with the survival package, and build R 2.15.x with gcc 4.8.x. Please feel free to skip forward. - freetype 2.5.2: the fix to cope with one of the Mac OS X's system

Re: [R] filter a data.frame

2013-12-13 Thread Rui Barradas
Hello, Try instead no.ind - c(2, 3) out1 - out[out$No %in% no.ind, ] Hope this helps, Rui Barradas Em 13-12-2013 12:59, Mat escreveu: hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No. text 1 abc

[R] Constrained model of linear regression

2013-12-13 Thread Sophie Thiebaut
Dear R-helpers, After having search everywhere on the R documentation and on R-help forum I finally come to ask you some help. I am willing to estimate a model with constraints on parameters. This model is built from econometrics theory of jumping process and takes the following reduced form

Re: [R] filter a data.frame

2013-12-13 Thread arun
Try:  out[out$No%in% no.ind,] #  No. text #2   2  def #3   3   ee A.K. On Friday, December 13, 2013 8:03 AM, Mat matthias.we...@fnt.de wrote: hello together, i want to filter a data.frame. My problem is, that i want to filter 2 numbers. My data.frame look like this one. No.  text 1      abc

[R] how do I separete coloumns by comma?

2013-12-13 Thread Patty Haaem
Hi every one, I have a text file like this: 1    4   4    1    6    23 1   4    2    2    3    28 1    4    5    1    2    24 1    2    3    1    1    24 1   2    3    1    2     40 1   2   3    1    4      22 I want to separate columns by comma, like this: 1,4,4,1,6,23 1,4,2,2,3,28 1,4,5,1,2,24

Re: [R] how do I separete coloumns by comma?

2013-12-13 Thread Richard Kwock
Hi Elham, From the (\t), It looks like the data in your data.txt file is tab-delimited. To take care of that, set the separator string to be: sep = '\t' instead of , when you read in the file. text - read.table(file = data.txt, sep = \t) text write.table(text, textfile.csv, row.names = F,

[R] growth curve estimation

2013-12-13 Thread Robert Rigby
Dear Daniel, The centiles.pred is currently set up for a gamlss object fitted using the function gamlss, not function lms (but we will aim to change this soon). The lms function uses calibration=TRUE as default (this automatically adjusts the centile curves so that the sample %'s below each

[R] MuMIn Random Effects Variance

2013-12-13 Thread Stephen Jane
Hello, I am using a negative binomial distribution in glmmADMB to fit a mixed model and then using the MuMIn package to get model averaged coefficients.  As far as I can tell, this approach gives no estimates for the variance of the random effects.  I have been taking these from the top model

[R] data point labeling in xyplot

2013-12-13 Thread peyman
Hi Folks, I have data with a format like: IDyparam1param2groupingFactor1groupingFactor2. 1... 1 1 1 2 2 2 2 3 3 3 so several grouping factors and repeated measures. I am using trellis and xyplot to get plot with several grouping factors. something like

Re: [R] MuMIn Random Effects Variance

2013-12-13 Thread Cade, Brian
You might want to rethink about getting model averaged coefficients. That is a bunch of nonsense if you have any multicollinearity among the predictors. Model averaged predictions might be useful. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave.,

[R] extracting non-NA entries from a two-way frequency table

2013-12-13 Thread Michael Friendly
I have data in the form of a two-way table recording the number of families with varying numbers of boys (rows) and girls (columns: g0 -- g12) below, also given in dput() format. I want to convert this to a data frame containing only the non-NA entries, with columns boys, girls, Freq, where

Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-13 Thread rmailbox
Perhaps this? library(reshape2) library(stringr) GeisslerLong - melt (Geissler, id.vars = c(boys)) GeisslerLong - transform ( GeisslerLong, girls = as.numeric ( str_replace( variable, g, '' )) ) GeisslerLong - rename ( GeisslerLong, c( value = Freq)) GeisslerLong - arrange ( GeisslerLong, boys,

Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-13 Thread William Dunlap
The following puts the data.frame into 'long' format and then drops rows with NA's for 'n'. f - function(data){ df - data.frame( expand.grid( boys = data[[boys]], girls = as.integer(sub(^g, , colnames(data)[-1])) ), n = unlist(data[, -1])) # n

Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-13 Thread David Carlson
This will also work: rownames(Geissler) - paste0(b, Geissler$boys) Geissler2 - na.omit(as.data.frame(as.table(as.matrix(Geissler[,-1] names(Geissler2) - c(Boys, Girls, Freq) Geissler2$Boys - as.numeric(substr(as.character(Geissler2$Boys), 2, nchar(as.character(Geissler2$Boys

[R] Problems with xtable?

2013-12-13 Thread Silvano Cesar da Costa
Hi, I'm using Sweave to create some tables. My code is: label=Q1, echo=FALSE, results=tex= tab1 = table(DISCIPLINA, Q1) tab1.prop = round(addmargins(100*prop.table(tab1, 1), FUN=list(Total=sum)), 2) tab1.txt = xtable(tab1.prop, align=l|rr, label='Q1', caption=c(Apresentação da proposta de

[R] dataframe manipulation

2013-12-13 Thread Gang Chen
Suppose I have a dataframe defined as L3 - LETTERS[1:3] (d - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace = TRUE))) x y fac 1 1 1 C 2 1 2 A 3 1 3 B 4 1 4 C 5 1 5 B 6 1 6 B 7 1 7 A 8 1 8 A 9 1 9 B 10 1 10 A I want to extract

[R] Minutes after midnight to time

2013-12-13 Thread Trevor Davies
Is there a quick function that can convert minutes (seconds) after midnight to a time? i.e 670.93 (minutes after midnight) -- 11:10:56.** I know it can be done by hand but I thought there must be a function for this already. Thank you. [[alternative HTML version deleted]]

Re: [R] dataframe manipulation

2013-12-13 Thread Gang Chen
Perfect! Thanks a lot, A.K! On Fri, Dec 13, 2013 at 4:21 PM, arun smartpink...@yahoo.com wrote: Hi, Try: d[match(unique(d$fac),d$fac),] A.K. On Friday, December 13, 2013 4:17 PM, Gang Chen gangch...@gmail.com wrote: Suppose I have a dataframe defined as L3 - LETTERS[1:3]

Re: [R] dataframe manipulation

2013-12-13 Thread Sarah Goslee
What about: lapply(levels(d$fac), function(x)head(d[d$fac == x,], 1)) Thanks for the reproducible example. If you put set.seed(123) before the call to sample, then everyone who tries it will get the same data frame d. Sarah On Fri, Dec 13, 2013 at 4:15 PM, Gang Chen gangch...@gmail.com

Re: [R] dataframe manipulation

2013-12-13 Thread Gang Chen
Another neat solution! Thanks a lot, Sarah! On Fri, Dec 13, 2013 at 4:35 PM, Sarah Goslee sarah.gos...@gmail.comwrote: What about: lapply(levels(d$fac), function(x)head(d[d$fac == x,], 1)) Thanks for the reproducible example. If you put set.seed(123) before the call to sample, then

Re: [R] Problems with xtable?

2013-12-13 Thread Brian Diggs
On 12/13/2013 1:14 PM, Silvano Cesar da Costa wrote: Hi, I'm using Sweave to create some tables. My code is: label=Q1, echo=FALSE, results=tex= tab1 = table(DISCIPLINA, Q1) tab1.prop = round(addmargins(100*prop.table(tab1, 1), FUN=list(Total=sum)), 2) tab1.txt = xtable(tab1.prop,

Re: [R] dataframe manipulation

2013-12-13 Thread William Dunlap
d[match(unique(d$fac),d$fac),] The following does the same thing a little more directly (and quickly) d[ !duplicated(d$fac), ] Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On

[R] The Stoppa distribution

2013-12-13 Thread Andrew Hoerner
The Stoppa distribution is a 3-parameter distribution that generalizes the Pareto distribution, adding a second shape parameter but no location term. The CDF is F(x) = [1-(x/x0)-á]è0 x0 x Kleiber Kotz (2003). *Statistical Size Distributions in

[R] colClasses does not cause read.table to coerce to numeric; anymore?

2013-12-13 Thread David Winsemius
I thought that setting colClasses to numeric would coerce errant data to NA. Instead read.table is throwing errors. This is not what I remember from prior experience with read.table and it is not how I read the help page as promising: BE- c( 1841 96 42.2631.50

Re: [R] Minutes after midnight to time

2013-12-13 Thread Ben Tupper
Hi, On Dec 13, 2013, at 4:34 PM, Trevor Davies davies.tre...@gmail.com wrote: Is there a quick function that can convert minutes (seconds) after midnight to a time? i.e 670.93 (minutes after midnight) -- 11:10:56.** I know it can be done by hand but I thought there must be a function for

[R] ggplot question: how to have two y-axis guide on one plot?

2013-12-13 Thread Roe, Colleen
I have a plot I'd like to do wherein I plot to different y data sets and want to have two different y axis's appear (perhaps one on right side and one on left). I searched R help with all the key phrases I could think of and I have three books covering ggplot but I can't find an example of

Re: [R] dataframe manipulation

2013-12-13 Thread arun
Hi, Try:  d[match(unique(d$fac),d$fac),] A.K. On Friday, December 13, 2013 4:17 PM, Gang Chen gangch...@gmail.com wrote: Suppose I have a dataframe defined as     L3 - LETTERS[1:3]     (d - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace = TRUE)))   x  y fac 1  1  1  C 2 

Re: [R] how do I separete coloumns by comma?

2013-12-13 Thread arun
Hi, Try: mydata - read.table(data.txt) #or read.table(data.txt,sep=)  str(mydata) #'data.frame':    6 obs. of  6 variables: # $ V1: int  1 1 1 1 1 1 # $ V2: int  4 4 4 2 2 2 # $ V3: int  4 2 5 3 3 3 # $ V4: int  1 2 1 1 1 1 # $ V5: int  6 3 2 1 2 4 # $ V6: int  23 28 24 24 40 22  

[R] disabling sparse Matrix index checking during assignment

2013-12-13 Thread Nathaniel Graham
The project I'm working on requires producing a number of large (250,000x250,000) sparse logical matrices. I'm currently doing this by updating the elements (turning FALSE to TRUE) of a matrix in batches as they're identified like so: x[idx.matrix] - TRUE where x is created via Matrix(nrow = n,

[R] Invalid connection error message when trying to write a file

2013-12-13 Thread J Karon
I get an invalid connection method error message when trying to write an R object from a user-defined function to my hard drive (running Windows 7) using write.csv. I have previously not had this problem with the same user-defined function. The error message is Error in isOpen(file, w) :

[R] Fisher's LSD problem

2013-12-13 Thread cjohnst
I have been trying to run a Fisher's LSD for quite some time now, however the output I am receiving only ranks the means of each treatment in terms of significant difference, and will not give me the actual value of Least Significant Difference I am looking for. I am using a data set that has

Re: [R] ggplot question: how to have two y-axis guide on one plot?

2013-12-13 Thread David Winsemius
On Dec 13, 2013, at 3:01 PM, Roe, Colleen wrote: I have a plot I'd like to do wherein I plot to different y data sets and want to have two different y axis's appear (perhaps one on right side and one on left). I searched R help with all the key phrases I could think of and I have three

Re: [R] ggplot question: how to have two y-axis guide on one plot?

2013-12-13 Thread David Winsemius
On Dec 13, 2013, at 6:23 PM, David Winsemius wrote: On Dec 13, 2013, at 3:01 PM, Roe, Colleen wrote: I have a plot I'd like to do wherein I plot to different y data sets and want to have two different y axis's appear (perhaps one on right side and one on left). I searched R help with

Re: [R] The Stoppa distribution

2013-12-13 Thread William Dunlap
Try the following, which have the usual lower.tail and log.p arguments to make it easier to get accurate results in the tails. logspace_sub() is an R version of the R C-API function Rf_logspace_sub(). I haven't tested the [pq]stoppa functions much. logspace_sub - function (logx, logy) { #

[R] Converting decimal to binary in R

2013-12-13 Thread ????????
i have write a function to convert decimal number into binary number in R. dectobin-function(x){ as.numeric(intToBits(x))-x1 paste(x1,collapse=)-x2 as.numeric(gsub(0+$,,x2))-x3 return(as.character(x3))} dectobin can get right result ,it is so long ,is there a build-in function to do ?

Re: [R] Minutes after midnight to time

2013-12-13 Thread Jeff Newmiller
On Fri, 13 Dec 2013, Trevor Davies wrote: Is there a quick function that can convert minutes (seconds) after midnight to a time? i.e 670.93 (minutes after midnight) -- 11:10:56.** I know it can be done by hand but I thought there must be a function for this already. Sort of. There isn't

[R] Chinese Garbled

2013-12-13 Thread yuanzhi
Hello, I met a problem which needs your help. I reinstalled the R and Rstudio recently. After that, I found there was a problem that the Chinese character was garbled in Rstudio sometimes. example 1 richness.csv is a file containing three columns and the names of the three columns are

Re: [R] Converting decimal to binary in R

2013-12-13 Thread Richard M. Heiberger
I recommend ?sprintf (4^(1/3))^3 != 4 (4^(1/3))^3 == 4 (4^(1/3))^3 - 4 format(c((4^(1/3))^3 , 4), digits=17) sprintf(%+13.13a, c((4^(1/3))^3 , 4)) On Fri, Dec 13, 2013 at 10:11 PM, 水静流深 1248283...@qq.com wrote: i have write a function to convert decimal number into binary number in R.

Re: [R] Converting decimal to binary in R

2013-12-13 Thread Jeff Newmiller
On Sat, 14 Dec 2013, wrote: i have write a function to convert decimal number into binary number in R. dectobin-function(x){ as.numeric(intToBits(x))-x1 paste(x1,collapse=)-x2 as.numeric(gsub(0+$,,x2))-x3 return(as.character(x3))} dectobin can get right result ,it is so long ,is

[R] to replace the for loop

2013-12-13 Thread Arnaud Michel
Hello I would like to replace the for loop this below T - as.matrix(T) for(i in 1: nrow(TEMP)){ for(j in 1: nrow(TEMP)){if (i = j) T[i, j] - 0 }} I don't find the function in the doc. Thanks in advance for your help. -- Michel ARNAUD Chargé de mission auprès du DRH DGDRD-Drh - TA 174/04 Av

Re: [R] to replace the for loop

2013-12-13 Thread Berend Hasselman
On 14-12-2013, at 08:01, Arnaud Michel michel.arn...@cirad.fr wrote: Hello I would like to replace the for loop this below T - as.matrix(T) for(i in 1: nrow(TEMP)){ for(j in 1: nrow(TEMP)){if (i = j) T[i, j] - 0 }} Your code is mangled. We don’t know what T is. You refer to TEMP in

Re: [R] to replace the for loop

2013-12-13 Thread arun
Hi, May be this helps: set.seed(42)  T - matrix(sample(1:20,20,replace=TRUE),ncol=5)  TEMP - T T1 - T  for(i in 1: nrow(TEMP)){  for(j in 1: nrow(TEMP)){if (i = j) T[i, j] - 0 }}   indx - expand.grid(rep(list(1:nrow(TEMP)),2))[,2:1] T1[as.matrix(indx[indx[,1] = indx[,2],])] - 0 #or