Re: [R] plot.mob() fails with cut() error 'breaks' are not unique

2013-01-23 Thread Achim Zeileis
On Tue, 22 Jan 2013, Jason Musil wrote: DeaR all, I am using mob() for model based partitioning, with a dichotomous variable (participant's correct/incorrect response to a test item) regressed onto a continuous predictor related to a given property of the test item. Although this variable

Re: [R] How to construct a valid seed for l'Ecuyer's method with given .Random.seed?

2013-01-23 Thread Marius Hofert
Since clusterSetupRNG() calls clusterSetupRNGstream() and this calls .lec.SetPackageSeed(), I could further minimalize the problem: set.seed(1) RNGkind(L'Ecuyer-CMRG) # = .Random.seed is of length 7 (first number encodes the rng kind) (seed - .Random.seed[2:7]) # should give a valid seed for

[R] Dot plot of character and numeric matrix

2013-01-23 Thread Ng Wee Kiat Jeremy
Dear List, I have a set of data which looks like this (small set of sample) A A 0.431 A A 0.439 A A 0.507 A G 0.508 A A 0.514 I will like to use this data to plot a dot plot, with the X-axis being of type character, and my y axis of type numeric. When I try to use the dot

[R] importing data

2013-01-23 Thread Ray Cheung
Dear All, Sorry for asking a newbie question. I want to ask how to import 1000 datasets whose file names are labelled from data1.dat to data1000.dat into R so that they are named M[1, , ] to M[1000, , ] accordingly. Thank you very much. Best Regards, Ray [[alternative HTML version

Re: [R] Simple use of dcast (reshape2 package)

2013-01-23 Thread Patrick Connolly
On Tue, 22-Jan-2013 at 08:30AM -0500, Ista Zahn wrote: | Hi, | | ID is not the value column. Your casting call should be | | dcast(aa, ... ~ Target, value.var = Eaten) Thanks for that illumination. That does exactly what I wanted. I knew there were many ways of achieving the result, but I

Re: [R] dummy encoding in metafor

2013-01-23 Thread Michael Dewey
At 08:30 23/01/2013, Alma Wilflinger wrote: Dear Wolfgang and Michael, thank you very much for your help! Concerning the Variance: I took the variance I used for CMA (which is always 1), so I think it should be the right one. It seems unlikely to me that the variance from each study would

[R] problems with coercing a factor to be numeric

2013-01-23 Thread Francesco Sarracino
Dear R listers, I am trying to compute the mean of a dummy variable that is encoded as a factor. However, even though the levels of my factor are 0 - 1, when I compute the mean (after coercing the factor to be numeric), R changes 0 into 1 and 1 into yes, thus altering my expected result. Please,

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread D. Rizopoulos
Check R FAQ 7.10: How do I convert factors to numeric? I hope it helps. Best, Dimitris On 1/23/2013 10:33 AM, Francesco Sarracino wrote: Dear R listers, I am trying to compute the mean of a dummy variable that is encoded as a factor. However, even though the levels of my factor are 0 - 1,

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread Francesco Sarracino
Dear Dimitris, thanks for your quick reply. I've tried the solutions proposed in 7.10 How do I convert factors to numeric? as.numeric(as.character(pp)) and as.numeric(levels(pp))[as.integer(pp)] However, whatever I do, I get Warning message: NAs introduced by coercion and the output is a vector

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread D. Rizopoulos
check also pp - rep(0:1, 10) pp - factor(pp, levels=(0:1), labels=c(no,yes)) unclass(pp) unclass(pp) - 1 Best, Dimitris On 1/23/2013 10:48 AM, Francesco Sarracino wrote: Dear Dimitris, thanks for your quick reply. I've tried the solutions proposed in 7.10 How do I convert factors to

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread Francesco Sarracino
Thanks, this works! but I am surprised that R has such a strange behavior and that there is no way to control it. BTW, also as.integer(pp)-1 works! Still, it doesn't look to me as a first best. At any rate, thanks a lot for your help. f. On 23 January 2013 10:53, D. Rizopoulos

Re: [R] Concatenate two lists, list by list

2013-01-23 Thread Alaios
Thanks a lot Petr, for the answer unfortunately that would convert everything to a matrix num [1:32002, 1:3] 0 0 0 0 0 0 0 0 0 0 ... but if you check below you can see that I Want those to form a list. Regards Alex From: PIKAL Petr petr.pi...@precheza.cz

Re: [R] Concatenate two lists, list by list

2013-01-23 Thread D. Rizopoulos
you just need: mapply(c, Part1$dataset, Part2$dataset, SIMPLIFY = FALSE) I hope it helps. Best, Dimitris On 1/23/2013 11:01 AM, Alaios wrote: Thanks a lot Petr, for the answer unfortunately that would convert everything to a matrix num [1:32002, 1:3] 0 0 0 0 0 0 0 0 0 0 ... but if you

[R] [R-pkgs] lambda.r 1.1.0 on CRAN

2013-01-23 Thread Brian Lee Yung Rowe
Dear useRs, I'm pleased to announce that version 1.1.0 of lambda.r is now available on CRAN (http://cran.r-project.org/web/packages/lambda.r/). This package provides a complete functional programming environment within R (and is backwards compatible with S3). Lambda.r introduces many concepts

Re: [R] dummy encoding in metafor

2013-01-23 Thread Alma Wilflinger
Dear Wolfgang and Michael, thank you very much for your help! Concerning the Variance: I took the variance I used for CMA (which is always 1), so I think it should be the right one. Thank you for noticing and mentioning though :) I really appreciate how helpful you both are. best, Alma

[R] generating ccensoring time for constant survival rate

2013-01-23 Thread ersoy ates
Dear R-ers, I've generated data for failure times log(T) from standard normal distribution. How can I generate data for censoring times from log-normal distribution which ý can get constatnt hazard rate. [[alternative HTML version deleted]]

[R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Christian Röver
Hi, I would like to do a meta-analysis, i.e., a mixed-effects regression, but I don't seem to get what I want using both the nlme or metafor packages. My question: is there indeed no way to do it? And if so, is there another package I could use? Here are the details: In my meta-analysis I'm

Re: [R] New Book: Statistical Psychology with R [in French]

2013-01-23 Thread Spencer Graves
Dear M. Noel: You may know that there is a list of books on the R web site (www.r-project.org - books: www.r-project.org/doc/bib/R-books.html). I'm not sure what you should do to get this book listed there. If no one else suggests what to do, you might wish to write to Frau Palege in

Re: [R] Concatenate two lists, list by list

2013-01-23 Thread Alaios
Thanks a lot. Unfortunately that did not help either. num [1:32003, 1:3] 0 0 0 0 0 0 0 0 0 0 ...  - attr(*, dimnames)=List of 2   ..$ : chr [1:32003] ...   ..$ : NULL but I want to get List of 3   $ : num [1:32002] 0 0 0 0 0 0 0 0 0 0 ...   $ : num [1:32002] 0 0 0 0 0 0 0 0 0 0 ...   $

Re: [R] Nesting fixed factors in lme4 package

2013-01-23 Thread Martina Ozan
Hi, thanks. I am indeed interested in the main effects of A and B and their interaction+ I want to incorporate C (the block or 'repetition' within which the A and B treatments were applied) as a random variable. So A*B would be the way, however errors of A and B are different due to

Re: [R] Concatenate two lists, list by list

2013-01-23 Thread D. Rizopoulos
In this example, I get the following: lis1 - replicate(3, rnorm(5), simplify = FALSE) lis2 - replicate(3, rnorm(5), simplify = FALSE) lis1 lis2 mapply(c, lis1, lis2, SIMPLIFY = FALSE) Best, Dimitris On 1/23/2013 11:58 AM, Alaios wrote: Thanks a lot. Unfortunately that did not help either.

[R] CFA with lavaan or with SEM

2013-01-23 Thread David Purves
Hi Sorry for the rather long message. I am trying to use the cfa command in the lavaan package to run a CFA however I am unsure over a couple of issues. I have @25 dichotomous variables, 300 observations and an EFA on a training dataset suggests a 3 factor model. After defining the model I

Re: [R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Viechtbauer Wolfgang (STAT)
Hello Christian, First of all, it's good to see that you are well aware of the fact that lme() without lmeControl(sigma=1) will lead to the estimation of the residual variance component, which implies that the sampling variances specified via varFixed() are only assumed to be known up to a

Re: [R] summarise subsets of a vector

2013-01-23 Thread Jessica Streicher
Or maybe x-matrix(test,nrow=10) apply(x,2,mean) On 23.01.2013, at 00:09, Wim Kreinen wrote: Hello, I have vector called test. And now I wish to measure the mean of the first 10 number, the second 10 numbers etc How does it work? Thanks Wim dput (test) c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

Re: [R] importing data

2013-01-23 Thread R. Michael Weylandt
On Wed, Jan 23, 2013 at 9:16 AM, Ray Cheung ray1...@gmail.com wrote: Dear All, Sorry for asking a newbie question. I want to ask how to import 1000 datasets whose file names are labelled from data1.dat to data1000.dat into R so that they are named M[1, , ] to M[1000, , ] accordingly. Thank

Re: [R] Dot plot of character and numeric matrix

2013-01-23 Thread Jessica Streicher
As an example: chars-c(A,A,B) numbers-as.numeric(as.factor(chars)) #make this numerical plot(numbers,c(0.4,0.5,0.6),xaxt=n) #xaxt=n says to not plot the x-axis axis(side=1,at=numbers,labels=chars) #make the axis with labels On 23.01.2013, at 10:16, Ng Wee Kiat Jeremy wrote: Dear List, I

[R] how to read a df like that and transform it?

2013-01-23 Thread Yao He
Dear all I have a data.frame like that : father mother num_daughterdaughter 291 39060 NULL 275 42190 NULL 273 42361 49410 281 41631 49408 274 42261 49406 295 38692 49403

Re: [R] how to read a df like that and transform it?

2013-01-23 Thread Ista Zahn
I don't really understand this data table, but maybe this modification will give you the idea: dat - read.table(text=father mother num_daughterdaughter 291 39060 NA 275 42190 NA 273 42361 49410 281 41631 49408 274 42261

[R] Average calculations

2013-01-23 Thread Nico Met
Dear all, I have a matrix with two columns: Names and Values In names: there are 4 groups they are, CK113234, CK116296, CK116292 and CK114042 I want to *sort values* (decreasing order) based on each group and take average of the *top two numbers* in each of the groups. dput(x)

[R] Regression with 3 measurement points

2013-01-23 Thread Torvon
Dear R Mailinglist, I want to understand how predictors are associated with a dependent variable in a regression. I have 3 measurement points. I'm not interested in understanding the associations of regressors and the predictor at each measurement separately, instead I would like to use the whole

Re: [R] mixed effects meta-regression: nlme vs. metafor

2013-01-23 Thread Christian Röver
Hi Wolfgang, thanks for the instant and comprehensive reply! On 01/23/2013 12:39 PM, Viechtbauer Wolfgang (STAT) wrote: [...] In fact, trying to disentangle that residual variance component from any random study effects is usually next to impossible. I mention this explicitly one more

Re: [R] Average calculations

2013-01-23 Thread Jose Iparraguirre
Hi Nico, You can use tapply: tapply( x[[Values ]], x[[ Names ]], mean ) CK113234 CK113298 CK114042 CK116292 CK116296 216.5061 190.1725 222.8710 220.4324 204.5741 Alternatively, tapply( x$Values, x$Names, mean ) CK113234 CK113298 CK114042 CK116292 CK116296 216.5061 190.1725 222.8710

Re: [R] Percentiles with R for a big data.frame

2013-01-23 Thread Simonas Kecorius
I found a code: y.ts - ts(data, frequency=12) aggregate(y.ts, FUN=quantile, probs=0.10) Seems it works fine even for a big data.frame. Thanks for your help. 2013/1/22 David Winsemius dwinsem...@comcast.net On Jan 22, 2013, at 5:58 AM, Simonas Kecorius wrote: Hey Duncan, Neither me do

Re: [R] CFA with lavaan or with SEM

2013-01-23 Thread John Fox
Dear David, On Wed, 23 Jan 2013 11:19:09 + David Purves david.pur...@glasgow.ac.uk wrote: Hi Sorry for the rather long message. . . . I have tried the analysis using John Fox's SEM package / command. I calculate the correlation matrix with smoothing

Re: [R] Regression with 3 measurement points

2013-01-23 Thread Bert Gunter
Post elsewhere (e.g. stats.stackexchange.com). This is not a statistical tutorial site. -- Bert On Wed, Jan 23, 2013 at 5:28 AM, Torvon tor...@gmail.com wrote: Dear R Mailinglist, I want to understand how predictors are associated with a dependent variable in a regression. I have 3

Re: [R] Evaluating the significance of the random effects in GLMM

2013-01-23 Thread Ben Bolker
Gabriela Agostini gabrielaagostini18 at gmail.com writes: [snip] I am working with GLMM using the binomial family I use the following codes I dropped no significant terms, refitting the model and comparing the changes with likelihood:

[R] setting off-diagonals to zero

2013-01-23 Thread emorway
The following 1460 x 1460 matrix can be throught of as 16 distinct 365 x 365 matrices. I'm trying to set off-diaganol terms in the 16 sub-matrices with indices more than +/- 5 (days) from each other to zero using some for loops. This works well for some, but not all, of the for loops. The R

Re: [R] Dot plot of character and numeric matrix

2013-01-23 Thread Jeff Newmiller
I think you need to become more familiar with the factor data type. Reread the Introduction to R document that comes with R. --- Jeff NewmillerThe . . Go Live...

Re: [R] summarise subsets of a vector

2013-01-23 Thread David L Carlson
You didn't indicate what you want to do with the 101st observation. Arun's solution creates an 11th group and divides by the number in the group(1), while Jessica's solution creates an 11th column and divides by 10. test[101] - 100 unlist(lapply(split(test,((seq_along(test)-1)%/% 10)+1),mean))

Re: [R] Average calculations

2013-01-23 Thread arun
Hi, Try this:  x1-x[rev(order(x$Names,x$Values)),] do.call(rbind,tapply(x1$Values,list(x1$Names),head,2)) # [,1] [,2] #CK113234 223.2966 222.6737 #CK113298 192.5964 187.7486 #CK114042 236.3939 232.0223 #CK116292 237.5936 228.0037 #CK116296 223.6372 210.6630 #The average

Re: [R] CFA with lavaan or with SEM

2013-01-23 Thread David Purves
Hi John Thanks for your quick reply. The full warning I got is ' Error in csem(model = model.description, start, opt.flag = 1, typsize = typsize, : The matrix is non-invertable.' The eigenvalues of the tetrachoric correlations are non negative. So it is must be how I am defining my model.

Re: [R] how to read a df like that and transform it?

2013-01-23 Thread arun
Hi, It's not clear regarding those blanks especially, the num_daughter.  I guess the father and mother would be the same as the previous row. Deleting those rows: df1 - read.table(text=father  mother  num_daughter    daughter 291    3906    0  NA 275    4219    0  NA 273    4236    1 

Re: [R] how to read a df like that and transform it?

2013-01-23 Thread arun
Hi, May be this helps: df1-read.table(text= father,mother,num_daughter,daughter 291,3906,0, 275,4219,0, 273, 4236,1,49410 281,4163,1,49408 274, 4226,1,49406 295, 3869,2,49403 295,3869,2,49404 287,4113,0, 295, 3871,1,49401 292, 3895,4,49396 292,3895,4, 49397 292,3895,4,49398 292,3895,4,49399

[R] to check if a character string is in a group of character strings

2013-01-23 Thread Yuan, Rebecca
Hello, How can I judge if a string is in a group of string? For example, I would like to have if (subpool in pool){ }else{ } Where pool = c(s1,s2) subpool = c(s1) How can I write the subpool in pool right in R? Thanks very much! Cheers, Rebecca

Re: [R] CFA with lavaan or with SEM

2013-01-23 Thread John Fox
Dear David, It certainly helps to have a reproducible example. You've left out the error variances (uniquenesses) for the observed variables. You're also making the specification *much* harder than it needs to be: -- snip --- cfa.mod.1 - cfa() 1: F: a, b, c, d, e, g 2: Read 1

Re: [R] to check if a character string is in a group of character strings

2013-01-23 Thread Duncan Murdoch
On 13-01-23 11:14 AM, Yuan, Rebecca wrote: Hello, How can I judge if a string is in a group of string? For example, I would like to have if (subpool in pool){ }else{ } if (subpool %in% pool) Duncan Murdoch Where pool = c(s1,s2) subpool = c(s1) How can I write the subpool in pool

Re: [R] to check if a character string is in a group of character strings

2013-01-23 Thread Jose Iparraguirre
Not sure what you want this for, but work along the following: pool = c(s1,s2) subpool = c(s1) ifelse(pool==subpool,1,0) [1] 1 0 Notice: pool2 = c(s2,s1) ifelse(pool2==subpool,1,0) [1] 0 1 Etc. Hope this helps. José José Iparraguirre Chief Economist Age UK -Original

Re: [R] FactoMineR

2013-01-23 Thread John Fox
Dear Daniel, Eventually, FactoMineR (and other Rcmdr plug-ins) really should be updated to conform to R 3.0.0 requirements, but I've modified the development version 1.9-4 of the Rcmdr on R-Forge to allow a new option to accommodate some of these plug-ins. If you set

Re: [R] to check if a character string is in a group of character strings

2013-01-23 Thread Yuan, Rebecca
Hello Duncan, Thanks for this! This works! Best, Rebecca -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, January 23, 2013 11:23 AM To: Yuan, Rebecca Cc: R help Subject: Re: [R] to check if a character string is in a group of character

Re: [R] setting off-diagonals to zero

2013-01-23 Thread Berend Hasselman
On 23-01-2013, at 16:13, emorway emor...@usgs.gov wrote: The following 1460 x 1460 matrix can be throught of as 16 distinct 365 x 365 matrices. I'm trying to set off-diaganol terms in the 16 sub-matrices with indices more than +/- 5 (days) from each other to zero using some for loops. This

Re: [R] CFA with lavaan or with SEM

2013-01-23 Thread John Fox
Dear Daniel, Oh, I see I forgot to comment on your second specification in my last reply: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David Purves Sent: Wednesday, January 23, 2013 10:23 AM To: John Fox Cc:

Re: [R] Create a Data Frame from an XML

2013-01-23 Thread Adam Gabbert
Hello Gentlemen, I mistakenly sent the message twice, because the first time I didn't receive a notification message so I was unsure if it went through properly. Your solutions worked great. Thank you! I felt like I was fairly close just couldn't quite get the final step. Now, I'm trying to

Re: [R] to check if a character string is in a group of character strings

2013-01-23 Thread ONKELINX, Thierry
I think you want %in% subpool %in% pool pool %in% subpool ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525 02 51 + 32

Re: [R] summarise subsets of a vector

2013-01-23 Thread Jessica Streicher
Or... fs-rep(1:ceiling(length(test)/10),each=10)[1:length(test)] result-by(test,fs,mean) which will get you the version with the 101st as a single datapoint so many possibilities.. On 23.01.2013, at 16:43, David L Carlson wrote: You didn't indicate what you want to do with the 101st

Re: [R] Adding a line to barchart

2013-01-23 Thread Jonathan Greenberg
Great! This really helped! One quick follow-up -- is there a trick to placing a label wherever the line intersects the x-axis (either above or below the plot)? On Tue, Jan 22, 2013 at 11:49 PM, PIKAL Petr petr.pi...@precheza.cz wrote: Hi This function adds line to each panel addLine -

[R] italic font for legend text when using expression function for symbols

2013-01-23 Thread raz
Hello, I'm trying to add a symbol (Delta) to plot legend with text using expression(paste()) but this disables the text.font that allows to use bold or italic text. as follows: x=c(1:10) y=c(1:10) plot(x,y) legend(1,10,legend=c(A,B,C,expression(paste(Delta, D))),

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread David Winsemius
On Jan 23, 2013, at 1:58 AM, Francesco Sarracino wrote: Thanks, this works! but I am surprised that R has such a strange behavior and that there is no way to control it. BTW, also as.integer(pp)-1 works! Still, it doesn't look to me as a first best. At any rate, thanks a lot for your help.

Re: [R] density of hist(freq = FALSE) inversely affected by data magnitude

2013-01-23 Thread William Dunlap
I think it is a fair bit of work to interpret the freq=TRUE (prob=FALSE) version of hist() when the bins have unequal sizes. E.g., in the following the bins are sized so that each contains an equal number of observations. The resulting flat frequency plot is hard for me to interpret. The

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread William Dunlap
To find the proportion of yess in pp you can use mean(pp == yes) and avoid the conversion of a factor to integer (and subtracting 1). The above works for character and factor pp. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From:

Re: [R] Adding a line to barchart

2013-01-23 Thread S Ellison
I need a quick help with the following graph (I'm a lattice newbie): require(lattice) npp=1:5 names(npp)=c(A,B,C,D,E) barchart(npp,origin=0,box.width=1) # What I want to do, is add a single vertical line positioned at x = 2 that lays over the bars (say, using a dotted

[R] extracting characters from a string

2013-01-23 Thread Biau David
Dear All, I have a data frame of vectors of publication names such as 'pub': pub1 - c('Brown DK, Santos R, Rome DF, Don Juan X') pub2 - c('Benigni D') pub3 - c('Arstra SD, Van den Hoops DD, lamarque D') pub - rbind(pub1, pub2, pub3) I would like to construct a dataframe with only author's

Re: [R] Evaluating the significance of the random effects in GLMM

2013-01-23 Thread Gabriela Agostini
Thanks! The comments and the information provided were extremely helpful to me. According to DRAFT r-sig-mixed-models FAQ, do not compare lmer models with the corresponding lm fits, or glmer/glm; the log-likelihoods are not commensurate. The problem is not the link function but rather the

Re: [R] extracting characters from a string

2013-01-23 Thread Bert Gunter
1. Study a regular expression tutorial on the web to learn how to do this. 2. ?regex in R summarizes (tersely! -- but clearly) R's regex's. 3. ?grep tells you about R's regular expression manipulation functions. -- Bert On Wed, Jan 23, 2013 at 9:38 AM, Biau David djmb...@yahoo.fr wrote: Dear

Re: [R] extracting characters from a string

2013-01-23 Thread Rui Barradas
Hello, Try the following. fun - function(x, sep = , ){ s - unlist(strsplit(x, sep)) regmatches(s, regexpr([[:alpha:]]*, s)) } fun(pub) Hope this helps, Rui Barradas Em 23-01-2013 17:38, Biau David escreveu: Dear All, I have a data frame of vectors of publication names

Re: [R] italic font for legend text when using expression function for symbols

2013-01-23 Thread ilai
plot(1) legend('topleft',legend=expression(A,italic(A),bolditalic(A),Delta*italic(D))) On Wed, Jan 23, 2013 at 9:45 AM, raz barvazd...@gmail.com wrote: Hello, I'm trying to add a symbol (Delta) to plot legend with text using expression(paste()) but this disables the text.font that allows to

Re: [R] extracting characters from a string

2013-01-23 Thread Rui Barradas
Hello, I've just noticed that my first solution would only return the first set of alphabetic characters, such as Van, not Van den Hoops. The following will solve that problem. fun2 - function(x, sep = , ){ x - strsplit(x, sep) m - lapply(x, function(y) gregexpr(

[R] hyphen replaced by period in header when using read.table

2013-01-23 Thread Michael.Dufault
To Whom It May Concern: I have noticed that all of the hyphens (-) are changed to periods (.) when I try to read.table() and the headers contain - I am using R 2.13 on a RedHat system. Here is the situation: I have the following a tab-delimited text file saved as test.txt File1-a.txt

Re: [R] extracting characters from a string

2013-01-23 Thread arun
Hi, You could try this: dat1-read.table(text=pub,sep=,,fill=TRUE,stringsAsFactors=F) dat2- as.data.frame(do.call(cbind,lapply(dat1,function(x) gsub( $,,gsub(^ |\\w+$,,x,stringsAsFactors=F)  dat2 #    V1  V2 V3 V4 #1   Brown  Santos   Rome   Don

Re: [R] nesting in CoxPH with survival package

2013-01-23 Thread Katie Anweiler
Thank you for the suggestions. Just to clarify, my first question was more on what actual coding I should be using to indicate a nested variable when using the coxph() function. I asked this after consulting several times with a local statistician, but unfortunately neither of us are very

Re: [R] hyphen replaced by period in header when using read.table

2013-01-23 Thread Sarah Goslee
Please read ?read.table again, and pay special attention to the check.names argument. A - is not allowed in a column name because it would lead to problems like: mydata$a-b vs mydata$a - b where mydata$a.b has no such confusion. If you must have - instead of ., you can use check.names=FALSE and

Re: [R] how to read a df like that and transform it?

2013-01-23 Thread arun
Hi, If the `spaces` in father, mother, num_daughter columns needs to be replaced by the values in the previous row,  dat1-read.table(text= father, mother, num_daughter, daughter 291, 3906, 0, 275, 4219, 0, 273, 4236, 1, 49410 281, 4163, 1, 49408 274, 4226, 1, 49406 295, 3869, 2, 49403    , ,, 

[R] Pasting a list of parameters into a function

2013-01-23 Thread bsm2
I need to repeat a function many times, with differing parameters held constant across iterations. To accomplish this, I would like to create a list (or vector) of parameters, and then insert that list into the function. For example: q-(l,a,b,s) genericfunction-function(q){ } ## The

[R] How to extract values of results in gamlss.tr

2013-01-23 Thread Katherine Gobin
Dear R helpers, I have following loss data and I need to fit LEFT truncated Log Normal distribution to this data which is Truncated at 100. dat = c(1333834,5710254,9987567,7809469,6940935,3473671,1270209,1102523,1124002,

Re: [R] How to extract values of results in gamlss.tr

2013-01-23 Thread David Winsemius
On Jan 23, 2013, at 12:14 PM, Katherine Gobin wrote: Dear R helpers, I have following loss data and I need to fit LEFT truncated Log Normal distribution to this data which is Truncated at 100. dat = c(1333834,5710254,9987567,7809469,6940935,3473671,1270209,1102523,1124002,

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread Rolf Turner
Given that your labels are no and yes, what do you expect R to do? To quote a well-known fortune, R is lacking a mind_read() function! cheers, Rolf Turner On 01/23/2013 10:58 PM, Francesco Sarracino wrote: Thanks, this works! but I am surprised that R has such a strange behavior

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread Francesco Sarracino
Thank you all for your replies. Let me try to explain my point: first of all, let me clarify that I didn't mean to criticize anyone (or anything). Secondly, what I meant refers to the fact that I've read on an R and S-plus companion to applied regression about methods to alter the encoding of

Re: [R] dummy encoding in metafor

2013-01-23 Thread Alma Wilflinger
Hi Michael, The supervisorfor my Master'sThesis told me that my means are the effect size and cause of this I have to take figure 1 for all standard deviations. So I hope that was the right information. From: Michael Dewey i...@aghmed.fsnet.co.uk

Re: [R] How to construct a valid seed for l'Ecuyer's method with given .Random.seed?

2013-01-23 Thread Marius Hofert
Dear Hana, Thanks for helping. I am still wondering, why m1 (which should be 2^32-209 [see line 34 in ./src/RngStream.c]) is -767742437 in my case and why the minimal example you gave was working for you but isn't for me. Apart from that, ?.Random.seed - L'Ecuyer-CMRG says: , | The 6

Re: [R] How to construct a valid seed for l'Ecuyer's method withgiven .Random.seed?

2013-01-23 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Marius Hofert Sent: Wednesday, January 23, 2013 2:24 PM To: Hana Sevcikova Cc: R-help Subject: Re: [R] How to construct a valid seed for l'Ecuyer's method withgiven

Re: [R] How to construct a valid seed for l'Ecuyer's method with given .Random.seed?

2013-01-23 Thread Hana Sevcikova
Marius, I looked it up in the original L'Ecuyer's paper: The seed must be larger than 0. Thus, the function defines the seed variable as unsigned long integer. You're passing a negative number, so I think there is some overflow going on. The internal L'Ecuyer RNG is a modification of the

Re: [R] SNPRelate package error

2013-01-23 Thread dunningl
I had the same problem but it now works if you remove some of the #info lines at the top of the file so that the number of lines is the same as the example sequence.vcf file before the data starts -- View this message in context:

[R] cannot allocate memory block of size 2.7 Gb

2013-01-23 Thread Cláudio Brisolara
Hello R-users I am getting error messagens when I require some packages or execute some procedures, like these below: require(tseries) Loading required package: tseries Error in get(Info[i, 1], envir = env) : cannot allocate memory block of size 2.7 Gb require (TSA) Loading required

Re: [R] setting off-diagonals to zero

2013-01-23 Thread emorway
I'm not following. Printing SEQ to the screen at the intermediate steps using the following modified R code suggests that 'i' is fine and is not getting reset to 1 as you suggest? My understanding, or rather my desired output if someone else is able to weight-in, is that the values in the second

[R] how to read a website with Chinese Character

2013-01-23 Thread Hui Du
Hi all, I am planning to parse some information on a website which includes lots of Chinese characters. Does someone know how to read/display Chinese in R? Thanks. url = http://www.teec.org.cn/html/renwujieshao/; x = readLines(url) I tried encoding = 'UTF-8' already but it didn't help. My R

Re: [R] setting off-diagonals to zero

2013-01-23 Thread David Winsemius
On Jan 23, 2013, at 7:13 AM, emorway wrote: The following 1460 x 1460 matrix can be throught of as 16 distinct 365 x 365 matrices. I'm trying to set off-diaganol terms in the 16 sub-matrices with indices more than +/- 5 (days) from each other to zero using some for loops. This works well

Re: [R] how to read a website with Chinese Character

2013-01-23 Thread Duncan Murdoch
On 13-01-23 8:19 PM, Hui Du wrote: Hi all, I am planning to parse some information on a website which includes lots of Chinese characters. Does someone know how to read/display Chinese in R? Thanks. url = http://www.teec.org.cn/html/renwujieshao/; x = readLines(url) If you look at the

Re: [R] setting off-diagonals to zero

2013-01-23 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of emorway Sent: Wednesday, January 23, 2013 4:59 PM To: r-help@r-project.org Subject: Re: [R] setting off-diagonals to zero I'm not following. Printing SEQ to the screen at the

[R] Recommendation for website to format R code

2013-01-23 Thread C W
Hi list, Could anyone recommend some good website for formatting R code? For example, when you copy paste R code to gmail and back to R, it loses its format, the dash symbol causes errors. I've had someone used it to format my code here on the list, but can't find it anymore. Mike

Re: [R] Recommendation for website to format R code

2013-01-23 Thread Mark Lamias
Are you only interested in formatting code from copy and pasting to/from email?  If you are interested in formatting your code in Latex/PDF/HTML take a look at the knitr package: http://yihui.name/knitr/ Also, you could check out the formatR package:

Re: [R] Recommendation for website to format R code

2013-01-23 Thread C W
Hey Mark, I am aware of this package. The situation is, 1. I am emailing my code from my machine to a public machine. Installation is a hassle. 2. Copy pasting for a website. I know there are websites for formatting Java and C code. So, I am looking for a website in particular, and I have seen

Re: [R] setting off-diagonals to zero

2013-01-23 Thread arun
HI, Not sure this is what you wanted. for (i in 731:732) {   SEQ - (i - 5):(i + 5)   print(SEQ)   SEQ - SEQ[SEQ 730 SEQ 1096]   print(SEQ)   vec1-731:741   print(vec1[!vec1%in%SEQ]) } #[1] 726 727 728 729 730 731 732 733 734 735 736 #[1] 731 732 733 734 735 736 #[1] 737 738 739 740 741 # [1]

Re: [R] Create a Data Frame from an XML

2013-01-23 Thread Ben Tupper
Hi Adam, On Jan 23, 2013, at 11:36 AM, Adam Gabbert wrote: Hello Gentlemen, I mistakenly sent the message twice, because the first time I didn't receive a notification message so I was unsure if it went through properly. Your solutions worked great. Thank you! I felt like I was

Re: [R] how to read a website with Chinese Character

2013-01-23 Thread Hui Du
Thanks a lot. y - iconv(x, gb2312, utf-8) does not work but y - iconv(x, gb2312, UTF8) works on my machine. Thank you for pointing to the right direction. -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, January 23, 2013 6:16 PM To: Hui Du

Re: [R] Copy on assignment and .Internal(inspect())

2013-01-23 Thread Carlos Pita
Here's another approach using the sampling profiler: prof - function() { Rprof(memory.profiling=T, interval=0.001) replicate(100, f()) Rprof(NULL) summaryRprof(memory = stats) } f - function() { x = seq(1000) for(i in seq(1000)) { x[i] - x[i] + 1 } } prof() = index:

Re: [R] problems with coercing a factor to be numeric

2013-01-23 Thread S Ellison
On 23 Jan 2013, at 21:36, Francesco Sarracino f.sarrac...@gmail.com wrote: what I meant refers to the fact that I've read on an R and S-plus companion to applied regression about methods to alter the encoding of factors when using contrasts in regressions. These are options (for

Re: [R] extracting characters from a string

2013-01-23 Thread Biau David
thanks, it works well. I have to work on Arun's previous answer to make it work too.   David De : Rui Barradas ruipbarra...@sapo.pt À : Biau David djmb...@yahoo.fr Cc : r help list r-help@r-project.org Envoyé le : Mercredi 23 janvier 2013 19h57 Objet : Re:

Re: [R] setting off-diagonals to zero

2013-01-23 Thread Berend Hasselman
On 24-01-2013, at 01:58, emorway emor...@usgs.gov wrote: I'm not following. Printing SEQ to the screen at the intermediate steps using the following modified R code suggests that 'i' is fine and is not getting reset to 1 as you suggest? You misread. I did not say anything about 'i'. My

[R] Rcpp wrap and as

2013-01-23 Thread Carlos Pita
Hi, I'm curious about the ability of these two methods to really wrap (I mean as in delegate) the target object instead of deep copying and transforming it to a new structure. First, specifically for vectors. Second, in general (my hunch is that -say- map-env are transformed copies but it's just a

Re: [R] extracting characters from a string

2013-01-23 Thread arun
HI David, It could be related to spaces in the data or something else.  Suppose, if the data has some spaces at the end or the beginning. pub1 - c('Brown DK, Santos R, Rome DF, Don Juan X') pub2 - c('Benigni D') pub3 - c('Arstra SD, Van den Hoops DD, lamarque D ') pubnew-rbind(pub1, pub2,

[R] hologram

2013-01-23 Thread lidun
Guangzhou Lidun Hologram Co., Ltd. Home|Product|company Profile |Contacts|more DearFriends, Best Wishes For You! Wish you have a good day!We are the major manufacturer and exporter of silicone bracelets and holographic stickers with more than ten years experience in China. Also, custom

  1   2   >