Re: [R] transpose? reshape? flipping? challenge with data frame

2010-04-23 Thread Patrick Hausmann
Ups, I mean library(reshape) not plyr, sorry # Example datasets # Input propsum <- data.frame(coverClass=c("C", "G", "L", "O", "S"), R209120812=c(NA, 0.49, 0.38, 0.04, 0.09), R209122212=c(0.05, 0.35, 0.41, 0.09, 0.10)) library(reshape) xpropsum <- melt

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread Dennis Murphy
Hi: How about this? Calling your matrix a, a[order(rowSums(a)), ] [,1] [,2] [,3] [1,]912 [2,]2 111 [3,]34 13 HTH, Dennis On Fri, Apr 23, 2010 at 1:10 PM, Jonathan wrote: > Hi r-help community, >This question isn't so much a syntax/coding one, but here

Re: [R] Adding new column variable to a existing spreadsheet

2010-04-23 Thread Carol Gao
Thank you Christopher, that is actually very helpful. =) Carol On Sat, Apr 24, 2010 at 12:13 PM, Christopher W Ryan wrote: > You should be aware that if you have read the data from your csv file > into an object in R, generally nothing you do with that object in R > will change your original csv

Re: [R] Adding new column variable to a existing spreadsheet

2010-04-23 Thread Christopher W Ryan
You should be aware that if you have read the data from your csv file into an object in R, generally nothing you do with that object in R will change your original csv file (this is generally a good thing), until/unless, you save or write something from R to that csv file (which is sometimes not a

[R] Adding new column variable to a existing spreadsheet

2010-04-23 Thread Carol Gao
Hi, I've got a csv format of file. There are seven columns of variables all together, and I've used the diff() function to take the differences between the variables in one column. Now I want to add the differences as the 8th column variable to the csv file. Is there any way that I can do this? T

Re: [R] Intersection for two curves

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 8:06 PM, Muhammad Rahiz wrote: Thanks David & Peter, The locator() works but not practical as I have to repeat the process many times. Does the code works on linear regression only? Should work for any process that can produce a function. When i tried to find the int

Re: [R] Linux System Function

2010-04-23 Thread Marc Schwartz
On Apr 23, 2010, at 6:07 PM, Ryan Garner wrote: > > How do I pass a filename as an argument to the system command to count the > number of records in that file? I only know how to do it by hardcoding it. > > HARDCODING EXAMPLE >> test <- matrix(1:20,ncol=5) >> write(x = test,file = "test.txt") >

[R] Linux System Function

2010-04-23 Thread Ryan Garner
How do I pass a filename as an argument to the system command to count the number of records in that file? I only know how to do it by hardcoding it. HARDCODING EXAMPLE > test <- matrix(1:20,ncol=5) > write(x = test,file = "test.txt") > records <- as.numeric(system("cat test.txt | wc -l",intern =

[R] bigmemory package woes

2010-04-23 Thread zerdna
I have pretty big data sizes, like matrices of .5 to 1.5GB so once i need to juggle several of them i am in need of disk cache. I am trying to use bigmemory package but getting problems that are hard to understand. I am getting seg faults and machine just hanging. I work by the way on Red Hat Linu

Re: [R] Check character string for value and assign corresponding value in a new variable

2010-04-23 Thread Hiro
That's perfect, thanks! -- View this message in context: http://r.789695.n4.nabble.com/Check-character-string-for-value-and-assign-corresponding-value-in-a-new-variable-tp2062391p2062818.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Event History Data Recoding

2010-04-23 Thread Corey Sparks
did you look at the survSplit() function in the survival library? you may have to recode your date variable to a zero point, i.e. Jan 1 1900 = 0, and measure your time like that. The survSplit function will split your survival duration into specified cut points. I hope this helps Corey - C

Re: [R] Intersection for two curves

2010-04-23 Thread Muhammad Rahiz
Thanks David & Peter, The locator() works but not practical as I have to repeat the process many times. Does the code works on linear regression only? When i tried to find the intersection at a non-linear curve, i get the following error Error in optimize(f = function(x) abs(xyf(ds) - n), c(

Re: [R] 2 simple question

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 6:24 PM, David Winsemius wrote: On Apr 23, 2010, at 6:09 PM, tamas barjak wrote: Thank you! But, I'm sorry, cannot be understood what I wrote...(I'm sorry, I use a machine translation program)... Well: I share out onto 4 parts the graphical area: >layout(matrix(1:4

Re: [R] 2 simple question

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 6:09 PM, tamas barjak wrote: Thank you! But, I'm sorry, cannot be understood what I wrote...(I'm sorry, I use a machine translation program)... Well: I share out onto 4 parts the graphical area: >layout(matrix(1:4,ncol=2, byrow=T)) I would like to choose onto which I

[R] After updating packages I got "Error in normalizePath(path) " for one of the packages

2010-04-23 Thread Tal Galili
Hi all, The error I got was this: Error in normalizePath(path) : path[1]="C:\Program Files\R\library/gdata": The system cannot find the file specified (after some other packages updated fine) For running: update.packages(checkBuilt=TRUE, ask=FALSE) My sessionInfo (): R version 2.11.0 (2010-

Re: [R] 2 simple question

2010-04-23 Thread tamas barjak
Thank you! But, I'm sorry, cannot be understood what I wrote...(I'm sorry, I use a machine translation program)... Well: I share out onto 4 parts the graphical area: >layout(matrix(1:4,ncol=2, byrow=T)) I would like to choose onto which I draw example: >plot(x, y, ...) <--- I would like 1 No

Re: [R] Event History Data Recoding

2010-04-23 Thread Don MacQueen
The reshape() function would be used to reorganize your event history data set so that the Discussion and Agreement dates are one above the other in the same column, presumably with another variable to flag which is which (although you don't seem to need that). Then, separately, you read your

Re: [R] transpose? reshape? flipping? challenge with data frame

2010-04-23 Thread Henrique Dallazuanna
Try this: xtabs(values ~ ind + cover, cbind(cover = propsum$coverClass, stack(propsum))) On Fri, Apr 23, 2010 at 1:43 AM, wrote: > Greetings all, > > I am having difficulty transposing, reshaping, flipping (not sure which) a > data frame which is read from a DBF file. I have tried using t(), r

Re: [R] 2 simple question

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 4:57 PM, tamas barjak wrote: Hi All! I have 2 plain questions: 1.) I know that very primitive question, but that to grant it, that the drawing on the screen divided up onto which part draw for example: layout(matrix(1:4,ncol=2, byrow=T)) plot(x, y, ...) <--- 1. scree

Re: [R] transpose? reshape? flipping? challenge with data frame

2010-04-23 Thread Carl Witthoft
While the OP turned out to want to transpose his data, for those who are reading and would like some (ugly) code to flip a tensor about an arbitrary axis, here goes: *_* Carl #my own cheap matrix flipflopper flip<-function(x,flipdim=1) { #axis is index, so 1 is rows, 2 is cols (for ma

Re: [R] basic table statistics

2010-04-23 Thread Dimitri Liakhovitski
There might be some package. But you can also do something like: results<-tapply(test$val,test$ty,function(x){ out1<-as.data.frame(length(x)) out2<-as.data.frame(mean(x)) out3<-as.data.frame(median(x)) out4<-as.data.frame(sd(x)) out<-cbind(out1,out2,out3,out

Re: [R] macro variable in R?

2010-04-23 Thread Peter Dalgaard
karena wrote: > I need to create 10 matrices. say matrix 1-10. > > matrix_1 is 1 by 1 > matrix_2 is 2 by 2 > matrix_3 is 3 by 3 >. >. >. > matrix_10 is 10 by 10 > > I am just wondering if there are some functions in R that are similar to the > macro variables in SAS. so I can create

[R] 2 simple question

2010-04-23 Thread tamas barjak
Hi All! I have 2 plain questions: 1.) I know that very primitive question, but that to grant it, that the drawing on the screen divided up onto which part draw for example: layout(matrix(1:4,ncol=2, byrow=T)) plot(x, y, ...) <--- 1. screen plot(y, z, ...) <--- 3. screen plot(z, x, ...) <---

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread Jonathan
Hi Dimitris, This code is very helpful, although I note that the columns are not preserved, ie if > M <- matrix(sample(13, 9, TRUE), 3, 3) produces: > M [,1] [,2] [,3] [1,] 1392 [2,] 101 12 [3,] 1167 then > n <- ncol(M) > ind <- apply(M, 2, which.max) > maxs

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread Jonathan
David, I'm not entirely sure at first glance (guess this is part of the problem!), but after a little searching around, it does look like this can be addressed using the "Hungarian algorithm," which reorders the rows of a (square) matrix to minimize the sum of the elements along the diagonal (the t

Re: [R] creating dummy with loop command‏

2010-04-23 Thread RICHARD M. HEIBERGER
Serdal, You still don't want explicit dummy variables. You have instead indicated that you need two factors, one for industryGroup, and one for industry nested within industryGroup. The model you suggested lnQ~lnC+lnM+lnL+lnE+eco_inno+inno+(sum)ind_3d will be easier to read and interpret as

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread Dimitris Rizopoulos
one way is: M <- matrix(sample(13, 9, TRUE), 3, 3) n <- ncol(M) ind <- apply(M, 2, which.max) maxs <- M[cbind(ind, 1:n)] diags <- diag(M) diag(M) <- M[cbind(ind, 1:n)] M[cbind(ind, 1:n)] <- diags M I hope it helps. Best, Dimitris On 4/23/2010 10:10 PM, Jonathan wrote: Hi r-help community,

Re: [R] Library (tm) Error: could not find function "TermDocMatrix".

2010-04-23 Thread Peter Ehlers
Package tm does not have a function TermDocMatrix. Where did you get the idea that it does? There _is_ a function TermDocumentMatrix, however. -Peter Ehlers On 2010-04-23 10:21, Ignacio mas data wrote: Hi List I have the next code and the error. I have try with other codes and I have the sa

Re: [R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread David Winsemius
Can you specify how you would re-order this matrix: matrix(1:16, 4,4) > apply(mtx, 2, which.max) [1] 4 4 4 4 -- David. On Apr 23, 2010, at 4:10 PM, Jonathan wrote: Hi r-help community, This question isn't so much a syntax/coding one, but here goes: Let's say I have matrix of arbitrary dim

Re: [R] Patch submission / request.

2010-04-23 Thread Allen S. Rout
a...@ufl.edu (Allen S. Rout) writes: > Greetings. > [ ... ] D'oh, that was supposed to be aimed at R-devel. - Allen S. Rout __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://w

[R] reordering of matrix rows to maximize the sum of the diagonal

2010-04-23 Thread Jonathan
Hi r-help community, This question isn't so much a syntax/coding one, but here goes: Let's say I have matrix of arbitrary dimensions and I'd like to reorder the rows in such a way that I could maximize the sum of the entries along the diagonal. For example, for this 3x3 matrix: [,1] [,

Re: [R] Adding error bars to xyplot()

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 3:56 PM, Jon Zadra wrote: I took a look at xYplot() but it is beyond over-complex, at least for my level, and the documentation isn't too clear. Is there a simple way to make functions like plotCI() and errbar() use the lattice reference rather than base graphics? Don

[R] Patch submission / request.

2010-04-23 Thread Allen S. Rout
Greetings. There's a coalescing group which is working to imitate Dirk's fine translation of CRAN to APT, in the Fedora/Red-Hat flavored land. One of the things we're trying to do is implement as much as is possible in R directly, and use as much of the existing package management infrastruct

Re: [R] Adding error bars to xyplot()

2010-04-23 Thread Jon Zadra
I took a look at xYplot() but it is beyond over-complex, at least for my level, and the documentation isn't too clear. Is there a simple way to make functions like plotCI() and errbar() use the lattice reference rather than base graphics? It seems like creating a plot of two lines across thre

[R] basic table statistics

2010-04-23 Thread Maxim
Hi, I have a very simple question, but I'm obviously not able to solve the problem on my own. I have a data.frame like sample(c("A","B","C"),size=20,replace = T)->type rnorm(20)->value data.frame(ty=type,val=value)->test There must be some built in functions, that will do some descriptive

Re: [R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 3:26 PM, Juliet Hannah wrote: I should have mentioned that I also tried: install.packages("Hmisc") Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Hmisc’ is not available If you have the necessary tools and install.packages("Hmisc",

Re: [R] creating dummy with loop command‏

2010-04-23 Thread serdal ozusaglam
Hi Dimitri, Thanks for help, i knew that way that you have suggested but in fact my case is a little bit complicated than this, therefore, i am writing a better explanation now, my model is trying to see the effect of eco-innovative industries on total output, thats why i am trying to e

Re: [R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread Juliet Hannah
I should have mentioned that I also tried: > install.packages("Hmisc") Warning message: In getDependencies(pkgs, dependencies, available, lib) : package ‘Hmisc’ is not available On Fri, Apr 23, 2010 at 3:15 PM, David Winsemius wrote: > > On Apr 23, 2010, at 3:09 PM, Juliet Hannah wrote: > >>

Re: [R] Check character string for value and assign corresponding value in a new variable

2010-04-23 Thread Jorge Ivan Velez
Hi Hiro, Here is a suggestion: y <- rep(c("ACAM2343", "ACAM3838", "ACPP2598", "ACPA8355", "DEAM234", "DEPA38485"), each = 10) y x <- y x[grepl("PA|PP", x)] <- "WIN" x[substr(y, 3, 4) == 'AM'] <- "LOSE" x Another way would be using regular expressions directly. See ?regex for more informati

Re: [R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 3:09 PM, Juliet Hannah wrote: I installed R 2.11.0, and I don't think I can load the doBy package now. Any suggestions? library("doBy") Loading required package: survival Loading required package: splines Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there i

[R] doBy and Hmisc on R version 2.11.0

2010-04-23 Thread Juliet Hannah
I installed R 2.11.0, and I don't think I can load the doBy package now. Any suggestions? > library("doBy") Loading required package: survival Loading required package: splines Error in loadNamespace(i[[1L]], c(lib.loc, .libPaths())) : there is no package called 'Hmisc' Error: package/namespace

Re: [R] uninstalling and installing on linux

2010-04-23 Thread Marc Schwartz
On Apr 23, 2010, at 11:51 AM, Uwe Ligges wrote: > > > On 23.04.2010 18:10, Juliet Hannah wrote: >> Hi List, >> >> I have a question about uninstalling and installing R on linux, which >> I am new to. >> >>> sessionInfo() >> R version 2.10.1 (2009-12-14) >> x86_64-unknown-linux-gnu >> >> local

Re: [R] how to put \ in a string?

2010-04-23 Thread Jorge Ivan Velez
Hi weix1, Try either "v:\\work\\gene" or "v:/work/gene". For more information see "Basic Regular Expressions" under ?regex as well as the Windows FAQ. HTH, Jorge On Fri, Apr 23, 2010 at 12:37 PM, weix1 <> wrote: > > I have string as follows:"v:\work\gene" > however, i can not write this as c

Re: [R] Matrix diagonal help

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 2:30 PM, Dimitri Liakhovitski wrote: Your question is unclear. Maybe not. > mtx <- matrix(1:16, 4) > nmtx <- matrix(0, 4,4) > nmtx[1:4,1] <- mtx[row(mtx)==col(mtx)] > nmtx[1:3,2] <- mtx[row(mtx)==col(mtx)-1] > nmtx[1:2,3] <- mtx[row(mtx)==col(mtx)-2] > nmtx[1:1,4] <-

Re: [R] Combinations with restrictions

2010-04-23 Thread Jorge Ivan Velez
Hi Cláudio, Try this: require(gtools) combinations(10, 2) combinations(10, 2, repeats = TRUE) HTH, Jorge 2010/4/23 Cláudio Sá <> > Hi! > > Is there any easy/fast way to combine vectors with restrictions? > > Example: > > a=c(1,2,3), b=c(4,5,6), c=c(7,8,9) > > I want all combinations of this

Re: [R] how to put \ in a string?

2010-04-23 Thread RICHARD M. HEIBERGER
Please see the FAQ on R for Windows2.16 where the distinction between the standard file separator "/" and the usual Windows file separator "\" is discussed. On Fri, Apr 23, 2010 at 12:37 PM, weix1 wrote: > > I have string as follows:"v:\work\gene" > however, i can not write this as character st

Re: [R] help

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 1:30 PM, anderson nuel wrote: Hello, Could you help me to find the function which gives a vector that indicate the element in a vector A that are not in a vector B. ?"%in%" ... and look at the examples Best Regards [[alternative HTML version deleted]] __

[R] dot dot dot and NextMethod

2010-04-23 Thread Regis Pouillot
Hello, Within the development of a package, I would need to build a specific method for the "pmin" function. I first make "pmin" generic pmin <- function (..., na.rm = FALSE) UseMethod("pmin") pmin.default <- base::pmin Now, within my new method, I would like to change the argumen

Re: [R] question on rpart

2010-04-23 Thread josh franta
attached is the data set which generates the rgui.exe cpu loop... here are commands : library(rpart) train<-read.csv("traindata.csv",header=T) y<-as.numeric(train[,18]) x<-train[,1:3] fit<-rpart(y~.,x) On Thu, Apr 22, 2010 at 9:25 AM, Terry Therneau wrote: > --- Begin included message > > I h

[R] Combinations with restrictions

2010-04-23 Thread Cláudio Sá
Hi! Is there any easy/fast way to combine vectors with restrictions? Example: a=c(1,2,3), b=c(4,5,6), c=c(7,8,9) I want all combinations of this 3 vectors with length=2. Like this: 1,4 1,5 1,6 1,7 1,8 1,9 2,4 2,5 2,6 2,7 ... and so on. Thanks in advance. [[alternative HTML version d

[R] how to put \ in a string?

2010-04-23 Thread weix1
I have string as follows:"v:\work\gene" however, i can not write this as character string in R what i did is: path<- as.character("v:\work\gene") but it seems that \ is eliminated: Warning messages: 1: '\w' is an unrecognized escape in a character string 2: '\g' is an unrecognized escape in a c

[R] Check character string for value and assign corresponding value in a new variable

2010-04-23 Thread Hiro
Hi all, Here is what I am trying to do. It doesn't seem like a complex command but I am a beginner at R. Lets say I have this variable: test$v1 = rep(c("ACAM2343", "ACAM3838", "ACPP2598", "ACPA8355", "DEAM234", "DEPA38485"), each = 10) 1. if test$v1 character string contains "PP" or "PA" set t

Re: [R] What is the test statistics in perm.test

2010-04-23 Thread Xiang Gao
Thanks for all your reply. I am a biologist and only start to use R recently. Yes, It is my fault. I assume that perm.test is a very popular method. Thanks for Dennis to point out that it is in exactRankTests package. I did not realize that there are so many R package. I guess I did not ask the ri

Re: [R] Event History Data Recoding

2010-04-23 Thread Thomas Jensen
Thanks Josh, But I am not sure if the reshape function can create new rows based on the meeting variable. For the second act there are three meetings, i.e. one meeting between discussion and agreement, and this should be entered as a separate row. Best, Thomas On Fri, 2010-04-23 at 07:45 -0700,

[R] help

2010-04-23 Thread anderson nuel
Hello, Could you help me to find the function which gives a vector that indicate the element in a vector A that are not in a vector B. Best Regards [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch

[R] Library (tm) Error: could not find function "TermDocMatrix".

2010-04-23 Thread Ignacio mas data
Hi List I have the next code and the error. I have try with other codes and I have the same problem. > reut21578 <- system.file("texts", "crude", package = "tm") > (r <- Corpus(DirSource(reut21578), readerControl = list(reader = > readReut21578XMLasPlain))) A corpus with 20 text documents > (r

Re: [R] Intersection for two curves

2010-04-23 Thread Peter Ehlers
On 2010-04-23 11:46, David Winsemius wrote: On Apr 23, 2010, at 1:06 PM, Muhammad Rahiz wrote: Does anyone know of a method that I can get the intersection where the red and blue curves meet i.e. the value on the x-axis? x <- 1:10 y <- 10:1 plot(x,y) abline(lm(y~x),col="blue") abline(h=2.5,co

Re: [R] Matrix diagonal help

2010-04-23 Thread Dimitri Liakhovitski
Your question is unclear. On Fri, Apr 23, 2010 at 5:45 AM, Usman Munir wrote: > Hi > > Suppose I have a matrix (cohort are rows and years are columns) > > > > [2000]  [2001]  [2002]  [2003] > > [C1]     0.01     0.03     0.02     0.09 > > [C2]     0.06     0.05     0.07     0.11 > > [C3]     0.1

Re: [R] how to rotate elements in a vector and points in a plane

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 1:54 PM, Ondřej Mikula wrote: Dear R-helpers, I need two simple functions, I guess they exist in R, but I am unable to find them. The first function should cyclically rotate elements in a vector. ("guyrot" in the package "wavethresh" should do it, but there's some problem w

Re: [R] creating dummy with loop command

2010-04-23 Thread Dimitri Liakhovitski
Serdal, I think what David is saying: just take those 2 variables you have and specify them as factors. Assuming your data frame is called "MyData": MyData$Ind_1<-as.factor(MyData$Ind_1) MyData$Ind_2<-as.factor(MyData$Ind_2) This way R will know they are not numeric variables but categorical vari

Re: [R] how to reorder of groups and specify ylim for each row in lattice barchart

2010-04-23 Thread Peter Ehlers
On 2010-04-23 10:53, zhenjiang xu wrote: Yes. I put the real ranges instead of '...'. But I tried the following code and it works. This is great! Thank you. Previously I thought you said ylim was put inside the scales(). I did say that and I was wrong. If you put it inside scales() as I suggest

Re: [R] How to stamp my graphs with date and time

2010-04-23 Thread Jun Shen
Hi, Deepayan, This is exactly what I want. However I couldn't find "page" argument or "default.args" when I look up the documentation. I just want to learn a bit more how to use these arguments. Thanks again. Jun On Fri, Apr 23, 2010 at 10:32 AM, Deepayan Sarkar wrote: > On Wed, Apr 21, 2010 a

[R] how to rotate elements in a vector and points in a plane

2010-04-23 Thread Ondřej Mikula
Dear R-helpers, I need two simple functions, I guess they exist in R, but I am unable to find them. The first function should cyclically rotate elements in a vector. ("guyrot" in the package "wavethresh" should do it, but there's some problem with its loading) The second function should rotate poi

Re: [R] Intersection for two curves

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 1:06 PM, Muhammad Rahiz wrote: Does anyone know of a method that I can get the intersection where the red and blue curves meet i.e. the value on the x-axis? x <- 1:10 y <- 10:1 plot(x,y) abline(lm(y~x),col="blue") abline(h=2.5,col="red") Two ways : > xy <- lm(y~x) > xy

Re: [R] uninstalling and installing on linux

2010-04-23 Thread Uwe Ligges
On 23.04.2010 19:02, Juliet Hannah wrote: This has not worked for me, meaning I can still use R, so instead I removed the directory rm -fR R-2.10.1 Is one method preferable to another. And what am I doing incorrectly with "make uninstall"? Don't know, probably not many are using it and it

Re: [R] Practical work with logistic regression

2010-04-23 Thread Claus O'Rourke
Thanks everyone for the replies, that sure cleared up some things for me. On Fri, Apr 23, 2010 at 9:11 AM, Jan van der Laan wrote: > When you just want to calculate the probability of belong to class A > or B of a new observation xi and do not have to do any new model > estimations or other analy

[R] Intersection for two curves

2010-04-23 Thread Muhammad Rahiz
Does anyone know of a method that I can get the intersection where the red and blue curves meet i.e. the value on the x-axis? x <- 1:10 y <- 10:1 plot(x,y) abline(lm(y~x),col="blue") abline(h=2.5,col="red") Muhammad __ R-help@r-project.org mailing li

Re: [R] uninstalling and installing on linux

2010-04-23 Thread Juliet Hannah
>> >> This has not worked for me, meaning I can still use R, so instead I >> removed the directory >> >> rm -fR R-2.10.1 >> >> Is one method preferable to another. And what am I doing incorrectly >> with "make uninstall"? > > Don't know, probably not many are using it and it may be fairly untested.

Re: [R] substract start from the end of the vector

2010-04-23 Thread Steve Lianoglou
On Fri, Apr 23, 2010 at 12:28 PM, arnaud Gaboury wrote: > TY Steve, using regular expression does the job nicely. I need now to fully > understand your code and learn more about what a regular expression is. Any > good ref is welcome. Skimming through the help pages for ?regex and a quick google

Re: [R] how to reorder of groups and specify ylim for each row in lattice barchart

2010-04-23 Thread zhenjiang xu
Yes. I put the real ranges instead of '...'. But I tried the following code and it works. This is great! Thank you. Previously I thought you said ylim was put inside the scales(). library(lattice) barchart(yield ~ variety | site,data=barley, groups = year, layout = c(1,6),auto.key = list(points =

[R] 2 simple question

2010-04-23 Thread tamas barjak
Hi All! I have 2 plain questions: 1.) I know that very primitive question, but that to grant it, that the drawing on the screen divided up onto which part draw for example: layout(matrix(1:4,ncol=2, byrow=T)) plot(x, y, ...) <--- 1. screen plot(y, z, ...) <--- 2. screen etc... 2.) How I c

Re: [R] uninstalling and installing on linux

2010-04-23 Thread Uwe Ligges
On 23.04.2010 18:10, Juliet Hannah wrote: Hi List, I have a question about uninstalling and installing R on linux, which I am new to. sessionInfo() R version 2.10.1 (2009-12-14) x86_64-unknown-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8

Re: [R] I am failing to run the (windows) example in: help(Startup)

2010-04-23 Thread Tal Galili
Thanks Uwe. Indeed - it now worked. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) ---

Re: [R] cancelling in fraction

2010-04-23 Thread David Winsemius
And even then I'm guessing the the set complement of {2,2,2, 3,5,11} with {2,2, 11} should not be {2, 3, 3} if R's versions of sets works the way I was taught in high school, anyway. > x <-set(2,2,2, 3,5,11) ; y <-set(2,2, 11) > x {2, 3, 5, 11} # because {2,2} == {2} in set theory

Re: [R] cancelling in fraction

2010-04-23 Thread capybara!
Thanks a lot! I had not heard about the fractions() function before, it is very useful!! Cheers! -- View this message in context: http://r.789695.n4.nabble.com/cancelling-in-fraction-tp2062218p2062475.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] substract start from the end of the vector

2010-04-23 Thread arnaud Gaboury
TY Steve, using regular expression does the job nicely. I need now to fully understand your code and learn more about what a regular expression is. Any good ref is welcome. > -Original Message- > From: Steve Lianoglou [mailto:mailinglist.honey...@gmail.com] > Sent: Friday, April 23, 2010

Re: [R] What is the test statistics in perm.test

2010-04-23 Thread Achim Zeileis
On Fri, 23 Apr 2010, Greg Snow wrote: The perm.test function in exactRankTests makes reference to the StatXact manual, so presumably that would have the exact details. The details section of the help file refers to converting real values to integers, so I expect that it is not doing what many

Re: [R] cancelling in fraction

2010-04-23 Thread Peter Ehlers
Greg has provided a solution. Just to answer the question of why set_complement() is not doing what you think it should: You need to change your *vectors* nom and denom to *sets* with as.set(). -Peter Ehlers On 2010-04-23 9:42, Greg Snow wrote: Here is a different approach that may work for y

Re: [R] substract start from the end of the vector

2010-04-23 Thread Steve Lianoglou
Hi, On Fri, Apr 23, 2010 at 11:57 AM, arnaud Gaboury wrote: > Dear group, > > Here is my df : > > df <- > > structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ", > > "PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRIMARY NICKEL USD 04/06/10 " > > ), CREATED.DATE = structure(c(18361, 18361,

[R] uninstalling and installing on linux

2010-04-23 Thread Juliet Hannah
Hi List, I have a question about uninstalling and installing R on linux, which I am new to. > sessionInfo() R version 2.10.1 (2009-12-14) x86_64-unknown-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C

Re: [R] What is the test statistics in perm.test

2010-04-23 Thread Greg Snow
The perm.test function in exactRankTests makes reference to the StatXact manual, so presumably that would have the exact details. The details section of the help file refers to converting real values to integers, so I expect that it is not doing what many of us think of as a permutation test, a

Re: [R] substract start from the end of the vector

2010-04-23 Thread jim holtman
Use regular expressions: > df$newDesc <- sub("(\\d+/\\d+/\\d +)", '', df$DESCRIPTION) > df DESCRIPTION CREATED.DATE QUANITY CLOSING.PRICEnewDesc 1 PRM HGH GD ALUMINIUM USD 09/07/102020-04-09 -1 2,415.90 PRM HGH GD ALUMINIUM USD 2 PRM HGH G

Re: [R] substract start from the end of the vector

2010-04-23 Thread Chuck Cleland
with(df, substr(DESCRIPTION, start=1, stop=nchar(DESCRIPTION) - 10)) ?nchar On 4/23/2010 11:57 AM, arnaud Gaboury wrote: > Dear group, > > > > Here is my df : > > > > df <- > > structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ", > > "PRM HGH GD ALUMINIUM USD 09/07/10 "

[R] substract start from the end of the vector

2010-04-23 Thread arnaud Gaboury
Dear group, Here is my df : df <- structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRIMARY NICKEL USD 04/06/10 " ), CREATED.DATE = structure(c(18361, 18361, 18325), class = "Date"), QUANITY = c(-1L, 1L, 1L), CLOSING.PRICE

Re: [R] glmer with non integer weights

2010-04-23 Thread Kay Cichini
hello, krebs (1995) states MH as prob., but yes it's rather a ratio of probs. at each site i had 4 blocks with 2 treatments (treat vs. control) - after treating i looked for similarity between each of those pairs. it is of interest if changes in similarity due to treatment differ between stages

Re: [R] How to stamp my graphs with date and time

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 11:32 AM, Deepayan Sarkar wrote: On Wed, Apr 21, 2010 at 4:02 PM, David Winsemius > wrote: snipped earlier code Furthermore when I try: mtext(date(), side=3, line=4, adj=0) I get a datetime stamp even though I am mixing graphic paradigms. This would seem to

Re: [R] how to reorder of groups and specify ylim for each row in lattice barchart

2010-04-23 Thread Peter Ehlers
Works for me. Did you replace the '' in mylist() with appropriate c(,) code? For example: mylist <- list(c(0,30), c(40,80), c(0,50), c(0,50), c(0,50), c(0,50)) -Peter Ehlers On 2010-04-23 9:22, zhenjiang xu wrote: Peter, thanks, but that doesn't work. Did I missed something

Re: [R] help in conditional histogram

2010-04-23 Thread Changbin Du
Dear Dr. Sarkar, When I try to run the codes, I found the following problem: > h<- sample(1:14, 319, rep=T) > c<- sample(1:14, 608, rep=T) > n<- sample(1:14, 1140, rep=T) > vt<-c(h, c, n) > ta<-rep(c("h", "c", "n"), c(319, 608, 1140)) > > to<-data.frame(vt,ta) > library(lattice) Attaching p

[R] a question related to table output

2010-04-23 Thread zhenjiang xu
Hi, I have a data.frame object: > a.df Methods Score 1 Northern 1.3544227 2 Northern 0.8302436 3 RT-PCR 1.0011360 4 RT-PCR 1.1149423 If I write it out with write.table, > write.table(a.df, file = 'data.txt', quote = FALSE, sep = '\t', row.names = FALSE) the data.txt is looks like: Me

Re: [R] cancelling in fraction

2010-04-23 Thread Greg Snow
Here is a different approach that may work for you, or give you a starting place: > library(MASS) > fractions(60/(220*6)) [1] 1/22 Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- >

Re: [R] How to insert gridlines in lattice density plot

2010-04-23 Thread Deepayan Sarkar
On Thu, Apr 22, 2010 at 3:16 PM, Giles wrote: > Thank you Burt Gunter and David Winsemius, > > I confirmed David's comment. > One must use type=c("p","g") > in order to get both the grid and points. > > So, to use densityplot well, > we must be quite aware of the options > for panel.xyplot! Actua

Re: [R] Event History Data Recoding

2010-04-23 Thread Joshua Wiley
I'm sorry, I do not think I understand exactly what your data is and what your end goal is. Are all your meeting dates together (i.e., they need to be split apart into separate cells)? On Fri, Apr 23, 2010 at 8:18 AM, Thomas Jensen wrote: > Thanks Josh, > > But I am not sure if the reshape func

Re: [R] creating dummy with loop command

2010-04-23 Thread David Winsemius
On Apr 23, 2010, at 11:26 AM, serdal ozusaglam wrote: Dear R users, I have a simple question (probably) but i couldnt how to find a solution for that. i am using 2 digit industry codes and 3 digit industry codes for my model, and i need to create dummies for the industries. The case is

Re: [R] the bar width of barchart plot in lattice package

2010-04-23 Thread zhenjiang xu
probably yes. I plotted each row individually instead. Thanks On Fri, Apr 23, 2010 at 11:14 AM, Deepayan Sarkar wrote: > On Wed, Apr 21, 2010 at 8:55 PM, David Winsemius > wrote: > > > > On Apr 21, 2010, at 9:51 PM, zhenjiang xu wrote: > > > >> I tried that. It seems the bar width is already ma

Re: [R] How to stamp my graphs with date and time

2010-04-23 Thread Deepayan Sarkar
On Wed, Apr 21, 2010 at 4:02 PM, David Winsemius wrote: > > On Apr 21, 2010, at 6:58 PM, David Winsemius wrote: > >> Sarkar offers a worked example of taking user input regarding location for >> locating a grid viewport outside the plot area. >> >> http://lmdvr.r-forge.r-project.org/figures/figure

[R] creating dummy with loop command

2010-04-23 Thread serdal ozusaglam
Dear R users, I have a simple question (probably) but i couldnt how to find a solution for that. i am using 2 digit industry codes and 3 digit industry codes for my model, and i need to create dummies for the industries. The case is simple for the 2-digit industries since there are not that m

Re: [R] how to reorder of groups and specify ylim for each row in lattice barchart

2010-04-23 Thread zhenjiang xu
Peter, thanks, but that doesn't work. Did I missed something? library(lattice) mylist <- list(c(0,30), c(40,80), ) barchart(yield ~ variety | site,data=barley, groups = year, layout = c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),ylab = "Barley Yield (bushels/acre)

Re: [R] the bar width of barchart plot in lattice package

2010-04-23 Thread Deepayan Sarkar
On Wed, Apr 21, 2010 at 8:55 PM, David Winsemius wrote: > > On Apr 21, 2010, at 9:51 PM, zhenjiang xu wrote: > >> I tried that. It seems the bar width is already maximized, although there >> is a lot of space between groups of bars. Thank you anyway. > > I apologize. It was reproducible code. I mi

Re: [R] lattice code to plot columns over another variable

2010-04-23 Thread Deepayan Sarkar
On Tue, Apr 20, 2010 at 9:03 AM, Rajarshi Guha wrote: > Hi, I've been struggling with a lattice visualiation. I have a > data.frame with 4 columns. What I'd like to have is a set of 3 panels. > Ecah panel will have the first column plotted against serial number > and then will superimpose the rele

Re: [R] R crashing oddly

2010-04-23 Thread Michael Steven Rooney
OK, now it sounds like the behavior is exactly the same for both of us. I think Gmail sometimes gobbles up newline characters, and that must have messed up the code I sent out before. Someone pointed out to me that a similar problem was identified before: https://stat.ethz.ch/pipermail/r-sig-mixe

  1   2   >