[R] Where did lost variables go

2013-12-31 Thread David Parkhurst
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 [[alternative HTML version deleted]]

Re: [R] Package dependencies in building R packages

2013-12-31 Thread Philippe Grosjean
On 30 Dec 2013, at 20:01, Axel Urbiz axel.ur...@gmail.com wrote: Thanks for your kind response Duncan. To be more specific, I'm using the function mvrnorm from MASS. The issue is that MASS depends on survival and I have a function in my package named tt() which conflicts with a function in

Re: [R] Where did lost variables go

2013-12-31 Thread Simon Zehnder
A reproducible example would do well here David Best Simon On 31 Dec 2013, at 02:42, 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

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Göran Broström
On 12/30/2013 11:04 PM, Jieyue Li wrote: Dear All, I want to have the cumulative incidence curves for 'mstate' data using Survival package in R. But I got some problems: I. Problem 1: 1. If I only use intercept without any covariates, I can have 'right' cumulative incidence curves (2 for 2

Re: [R] Where did lost variables go

2013-12-31 Thread Berwin A Turlach
G'day David, On Mon, 30 Dec 2013 20:42:53 -0500 David Parkhurst parkh...@indiana.edu wrote: Some wild guesses in the absence of a reproducible example. I have several variables in a data frame that aren't listed by ls() after I attach that data frame. ls() list the objects in the global

Re: [R] howto join matrices produced by rcorr()

2013-12-31 Thread Adams, Jean
Alex, Here's one way to do it, using for() loops. Jean library(Hmisc) # using Swiss Fertility and Socioeconomic Indicators (1888) Data m - data.matrix(swiss) output - rcorr(m) varnames - dimnames(m)[[2]] nvar - length(varnames) # for loops through all possible pairs for(i in 1:(nvar-1)) {

Re: [R] aes and parameter evaluation problems

2013-12-31 Thread Geoffrey
Thanks A.K. and Jeff, both answers helped me. (and of course gave me more homework!) On 31/12/13 16:04, Jeff Newmiller wrote: A.K. answered your question 1, but since you did say as question 2 that you wanted it done right... library(reshape2) ex3 - function() { d -

Re: [R] Package dependencies in building R packages

2013-12-31 Thread Hadley Wickham
Thanks for your kind response Duncan. To be more specific, I'm using the function mvrnorm from MASS. The issue is that MASS depends on survival and I have a function in my package named tt() which conflicts with a function in survival of the same name. I can think of 2 alternatives solutions

[R] format a matrix as fractions?

2013-12-31 Thread Michael Friendly
Is there some way to format a matrix of fractions as fractions? I think I've seen this somewhere, but search on Rseek came up empty. Example: outer(1/seq(1:3), 1/seq(1:3)) [,1] [,2] [,3] [1,] 1.000 0.500 0.333 [2,] 0.500 0.250 0.167 [3,] 0.333

Re: [R] format a matrix as fractions?

2013-12-31 Thread arun
library(MASS)  fractions(outer(1/seq(1:3), 1/seq(1:3))) # [,1] [,2] [,3] #[1,]   1  1/2  1/3 #[2,] 1/2  1/4  1/6 #[3,] 1/3  1/6  1/9 A.K. On Tuesday, December 31, 2013 10:27 AM, Michael Friendly frien...@yorku.ca wrote: Is there some way to format a matrix of fractions as fractions?  I

Re: [R] format a matrix as fractions?

2013-12-31 Thread Bert Gunter
I find that google is usually a better search engine for R topics Google on R fractions. (I got, e.g. http://stackoverflow.com/questions/5046026/print-number-as-reduced-fraction-in-r ) -- Cheers, Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information.

Re: [R] Where did lost variables go

2013-12-31 Thread Bert Gunter
Gents: I would add that: 1) attach() should probably no longer be used in R, for all the reasons (and more) cited, 2) The preferred alternative these days is to use lists, including data frames, as containers and make liberal use of the ?with and ?within functions. Environments can also be

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

2013-12-31 Thread David Parkhurst
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 All8Sites A B C i n D F X Error: object 'X' not found attach(All8Sites) ls() [1] All8 All8Sites A B C i n D

[R] Problem with http://www.r-project.org/mail.html#instructions

2013-12-31 Thread David Parkhurst
This web page includes this information about turning off HTML in messages: http://www.r-project.org/mail.html#instructions General Instructions Note that you should configure your e-mail software in such a way as to send /only plain text/, i.e., *no HTML*. 'html-ified' messages are

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

2013-12-31 Thread Duncan Murdoch
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 All8Sites A B C i n D F X Error: object 'X' not found

Re: [R] Package dependencies in building R packages

2013-12-31 Thread Paul Gilbert
The responses to this seem to be assuming that you want users to have access to your tt() function, that is, you export it. Just in case the really simple case has been overlooked: if you are only using this function internally in your package there should be no problem. Your package's

[R] Request for help regarding RWeka

2013-12-31 Thread Takatsugu Kobayashi
Hi Rusers, I am having a hard time understanding/finding a solution to this error message of RWeka. I just want to use Xmeans clustering command but when I typed XMeans then I get the following message: Error value[[3L]](cond) : Required Weka package 'XMeans' is not installed. So I tried to

Re: [R] Problem with http://www.r-project.org/mail.html#instructions

2013-12-31 Thread Uwe Ligges
Thanks for the report, if this is not a temporary problem, we will provide an alternative link. Some search engine suggests that it is mirrored here: http://linuxgazette.net/no-mime Best, Uwe Ligges On 31.12.2013 16:11, David Parkhurst wrote: This web page includes this information about

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

2013-12-31 Thread Duncan Murdoch
On 13-12-31 11:38 AM, David Parkhurst wrote: Thank you. I've tried what you're suggesting, at an earlier suggestion from another respondent, and I don't find my variable in any of lists ls() through ls(7). Are you sure that X is really the name of a column in the dataframe? names(All8Sites)

[R] How to ask a function to continuously print intermediate results

2013-12-31 Thread Jun Shen
Dear all, I have a print command to export some intermediate results from a user-defined function. It takes a while to run the function and I found I have to press a key to see the printed results on the screen. How can I ask the function to continuously print results on the screen without

Re: [R] How to ask a function to continuously print intermediate results

2013-12-31 Thread Duncan Murdoch
On 13-12-31 2:02 PM, Jun Shen wrote: Dear all, I have a print command to export some intermediate results from a user-defined function. It takes a while to run the function and I found I have to press a key to see the printed results on the screen. How can I ask the function to continuously

[R] Working with Date

2013-12-31 Thread Christofer Bogaso
Hi again, Happy new year 2014 to every R gurus and users. I am struggling with some calculation with dates... Let say I have following vector of months: Months - c(Jan, Dec, Mar) Now I need to assign year with them. This assignment will be based on some given date. Let say my given date is :

Re: [R] How to ask a function to continuously print intermediate results

2013-12-31 Thread Uwe Ligges
On 31.12.2013 20:10, Duncan Murdoch wrote: On 13-12-31 2:02 PM, Jun Shen wrote: Dear all, I have a print command to export some intermediate results from a user-defined function. It takes a while to run the function and I found I have to press a key to see the printed results on the screen.

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Terry Therneau
Question 1: How to get just 2 cumulative incidence curves when there are multiple covariates. I don't understand what you want. Assume that we have liver transplant and death while waiting for a transplant as my two events. There are overall curves (2), or one can create curves separately

Re: [R] Working with Date

2013-12-31 Thread Ista Zahn
Use, format() to extract a character string representation of the year, then paste() it together with Months. Like this: paste(Months, format(Given_Date, format = %Y), sep = -) See ?strftime for details. Best, Ista On Tue, Dec 31, 2013 at 4:53 PM, Christofer Bogaso bogaso.christo...@gmail.com

Re: [R] Working with Date

2013-12-31 Thread Jim Lemon
On 01/01/2014 08:53 AM, Christofer Bogaso wrote: Hi again, Happy new year 2014 to every R gurus and users. I am struggling with some calculation with dates... Let say I have following vector of months: Months- c(Jan, Dec, Mar) Now I need to assign year with them. This assignment will be

Re: [R] Working with Date

2013-12-31 Thread arun
Hi, May be this helps: fun1 - function(months, Given_date){  g1 - format(Given_date, %b)  indx1 - match(months,month.abb)  indx2 - match(g1, month.abb)  yr - as.numeric(format(Given_date,%Y)) if(any(indx1 indx2)){  ifelse(indx1 indx2, paste(months, yr,sep=-), paste(months, yr+1,sep=-)) } else{

Re: [R] Working with Date

2013-12-31 Thread arun
Hi, Sorry, a correction: fun1 - function(months, Given_date){  g1 - format(Given_date, %b)  indx1 - match(months,month.abb)  indx2 - match(g1, month.abb)  yr - as.numeric(format(Given_date,%Y)) if(any(indx1 indx2)){  ifelse(indx1 indx2, paste(months, yr+1,sep=-), paste(months, yr,sep=-)) }

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Göran Broström
On 12/31/2013 09:05 PM, Jieyue Li wrote: Thanks a lot for the reply! On Tue, Dec 31, 2013 at 1:59 AM, Göran Broström goran.brost...@umu.se mailto:goran.brost...@umu.se wrote: On 12/30/2013 11:04 PM, Jieyue Li wrote: Dear All, I want to have the cumulative incidence

Re: [R] seq_len and loops

2013-12-31 Thread Göran Broström
Thanks for the answers from Duncan, Bill, Gabor, and Henrik. You convinced me that 1. The solution if (x 1){ for (x in 2:x){ ... is the easiest, most effective, and most easy-to-understand. 2. However, Bill (and Henrik) raised the question of replacing '1' with '1L'; I

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

2013-12-31 Thread David Parkhurst
Thank you. I've tried what you're suggesting, at an earlier suggestion from another respondent, and I don't find my variable in any of lists ls() through ls(7). I'm just going back to using R after being away from statistics for several years. I'm thinking I might uninstall R, then reinstall

Re: [R] cumulative incidence for mstate in Survival package in R

2013-12-31 Thread Jieyue Li
Thanks a lot for the reply! On Tue, Dec 31, 2013 at 1:59 AM, Göran Broström goran.brost...@umu.sewrote: On 12/30/2013 11:04 PM, Jieyue Li wrote: Dear All, I want to have the cumulative incidence curves for 'mstate' data using Survival package in R. But I got some problems: I. Problem 1:

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

2013-12-31 Thread David Parkhurst
I've just uninstalled and then reinstalled R on my windows 7 machine. To test my understanding of data frames, I'm trying the following code. (I plan to do other things with it, if it would only work.) Here's the code, which seems pretty basic to me: ls() nums ← c(1,2,3,4,5) ltrs ←

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

2013-12-31 Thread Gabor Grothendieck
On Tue, Dec 31, 2013 at 6:53 PM, David Parkhurst parkh...@imap.iu.edu wrote: I've just uninstalled and then reinstalled R on my windows 7 machine. To test my understanding of data frames, I'm trying the following code. (I plan to do other things with it, if it would only work.) Here's the

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

2013-12-31 Thread Sarah Goslee
Hi David, Your code is showing up here with an arrow symbols. If it's an actual cut and paste, that's your problem: assignment in R is the two-character - and not an arrow symbol. Otherwise your code looks fine. Sarah On Tuesday, December 31, 2013, David Parkhurst wrote: I've just

[R] Fortune?

2013-12-31 Thread John Sorkin
Fortune? Where did lost variables go, with example Sent from my iPhone On Dec 31, 2013, at 7:36 PM, David Parkhurst parkh...@imap.iu.edu parkh...@imap.iu.edu wrote: Thank you. I've tried what you're suggesting, at an earlier suggestion from another respondent, and I don't find my

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

2013-12-31 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Sarah Goslee Sent: Tuesday, December 31, 2013 4:55 PM To: David Parkhurst Cc: r-help@r-project.org Subject: Re: [R] Basic misunderstanding, or problem with my installation?