Re: [R] Translating recoding syntax from SPSS to R

2013-09-21 Thread arun
Hi, Try: set.seed(429) dat1<- data.frame(race=sample(1:3,20,replace=TRUE),usborn=sample(0:2,20,replace=TRUE))  dat1$confused<- 1*((dat1$race==1|dat1$race==2) & dat1$usborn==0) head(dat1) #  race usborn confused #1    3  2    0 #2    1  0    1 #3    2  1    0 #4    3  2 

Re: [R] Obtaining data from a different row of data frame

2013-09-21 Thread arun
HI, A modified code to avoid the ?sapply() df1<- structure(list(Dates = structure(c(13151, 13152, 13153, 13154,  13157, 13158, 13159, 13160, 13161, 13164), class = "Date"), P1 = c(10,  13, 16, 19, 22, 25, 28, 31, 34, 37), P2 = c(100, 102, 104, 106,  108, 110, 112, 114, 116, 118), P3 = c(90, 94, 98

[R] Translating recoding syntax from SPSS to R

2013-09-21 Thread Mosi Ifatunji
Colleagues, I am in the process of learning R. I've been able to import my dataset (from Stata) and do some simple coding. I have now come to coding situation that requires some assistance. This is some code in SPSS that I would like to be able to execute in R: if (race eq 1 and usborn=0) conf

Re: [R] Filtering out data from list

2013-09-21 Thread arun
Hi, list1<-as.list(c("hi I am here!","my name is bob!", "I am mary!!", "bob likes mary!!"))  list2<- list1[grepl("bob",unlist(list1))]  list2 #[[1]] #[1] "my name is bob!" # #[[2]] #[1] "bob likes mary!!" A.K. Hm thanks :P but i was actually trying to say is like... if my list were more ran

[R] problem with showMethods()

2013-09-21 Thread Day, Roger S
This message could be useful for people fairly new to S4 classes. Therefore r-help and not r-devel. One use for showMethods(), important to me, is to find all methods that use a particular class in their signatures. This works: showMethods(class="Action", where="package:CTDesignExplorer")

[R] Re : Re: Re : Privacy rights of an old user of this list

2013-09-21 Thread John Gonzalez
As I said previously, I'm only concerned about what was published in the archive of stat.ethz.ch. I visited https://stat.ethz.ch/mailman/listinfo/r-help to find out where I had to send my request to remove those messages and I read: "R-help list run by maechler at stat.math.ethz.ch, bates at r-pr

[R] Setting a new method for generic function to satisfy "R CMD check"

2013-09-21 Thread Mikhail Beketov
Dear All, Can somebody explain me how to correctly set a new class-specific method for generic functions (e.g. for "plot", "summary" and "print"). I simply programmed these functions with the class names and it works perfectly. E.g.: x<-2 y<-3 class(x)<-"newclass" class(y)<-"newclass" print.newcl

[R] 答复: the values of predict( , type = "terms", )

2013-09-21 Thread 岳赟
Dear Greg Snow I mean in the help documentation of predict.glm, the arguments of “type” wrote that “The "terms" option returns a matrix giving the fitted values of each term in the model formula on the linear predictor scale.” But I can’t get the same result of the function if I compu

[R] Creating rectangular plots with x and y coordinates and treatments from a matrix for a randomized block design

2013-09-21 Thread Laz
Dear R users, I have a function I created to generate randomized block designs given below. Once I generate the design, I would like to plot it in a rectangular form to mimic the excel style where the blocks are represented with the treatment values placed exactly where their appropriate X

[R] Creating rectangular plots with x and y coordinates and treatments from a matrix for a randomized block design

2013-09-21 Thread Laz
Dear R users, I have a function I created to generate randomized block designs given below. Once I generate the design, I would like to plot it in a rectangular form to mimic the excel style where the blocks are represented with the treatment values placed exactly where their appropriate X an

Re: [R] Obtaining data from a different row of data frame

2013-09-21 Thread arun
Hi, May be you can try this: Change the df1<- structure(list(Dates = structure(c(13151, 13152, 13153, 13154,  13157, 13158, 13159, 13160, 13161, 13164), class = "Date"), P1 = c(10,  13, 16, 19, 22, 25, 28, 31, 34, 37), P2 = c(100, 102, 104, 106,  108, 110, 112, 114, 116, 118), P3 = c(90, 94, 98

Re: [R] Grouping variables by a irregular time interval

2013-09-21 Thread Raoni Rodrigues
Arun caught my attention that I committed a mistake with example data set. I send now the correct, with same text explain my problem. Sorry all of you for the confusion. I have a very large data frame (more than 5 million lines) as below (dput example at the end of mail): Station Antenna Tag

[R] Conditioning plots (wth coplot function) with logistic regression curves

2013-09-21 Thread Kiyoshi Sasaki
I have been trying to produce a conditional plot using coplot function (http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/coplot.html) for a binary response ("Presence" in my case) variable and one continuous variable ("Overstory") given a specific levels of the other continuous variabl

Re: [R] lattice: double y - problem changing axis color after doubleYScale

2013-09-21 Thread Duncan Mackay
Hi Anna I am not sure what you want but the following should get you part of the way I prefer to keep all my parameters within the function rather than use themes. useOuterStrips(strip = strip.custom(#factor.levels = , par.strip.text = list(fontfami

Re: [R] Obtaining data from a different row of data frame

2013-09-21 Thread arun
Hi Ira, #Speed comparison set.seed(29)  df2<- data.frame(Dates=seq(as.Date("2006-01-03"),length.out=2000,by="1 day"),cbind(matrix(sample(10:120,2000*300,replace=TRUE),ncol=300),matrix(sample(0:6,2000*300,replace=TRUE),ncol=300)))  colnames(df2)[2:301]<- paste0("P",1:300)  colnames(df2)[302:601

Re: [R] Read a Google Spreadsheet?

2013-09-21 Thread Spencer Graves
Hi, Josh and Ista: Thanks very much for the replies. I just downloaded and installed Java x64, and library(xlsx) worked with 64-bit R when it hadn't before. This gives me hope I can fix a problem with writeFindFn2xls{sos}. It works with 32-bit R, and complains that "odbcConn

Re: [R] Obtaining data from a different row of data frame

2013-09-21 Thread arun
Hi Ira, Some suggestions: 1. Not sure why you created a dataframe with NA's in the beginning.  It seemed to be not required here. df1 = data.frame(matrix(rep(NA, 10*7), nrow = 10)) 2. The below code: df1 = data.frame(Dates = Dates, P1 = P1, P2 = P2, OF1 = OF1, OF2 = OF2) can be simplifed as: df1

Re: [R] Re : Privacy rights of an old user of this list

2013-09-21 Thread Rainer M Krug
If you say something inn public, it will be there and people may remember it - you can't take back what you said. So why is a mailing list different? it is just that we are typing instead of talking - it goes into the public and there it stays. Ever heard of the Streisand effect https://en.wikip

Re: [R] Obtaining data from a different row of data frame

2013-09-21 Thread William Dunlap
Note that your inner loop > for(i in 1:10 ) { >rowNumber = i + df1[i,j-2] >df1[i,j] = df1[rowNumber, j-4] > } # end i loop is equivalent to the much quicker i <- 1:10 rowNumbers <- i + df1[i, j-2] df1[i, j] <- df1[rowNumbers, j-4] Bill Dunlap Spotfire, TIBCO Software wd

Re: [R] Display all element names neatly in a Venn Diagram

2013-09-21 Thread Rui Barradas
Hello, There's a package VennDiagram, I don't know if it is what you want, but it makes nice graphs. Hope this helps, Rui Barradas Em 21-09-2013 17:43, davideps escreveu: Hello, I want to create a Venn diagram that displays all the elements of the sets and overlap regions. The closest tool

Re: [R] Psedocode in R

2013-09-21 Thread Berend Hasselman
On 21-09-2013, at 18:31, "John S." wrote: > I have never written my own function, psedocode, in R. Can anyone show me > how to write a psedocode if I want to return, say, like mode or class...? > Thanks > What is psedocode? Furthermore: this is incomprehensible. > [[alternative HTML ver

[R] Psedocode in R

2013-09-21 Thread John S.
I have never written my own function, psedocode, in R. Can anyone show me how to write a psedocode if I want to return, say, like mode or class...? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.eth

[R] Display all element names neatly in a Venn Diagram

2013-09-21 Thread davideps
Hello, I want to create a Venn diagram that displays all the elements of the sets and overlap regions. The closest tool I've found for this is in Vennerable, described here: http://stackoverflow.com/questions/7029987/r-how-to-display-elements-instead-of-just-counts-within-each-circle-of-a-venn H

[R] Grouping variables by a irregular time interval

2013-09-21 Thread Raoni Rodrigues
Hello all, I have a very large data frame (more than 5 million lines) as below (dput example at the end of mail): Station Antenna TagDateTime Power Events 1 2 999 22/07/2013 11:00:2117 1 1 2 999 22/07/2013 11:33:4731 1 1 2 999 22/0

Re: [R] Filtering out data from list

2013-09-21 Thread arun
Hi,  list1<-lapply(c("",2:3),function(x) paste0("hi I am here!",x)) #or list1<-  as.list(paste0("hi I am here!",c("",2:3)))  str(list1) #List of 3 # $ : chr "hi I am here!" # $ : chr "hi I am here!2" # $ : chr "hi I am here!3" It is not a list within a list   list2<-list1[grepl("2",unlist(list

Re: [R] search species with all absence in a presence-absence matrix

2013-09-21 Thread arun
Hi Elaine, #You can either convert the .xls dataset to .csv and read it with ?read.csv() or use one of the packages to read excel dataset library(XLConnect) wb<- loadWorkbook("is_matrix.xls") dataRM<- readWorksheet(wb,sheet="is_matrix",rownames=1) dim(dataRM) #[1] 22 23  mat1<- as.matrix(dataRM)

Re: [R] binary symmetric matrix combination

2013-09-21 Thread arun
Hi Elio, Use ?write.table() write.table(res,"Eliores.txt",quote=FALSE) #and as read the file mat1<- as.matrix(read.table("Eliores.txt",header=TRUE)) #or even this should work mat1<-  as.matrix(read.table("Eliores.txt")) #If you have very big matrix, you may try: library(tseries) write(res,"Elior

[R] Obtaining data from a different row of data frame

2013-09-21 Thread Ira Sharenow
I have a large data frame with 2,000 rows and 600 columns. I can write loops to solve a smaller problem, but I need a better strategy for this data frame. Below is a simple example with just two stocks. In the data frame, each row represents a trading day. The first column is dates. The next g

Re: [R] time zones from longitude, latitude, and date

2013-09-21 Thread David Winsemius
On Sep 21, 2013, at 3:13 AM, Prof Brian Ripley wrote: On 21/09/2013 08:17, Gabor Grothendieck wrote: On Fri, Sep 20, 2013 at 4:31 PM, carlisle thacker wrote: I was looking for something like shown on the map: http://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png Inform

[R] Error in library() call

2013-09-21 Thread David Winsemius
On Sep 20, 2013, at 1:27 PM, supernovartis wrote: Hi Arun, I get the following error when I enter the command: library(reshape2) Error in library(reshape2) : there is no package called ‘reshape2’ Packages need to be installed before they are loaded. You are also requested not to highjack

Re: [R] Re : Privacy rights of an old user of this list

2013-09-21 Thread Uwe Ligges
The locations where the mailing list are archived are not even controlled by any member of R-core or the R foundation. Everybody, including John, could collect mails from the list and publish them. This is a well known property of a public mailing list. Uwe Ligges On 17.09.2013 13:29, Adan

Re: [R] cov and huge matrix

2013-09-21 Thread Uwe Ligges
On 17.09.2013 18:11, Hermann Norpois wrote: Hello, I tried to compute the covariance (between the columns) of a matrix with 20. This failed ... Error: cannot allocate vector of size 691.2 GB Ok, this is rather huge. But ... On the other hand ... Is there an alternative to cov? Maybe o

Re: [R] CRAN mirror for R in India: new one at WBUT, how do we get listed in the CRAN website?

2013-09-21 Thread Uwe Ligges
See http://cran.r-project.org/mirror-howto.html Uwe Ligges On 19.09.2013 14:04, abhinav kashyap wrote: [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read th

Re: [R] time zones from longitude, latitude, and date

2013-09-21 Thread Prof Brian Ripley
On 21/09/2013 08:17, Gabor Grothendieck wrote: On Fri, Sep 20, 2013 at 4:31 PM, carlisle thacker wrote: I was looking for something like shown on the map: http://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png Information about local daylight savings times would also help.

Re: [R] time zones from longitude, latitude, and date

2013-09-21 Thread Gabor Grothendieck
On Fri, Sep 20, 2013 at 4:31 PM, carlisle thacker wrote: > I was looking for something like shown on the map: > http://upload.wikimedia.org/wikipedia/commons/8/88/World_Time_Zones_Map.png > > Information about local daylight savings times would also help. > > The data are from ships, supposedly in