Re: [R] Where did lost variables go

2014-01-02 Thread jwd
On Mon, 30 Dec 2013 20:42:53 -0500 David Parkhurst parkh...@indiana.edu wrote: I have several variables in a data frame that aren't listed by ls() after I attach that data frame. Where did they go, and how can I stop the hidden ones from masking the local ones? Thanks for any help. David

Re: [R] Basic misunderstanding, or problem with my installation?

2014-01-02 Thread jwd
On Tue, 31 Dec 2013 19:51:06 -0500 Gabor Grothendieck ggrothendi...@gmail.com wrote: ... The assignment operator is TWO characters: a less than sign immediately followed by a minus sign. Try copying and pasting this: x - 3 x Actually, you can use the = sign as well. X = 3 works the

[R] Data parsing question: adding characters within a string of characters

2014-01-02 Thread Joshua Banta
Dear Listserve, I have a data-parsing question for you. I recognize this is more in the domain of PERL/Python, but I don't know those languages! On the other hand, I am pretty good overall with R, so I'd rather get the job done within the R ecosphere. Here is what I want to do. Consider the

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Luca Meyer
Hi Jim, Thank you, it works indeed :) Luca 2014/1/2 Jim Lemon j...@bitwrit.com.au On 01/02/2014 05:17 PM, Luca Meyer wrote: Happy new year fellows, I am trying to do something I believe should be fairly straightforward but I cannot find my way out. My dataset d2 is 26 rows by 245

Re: [R] Where did lost variables go, with example

2014-01-02 Thread PIKAL Petr
Hi you are confusing yourself and maybe other audience. With ls() you list objects in your environment (usually stored in .RData file) and loaded with starting R. Let me guess. You probably have 2 data frames All8 and All8Sites. They have some variables inside and you can see structure of any

Re: [R] Data parsing question: adding characters within a string of characters

2014-01-02 Thread Duncan Murdoch
On 14-01-01 10:55 PM, Joshua Banta wrote: Dear Listserve, I have a data-parsing question for you. I recognize this is more in the domain of PERL/Python, but I don't know those languages! On the other hand, I am pretty good overall with R, so I'd rather get the job done within the R ecosphere.

Re: [R] Data parsing question: adding characters within a string of characters

2014-01-02 Thread Gabor Grothendieck
On Wed, Jan 1, 2014 at 10:55 PM, Joshua Banta jba...@uttyler.edu wrote: Dear Listserve, I have a data-parsing question for you. I recognize this is more in the domain of PERL/Python, but I don't know those languages! On the other hand, I am pretty good overall with R, so I'd rather get the

Re: [R] Where did lost variables go, with example

2014-01-02 Thread peter dalgaard
On 31 Dec 2013, at 17:32 , Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-12-31 9:48 AM, David Parkhurst wrote: Two or three respondents asked for an example of my problem. Here's what's happening to me now. I can't reproduce how I got to this point, though: ls() [1] All8

Re: [R] Data parsing question: adding characters within a string of characters

2014-01-02 Thread Frede Aakmann Tøgersen
Hi Joshua This is one way to do it. Not sure if it this is an efficient implementation for your needs; it depends on the size of your data. string1 - ATCGCCCGTA[AGA]TAACCG string2 - ATTATACGCA[AAATGA]GCTA[AT]GCATTA foo - function(genes){ mypaste - function(x) paste([, paste(x,

[R] Create a unique group id

2014-01-02 Thread Norbi Gurracho
I have a following sample data frame. How can I create a group id of column and b and to obtain column c? a b c 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 2 1 3 3 1 3 3 1 3 3 2 1 4 2 1

[R] Discrete-continuous equation system in R

2014-01-02 Thread Reinhard Hössinger
Hi all, I want to estimate an equation system with 3 nonlinear continuous equations and one discrete choice (using multinomial logit for the latter). For the nonlinear continuous equations, function nlsystemfit {systemfit} seems to be appropriate. But what's about the discrete choice? Its

Re: [R] Create a unique group id

2014-01-02 Thread PIKAL Petr
Hi Your question was formated in HTML and therefore came scrammbled. Post in plain text. And preferably use dput for posting data. Regards Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Norbi Gurracho Sent: Thursday,

Re: [R] Create a unique group id

2014-01-02 Thread arun
Hi, Try: dat - read.table(text=a    b    c  1    1    1  1    1    1  1    1    1  1    2    2  1    2    2  1    2    2  1    3    3  1    3    3  1    3    3  2    1    4  2    1    4  2    1    4  2    2    5  2    2    5  2    2    5  2    2    5,sep=,header=TRUE)   

Re: [R] How to remove rows in a matrix having 0 as value in columns per condition

2014-01-02 Thread arun
Hi,It is not very clear. data1 - read.table(PGRTvsPDGRT_frags.txt,header=TRUE,stringsAsFactors=FALSE) mat1- as.matrix(data1[,-1]) row.names(mat1)- data1[,1] res - mat1[apply(mat1,1,function(x) all(x[1:6]!=0) all(x[7:12]!=0)),]  sum(rowSums(!res)0) #[1] 0 #or #depending upon what you want res1 -

[R] compare two rows in same column in data farme

2014-01-02 Thread raz
Hi, I would like to compare row data in the same column through a data frame and remove all rows that do not fit the criteria. for example if I have the following data frame: line start A1 21 A2 22 A3 23 B4 19 B2 24 B6 12 I would like to compare the 'start' value of each line to the value

Re: [R] compare two rows in same column in data farme

2014-01-02 Thread arun
Hi, May be this helps: dat1 - read.table(text=line start   A1 21   A2 22   A3 23   B4 19   B2 24   B6 12,sep=,header=TRUE,stringsAsFactors=FALSE) dat1[c(TRUE,diff(dat1[,2]) 0 ),] #  line start #1   A1    21 #2   A2    22 #3   A3    23 #5   B2    24 A.K. On Thursday, January 2, 2014 10:54 AM,

Re: [R] Create a unique group id

2014-01-02 Thread arun
Hi, Also, to make it general: vec1 - with(dat,paste(a,b))  within(dat,d - as.numeric(factor(vec1,labels=seq(length(unique(vec1)) #or  within(dat,d - match(vec1,unique(vec1))) #or within(dat,d- as.numeric(interaction(a,b))) #ids are unique, not in the same order A.K. On Thursday,

[R] Any R-package geared towards Endorsement Frequencies?

2014-01-02 Thread Lila Lorne
Happy New Year everyone, I need some help figuring out if there is an R package tailored towards endorsement frequencies. Would y'all here know of any such packages that they would recommend I use? Thanks! Lily If it doesn't challenge you, it doesn't change you - Fred DeVito

Re: [R] Any R-package geared towards Endorsement Frequencies?

2014-01-02 Thread Ista Zahn
Hi Lila, You will probably have to be more specific. What exactly do you want to do? Have you looked at http://cran.r-project.org/web/views/ ? Best, Ista On Thu, Jan 2, 2014 at 9:59 AM, Lila Lorne lilalillia...@gmail.com wrote: Happy New Year everyone, I need some help figuring out if there

Re: [R] seq_len and loops

2014-01-02 Thread Göran Broström
On 01/01/2014 07:36 PM, William Dunlap wrote: 2. However, Bill (and Henrik) raised the question of replacing '1' with '1L'; I understand the meaning of that, but does it matter (in practice)? On 12/22/2013 06:57 PM, William Dunlap wrote: for (i in seq_len(x - 1) + 1) should be efficient and

Re: [R] Create a unique group id

2014-01-02 Thread Norbi Gurracho
Thanks Arun. How does code differs if I have a date variable instead of numbers like in column a? I have a sample data in dput output. dput(mydf) structure(list(a = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,  1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c(1, 2), class = factor),      b =

Re: [R] Any R-package geared towards Endorsement Frequencies?

2014-01-02 Thread Lila Lorne
I am working with a dataset that is observations of mentors or senior teachers evaluating new or junior teachers in primary classrooms. There are 27 items (5-pt Likert) and I would like to know the proportion of respondents who endorse each response category, including floor and ceiling effects. I

Re: [R] Create a unique group id

2014-01-02 Thread arun
Hi Norbi, It would be almost the same. vec1 - with(mydf,paste(b,date)) res - within(mydf, d - match(vec1,unique(vec1))) res$d # [1] 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 5 mydf$date - as.Date(mydf$date) A.K. On Thursday, January 2, 2014 12:04 PM, Norbi Gurracho kum...@hotmail.com wrote: Thanks

Re: [R] Any R-package geared towards Endorsement Frequencies?

2014-01-02 Thread Ista Zahn
see ?table and ?prop.table for counts and proportions. For factor analysis I usually use the functions in the psych package (see https://personality-project.org/r/#factoranal) , but there are others including the built in ?factanal function. Additional options are described in the psychometrics

Re: [R] For loop for frequency counting

2014-01-02 Thread arun
Hi, May be this helps: var1 - ave(seq_along(fam),fam,FUN=length)  names(var1) - fam  var1 #2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 #4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 #or table(fam)[as.character(fam)] #fam #2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5 #4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 fam1 - c(fam,2)  var2 -

Re: [R] looping function through list

2014-01-02 Thread arun
Hi, May be this helps:  set.seed(42)  output1 - list(list(matrix(0,8,11),matrix(0,8,11)), list(matrix(rnorm(80),8,10),matrix(rnorm(80),8,10)))  library(emdist)  sapply(output1,function(x) {emd2d(x[[seq_along(x)[1]]],x[[seq_along(x)[2]]]) }) #[1]   NaN -6.089909 A.K. I'm trying to apply a

Re: [R] looping function through list

2014-01-02 Thread arun
#or  mapply(emd2d,sapply(output1,`[`,1),sapply(output1,`[`,2)) #[1]   NaN -6.089909 A.K. On Thursday, January 2, 2014 2:33 PM, arun smartpink...@yahoo.com wrote: Hi, May be this helps:  set.seed(42)  output1 - list(list(matrix(0,8,11),matrix(0,8,11)),

Re: [R] R crashes with memory errors on a 256GB machine (and system shoes only 60GB usage)

2014-01-02 Thread Ben Bolker
Xebar Saram zeltakc at gmail.com writes: Hi All, I have a terrible issue i cant seem to debug which is halting my work completely. I have R 3.02 installed on a linux machine (arch linux-latest) which I built specifically for running high memory use models. the system is a 16 core, 256 GB

Re: [R] R crashes with memory errors on a 256GB machine (and system shoes only 60GB usage)

2014-01-02 Thread Max Kuhn
Describing the problem would help a lot more. For example, if you were using some of the parallel processing options in R, this can make extra copies of objects and drive memory usage up very quickly. Max On Thu, Jan 2, 2014 at 3:35 PM, Ben Bolker bbol...@gmail.com wrote: Xebar Saram zeltakc

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread Gerrit Eichner
O-ha, sorry, Luca, I mixed up arguments: it shouldn't be subset but select. apply( subset( d2, select = V13:V239), 1, function( x) any( x != )) should work. Auf Wiederhören! ;-) Regards -- Gerrit On Thu, 2 Jan 2014, Luca Meyer wrote: Hi Gerrit, Thank you for the suggestion.

Re: [R] Discrete-continuous equation system in R

2014-01-02 Thread Arne Henningsen
Dear Reinhard On 2 January 2014 14:12, Reinhard Hössinger reinhard.hoessin...@boku.ac.at wrote: I want to estimate an equation system with 3 nonlinear continuous equations and one discrete choice (using multinomial logit for the latter). For the nonlinear continuous equations, function

Re: [R] looping function through list

2014-01-02 Thread arun
HI, I tested it on R 3.0.2 console (linux) and also on Rstudio Version 0.98.490.  It seems alright. A.K.  Thanks for this. I am trying to run the code you posted but Rstudio keeps crashing. I am trying to run it on the example output1 since it's small but that crashes as well. On

Re: [R] R crashes with memory errors on a 256GB machine (and system shoes only 60GB usage)

2014-01-02 Thread Milan Bouchet-Valat
Le jeudi 02 janvier 2014 à 09:07 +0200, Xebar Saram a écrit : Hi All, I have a terrible issue i cant seem to debug which is halting my work completely. I have R 3.02 installed on a linux machine (arch linux-latest) which I built specifically for running high memory use models. the system is

[R] Help with {tables} package

2014-01-02 Thread Lars Bishop
Dear list, I'm most likely doing something wrong, but I'm getting an error message in tab2 below (tab1 is fine). Any hint is much appreciated. library(tables) set.seed(1) dd - data.frame(x = rnorm(100), f1 = gl(2, 50, labels = c(A, B)), f2 = gl(4, 25, labels = c(a, b, c, d)),

Re: [R] How to verify char variables contain at least one value

2014-01-02 Thread arun
HI, If I understand correctly, you could also try: set.seed(48)  d2 - as.data.frame(matrix(sample(c(,letters[1:2]),26*245,replace=TRUE),26,245))  d2[3,] -  names1 -paste0(V,13:239) res - d2[rowSums(d2[,names1]==) ncol(d2[,names1]),names1] A.K. On Thursday, January 2, 2014 1:20 AM, Luca

[R] Tracking what R actually executes

2014-01-02 Thread Fisher Dennis
R 3.0.2 All platforms Colleagues This question is probably conceptual rather than technical and I have not thought out all of the issues yet. Let’s say I have an extensive list of functions and some lines of code that call the functions. I would like to have a record of all the commands

Re: [R] Tracking what R actually executes

2014-01-02 Thread Duncan Murdoch
On 14-01-02 6:05 PM, Fisher Dennis wrote: R 3.0.2 All platforms Colleagues This question is probably conceptual rather than technical and I have not thought out all of the issues yet. Let’s say I have an extensive list of functions and some lines of code that call the functions. I would

Re: [R] Help with {tables} package

2014-01-02 Thread Duncan Murdoch
On 14-01-02 5:36 PM, Lars Bishop wrote: Dear list, I'm most likely doing something wrong, but I'm getting an error message in tab2 below (tab1 is fine). Any hint is much appreciated. This was a bug in tables, which I've tracked down. I'll soon upload an update to R-forge, later to CRAN.

Re: [R] Subsetting vector with preserved order

2014-01-02 Thread arun
Hi, Try ?match  b[match(d,a)] #[1] Joe  Bob  Dick A.K. I have three vectors as follows: a - c('A','B','C','D','E') b - c('Tom','Dick','Harry','Bob','Joe') d - c('E','D','B') Subsetting b by using d on a, with b[a %in% d], gives the names in the order they appear in b:  b[a %in% d]

Re: [R] Subsetting vector with preserved order

2014-01-02 Thread Hervé Pagès
Hi On 01/02/2014 04:04 PM, arun wrote: Hi, Try ?match b[match(d,a)] #[1] Joe Bob Dick Or use 'a' to put names on 'b': names(b) - a b A B C D E Tom Dick Harry Bob Joe Then subset by names: b[d] E D B Joe Bob Dick

Re: [R] Tracking what R actually executes

2014-01-02 Thread Ted Harding
On 02-Jan-2014 23:55:28 Duncan Murdoch wrote: On 14-01-02 6:05 PM, Fisher Dennis wrote: R 3.0.2 All platforms Colleagues This question is probably conceptual rather than technical and I have not thought out all of the issues yet. Let’s say I have an extensive list of functions and some

Re: [R] Any R-package geared towards Endorsement Frequencies?

2014-01-02 Thread Richard M. Heiberger
For the likert scale items, please look at the likert function in the HH package. install.package(HH) library(HH) ?likert demo(likert-paper) Rich On Thu, Jan 2, 2014 at 1:10 PM, Lila Lorne lilalillia...@gmail.com wrote: I am working with a dataset that is observations of mentors or senior

[R] A question in rms package

2014-01-02 Thread Agony
Dear all, Happy new year all of You and with best wishes coming to you in this new year. I have a problem in running a command in rms package. Does any can help me with my problem. I wanna use predab.resample command to compute bias-corrected estimates of a vector of indexes of Predictive

Re: [R] A question in rms package

2014-01-02 Thread David Winsemius
On Jan 2, 2014, at 11:03 AM, Agony wrote: Dear all, Happy new year all of You and with best wishes coming to you in this new year. I have a problem in running a command in rms package. Does any can help me with my problem. I wanna use predab.resample command to compute bias-corrected