Re: [R] Rpart plot produces no text

2016-06-29 Thread John Kane
What happens if you run the code in a terminal rather than RStudio? My 
experience is that very, very occasionally RStudio does something a bit funny 
with plots.  

And while this may sound funny just shut down RStudio, reload it and try again. 

John Kane
Kingston ON Canada


> -Original Message-
> From: jcthomp...@redlobster.com
> Sent: Tue, 28 Jun 2016 20:26:59 +
> To: r-help@r-project.org
> Subject: [R] Rpart plot produces no text
> 
> I am using R Studio and am able to fit a tree with RPlot, however, the
> tree in the viewer has no text (see image attached).
> 
> Jim Thompson
> This e-mail message is for the sole use of the intende...{{dropped:21}}

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Difficulty subsetting data frames using logical operators

2016-07-02 Thread John Kane
Just as a very minor point "read.csv" returns a data.frame. Therefore the 
data.frame in "data <- data.frame(read.csv("hw1_data.csv"))" is redundant and 
just adds clutter to the code.

John Kane
Kingston ON Canada


> -Original Message-
> From: g...@st-andrews.ac.uk
> Sent: Fri, 1 Jul 2016 02:11:48 -0700
> To: r-help@r-project.org
> Subject: [R] Difficulty subsetting data frames using logical operators
> 
> So, I uploaded a data set via my directory using the command data <-
> data.frame(read.csv("hw1_data.csv")) and then tried to subset that data
> using logical operators. Specifically, I was trying to make it so that I
> got all the rows in which the values for "Ozone" (a column in the data
> set)
> were greater than 31 (I was trying to get the mean of all said values).
> Then, I tried using the command data[ , "Ozone">31]. Additionally, I had
> trouble getting it so that I had all the rows where all the values in
> "Ozone">31 & "Temp">90 simultaneously. There were some NA values in both
> of
> those columns, so that might be it. If someone could help me to figure
> out
> how to remove those values, that'd be great as well. I'm using a Mac (OS
> X)
> with the latest version of R (3.1.2. I think??).
> 
> Here is some of the code I used:
> 
> >data <- data.frame(read.csv("hw1_data.csv"))
>> data
> Ozone Solar.R Wind Temp Month Day
> 1  41 190  7.4   67 5   1
> 2  36 118  8.0   72 5   2
> 3  12 149 12.6   74 5   3
> 4  18 313 11.5   62 5   4
> 5  NA  NA 14.3   56 5   5
> 6  28  NA 14.9   66 5   6
> 7  23 299  8.6   65 5   7
> 8  19  99 13.8   59 5   8
> 9   8  19 20.1   61 5   9
> 10 NA 194  8.6   69 5  10
> 11  7  NA  6.9   74 5  11
> 12 16 256  9.7   69 5  12
> 13 11 290  9.2   66 5  13
> 14 14 274 10.9   68 5  14
> 15 18  65 13.2   58 5  15
> 16 14 334 11.5   64 5  16
> 17 34 307 12.0   66 5  17
> 18  6  78 18.4   57 5  18
> 19 30 322 11.5   68 5  19
> 20 11  44  9.7   62 5  20
> 21  1   8  9.7   59 5  21
> 22 11 320 16.6   73 5  22
> 23  4  25  9.7   61 5  23
> 24 32  92 12.0   61 5  24
> 25 NA  66 16.6   57 5  25
> 26 NA 266 14.9   58 5  26
> 27 NA  NA  8.0   57 5  27
> 28 23  13 12.0   67 5  28
> 29 45 252 14.9   81 5  29
> 30115 223  5.7   79 5  30
> 31 37 279  7.4   76 5  31
> 32 NA 286  8.6   78 6   1
> 33 NA 287  9.7   74 6   2
> 34 NA 242 16.1   67 6   3
> 35 NA 186  9.2   84 6   4
> 36 NA 220  8.6   85 6   5
> 37 NA 264 14.3   79 6   6
> 38 29 127  9.7   82 6   7
> 39 NA 273  6.9   87 6   8
> 40 71 291 13.8   90 6   9
> 41 39 323 11.5   87 6  10
> 42 NA 259 10.9   93 6  11
> 43 NA 250  9.2   92 6  12
> 44 23 148  8.0   82 6  13
> 45 NA 332 13.8   80 6  14
> 46 NA 322 11.5   79 6  15
> 47 21 191 14.9   77 6  16
> 48 37 284 20.7   72 6  17
> 49 20  37  9.2   65 6  18
> 50 12 120 11.5   73 6  19
> 51 13 137 10.3   76 6  20
> 52 NA 150  6.3   77 6  21
> 53 NA  59  1.7   76 6  22
> 54 NA  91  4.6   76 6  23
> 55 NA 250  6.3   76 6  24
> 56 NA 135  8.0   75 6  25
> 57 NA 127  8.0   78 6  26
> 58 NA  47 10.3   73 6  27
> 59 NA  98 11.5   80 6  28
> 60 NA  31 14.9   77 6  29
> 61 NA 138  8.0   83 6  30
> 62135 269  4.1   84 7   1
> 63 49 248  9.2   85 7   2
> 64 32 236  9.2   81 7   3
> 65 NA 101 10.9   84 7   4
> 66 64 175  4.6   83 7   5
> 67 40 314 10.9   83 7   6
> 68 77 276  5.1   88 7   7
> 69 97 267  6.3   92 7   8
> 70 97 272  5.7   92 7   9
> 71 85 175  7.4   89 7  10
> 72 NA 139  8.6   82 7  11
> 73 10 264 14.3   73 7  12
> 74 27 175 14.9   81 7  13
> 75 NA 291 14.9   91 7  14
> 76  7  48 14.3   80 7  15
> 77 48 260  6.9   81 7  16
> 78 35 274 10.3   82 7  17
> 79 61 285  6.3   84 7  18
> 80 79 187 

Re: [R] R - Populate Another Variable Based on Multiple Conditions | For a Large Dataset

2016-07-03 Thread John Kane
The data set did not show up. The R-help list tends to strip out most file 
types as a safety precaution.  Try renaming the file from xxx.csv to xxx.txt 
and it should come through alright.



John Kane
Kingston ON Canada


> -Original Message-
> From: kwa...@kemri-wellcome.org
> Sent: Sun, 3 Jul 2016 09:39:59 +
> To: jdnew...@dcn.davis.ca.us, r-help@r-project.org
> Subject: Re: [R] R - Populate Another Variable Based on Multiple
> Conditions | For a Large Dataset
> 
> Hi Jeff, pardon me, I was surely not making it easy. I hope this time I
> will ☺
> 
> Attached is snippet of the dataset in csv format and below is the
> R.script I have managed so far.
> 
> ---
> ---
> 
> drug_study <- read.csv("drug_study.csv", header = T); head(drug_study)
> drug_study$date <- as.Date(drug_study$date, "%m/%d/%Y")
> drug_study$study_id <- ""  #create new column
> 
> individual <- unique (drug_study$ID)  #vector of individuals
> datalength <- dim(drug_study)[1]  #number of rows in dataframe
> 
> for (i in 1:length(individual)) {
>   for (j in 1:datalength) {
> start_admin <- drug_study[c(drug_study$ID == individual[i] &
> drug_study$year == 2007 & drug_study$drug_admin == "Y" & drug_study$month
> == 5),2]  #capture date of start
> end_admin <- drug_study[(drug_study$ID == individual[i] &
> drug_study$year == 2008 & drug_study$drug_admin == "Y" & drug_study$month
> == 2),2]#capture date of end
> 
> if(drug_study[j,1] == individual[i] & drug_study[j,2] >= start_admin
> & drug_study[j,2] < end_admin) {
>   drug_study[j,6] <- paste(start_admin) #populate respective row if
> condition is met
> }
>   }
> }
> ~
> ~
> 
> For this dataset, there exists three individuals, J1/3, R1/3, R10/1.
> 
> The script works for the last two individuals but not J1/3 with the error
> below:
> 
> ~
> ~
> Error in if (drug_study[j, 1] == individual[i] & drug_study[j, 2] >=
> start_admin &  :
>   argument is of length zero
> ~
> ~
> 
> I figured it’s because this individuals start_admin and end_admin dates
> aren’t captured because the if-loop fails. There’s my first problem,
> there are thousands of individuals with varying
> start_admin and end_admin dates and I need a script to capture these for
> every individual.
> 
> Secondly, the above script is taking almost an hour to run for the entire
> dataset, just for the individuals whose start_admin and end_admin dates
> can be captured by the if-loop.
> 
> I need help in coming up with a script that will tackle the problem
> taking into account the different start_admin and end_admin dates and be
> resourceful with regards to time.
> 
> Regards
> ---
> Kevin Kariuki
> 
> ###
> ###
> 
> On 7/3/16, 8:42 AM, "Jeff Newmiller"  wrote:
> 
> You are making this hard on yourself by not paying attention the Posting
> Guide listed in the footer of every email on this list. You would
> probably also find [1] helpful also.
> 
> [1]
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> --
> Sent from my phone. Please excuse my brevity.
> 
> On July 2, 2016 3:41:07 PM PDT, Kevin Wamae 
> wrote:
> >Hi Jeff, sorry for referring to you as Jennifer earlier, accept my
> >apologies.
>> 
> >I attached a sample dataset in the question, am afraid it must have
> >failed to attach.
>> 
> >I have attached it again..
>> 
>> 
> >Regards
> >

Re: [R] Geom_smooth

2016-07-20 Thread John Kane
The question could use a bit more information but have a look at 
http://docs.ggplot2.org/0.9.3.1/stat_smooth.html#.  This may explain it. 

You might also want to have a look at 
http://adv-r.had.co.nz/Reproducibility.html for some guidelines on asking 
questions in Rhelp or StackOverflow, etc.

John Kane
Kingston ON Canada


> -Original Message-
> From: tgs...@gmail.com
> Sent: Wed, 20 Jul 2016 10:01:44 -0700
> To: r-help@r-project.org
> Subject: [R] Geom_smooth
> 
> Default level = 0.95.
> Does this mean +/- 0.025 from estimate?
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Receive Notifications of Incoming Messages
Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Turn character /string as variable/column name in summarize in dplyr

2016-07-22 Thread John Kane
It really might help to have a minimum working example
Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and/or 
http://adv-r.had.co.nz/Reproducibility.html

John Kane
Kingston ON Canada


> -Original Message-
> From: chenme...@hotmail.com
> Sent: Fri, 22 Jul 2016 14:08:45 +
> To: r-help@r-project.org
> Subject: [R] Turn character /string as variable/column name in summarize
> in dplyr
> 
> Hi all,
> 
> 
> Trying to turn string in to variable in dplyr , it R interprets it as
> strings rather than column name in the data.
> 
> Any ideas?
> 
> 
> shock5 =paste0(shocksName[5],"fit")
>   print(shock5)
> 
>   x<-group_by(plotdata,grp) %>% summarize(
> Actuals=sum(weight*response/sum(weight)),
> ...
> ...
> #
> assign(shocksName[4],sum(weight*as.name(paste(shocksName[4],"fit"))/sum(weight))),
>  assign(shocksName[5],sum(weight*(as.environment(shock5))
> /sum(weight)))
>   )
> 
> 
> Sent from Outlook<http://aka.ms/weboutlook>
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] SAS file

2016-08-07 Thread John Kane
As Jim says the file did not arrive. R-help is very fussy about what kind of 
files it accepts. If you are still having a problem it would be a good idea to 
upload it to file-sharing place such as Dropbox or Mediafire and just post the 
link here.

John Kane
Kingston ON Canada


> -Original Message-
> From: r-help@r-project.org
> Sent: Fri, 5 Aug 2016 10:10:13 + (UTC)
> To: r-help@r-project.org
> Subject: [R] SAS file
> 
> Hello,I have a SAS formatted file as attached, when I use lookup.xport i
> got error below> lookup.xport("patient.ssd01")Error in
> lookup.xport.inner(file) :   unable to open file: 'No such file or
> directory'
> 
> can anyone please help me to figure it out?
> thanksc
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread John Kane
Try 
d <- as.difftime("6-08:18:33","%d-%H:%M:%S")

John Kane
Kingston ON Canada


> -Original Message-
> From: loris.benn...@fu-berlin.de
> Sent: Mon, 8 Aug 2016 11:37:33 +0200
> To: r-h...@stat.math.ethz.ch
> Subject: [R] No "number of days" format for 'difftime'?
> 
> Hi,
> 
> When I try
> 
>   d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S")
> 
> I get:
> 
>   Error: unexpected SPECIAL in "as.difftime("6-08:18:33",format=%d-%"
> 
> Am I correct in thinking that it is not possible to do something like
> this, because there is no character string for the format which
> corresponds to "number of days"?
> 
> I could misuse "%j" for "day of the year as a decimal number", but
> ultimately the "difftime" object is still a data, rather than a length
> of time and I should be looking at a package like 'lubridate' instead.
> Is that the case?
> 
> Cheers,
> 
> Loris
> 
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread John Kane
http://www.dummies.com/how-to/content/how-to-read-errors and-warnings-in-r.html
If something goes wrong with your code, R tells you. We have to admit it: These 
error messages can range from mildly confusing to completely incomprehensible 
if you’re not used to them.


fortune(350) regarding the on-line help is also inspiring

You need to get the hang of reading the online help. The information required 
is actually therein ?dotchart --- it's just tersely and obscurely expressed. A 
certain degree of optimism is required. You need to ***believe*** that the 
information is there; then ask yourself "What could they possibly mean by what 
they have written that would tell me what I need to know?".
   -- Rolf Turner (on reading the help pages)
  R-help (June 2013)


John Kane
Kingston ON Canada


> -Original Message-
> From: loris.benn...@fu-berlin.de
> Sent: Mon, 8 Aug 2016 12:07:43 +0200
> To: r-h...@stat.math.ethz.ch
> Subject: Re: [R] No "number of days" format for 'difftime'?
> 
> Hi,
> 
> I was probably misled by the, to my mind, esoteric error message into
> thinking the error was more subtle.  Something like "unmatched quotes"
> might have helped me recognise that I was just being dopey.
> 
> Thanks to John and Rui.
> 
> Loris
> 
>  writes:
> 
>> Hello,
>> 
>> You're missing a double quotes. Right after format=
>> 
>> Hope this helps,
>> 
>> Rui Barradas
>> 
>> 
>> Citando Loris Bennett :
>> 
>>> Hi,
>>> 
>>> When I try
>>> 
>>> d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S")
>>> 
>>> I get:
>>> 
>>> Error: unexpected SPECIAL in "as.difftime("6-08:18:33",format=%d-%"
>>> 
>>> Am I correct in thinking that it is not possible to do something like
>>> this, because there is no character string for the format which
>>> corresponds to "number of days"?
>>> 
>>> I could misuse "%j" for "day of the year as a decimal number", but
>>> ultimately the "difftime" object is still a data, rather than a length
>>> of time and I should be looking at a package like 'lubridate' instead.
>>> Is that the case?
>>> 
>>> Cheers,
>>> 
>>> Loris
>>> 
>>> --
>>> Dr. Loris Bennett (Mr.)
>>> ZEDAT, Freie Universität Berlin         Email
>>> loris.benn...@fu-berlin.de
>>> 
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.htmland provide commented,
>>> minimal, self-contained, reproducible code.
>> 
>> 
>> 
>>  [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> --
> Dr. Loris Bennett (Mr.)
> ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Unexpected behavior with cbind.ts

2016-08-10 Thread John Kane
It would help if you showed us the code you have been using so far plus some 
sample data (use dput() to produce it) can really help.

See 
ttp://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

http://adv-r.had.co.nz/Reproducibility.html


John Kane
Kingston ON Canada


> -Original Message-
> From: apoema@gmail.com
> Sent: Wed, 10 Aug 2016 14:54:38 -0300
> To: r-help@r-project.org
> Subject: [R] Unexpected behavior with cbind.ts
> 
> I got two ts variables (w and y) that I want to cbind into a mts matrix
> variable.
> 
> w is a simple ts object with some random data, length=40, start = 2005,
> end
> = 2014.75, frequency = 4, class = "ts".
> 
> y is a collection of 2 ts, nrow = 40, ncol=2, start = 2005, end =
> 2014.75,
> frequency = 4, class = "mts", "ts", "matrix"
> 
> I was expecting that the result of cbind(w,y) to be a mts matrix with 3
> columns, 40 rows, same start and frequency as the originals, and finally
> to
> be of class "mts", "ts", "matrix.
> 
> What I get is a single ts variable with length = 120, start = 2005 but
> end
> = 2034,75, frequency = 4, class = "ts". This behavior is what i would
> expect from ts.union, but not from cbind.
> 
> I, unsuccessfully,  tried to replicated this result with different
> variables. For example, cbind(ts(c(0,1), ts(matrix(c(2,3,4,5), 2,2))),
> returns exactly what I was expecting a ts matrix, with 2 rows and 3
> columns.
> 
> Anyone has any idea of what is happening? What kind of attribute my
> variables could have to imply this behavior? I have the felling that I am
> simply calling two different function, but don't know why.
> 
> Thank you in advance
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Second order stochastic dominance test

2016-08-30 Thread John Kane

google R package test the second order stochastic dominance of two curves
John Kane
Kingston ON Canada

> -Original Message-
> From: zoraze...@gmail.com
> Sent: Tue, 30 Aug 2016 11:31:09 +0200
> To: r-help@r-project.org
> Subject: [R] Second order stochastic dominance test
> 
> Hi all,
> 
> Is there any R package which could help me to test the second order
> stochastic dominance of two curves?
> 
> Thanks in advance for the help.
> 
> Kind regards,
> Zoraze
> 
> [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help 
> [https://stat.ethz.ch/mailman/listinfo/r-help]
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html 
> [http://www.R-project.org/posting-guide.html]
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How can I add text in plot and x axis of figures created in ggplot2?

2016-09-01 Thread John Kane
Hi Marna,

Thanks for providing the data and code. However there is a problem with the 
code and I wondered if something got garbled in transmission.

Below is the code that was in my mailbox
==
ylab <http://docs.ggplot2.org/0.9.2.1/labs.html>*(*"My Y"*)+*theme(
axis.text.x = element_text(size=8))
=
Clearly not functioning code

Am I correct in assuming that what it originally looked like was :
==
ylab("http://docs.ggplot2.org/0.9.2.1/labs.html";) +
   theme(axis.text.x = element_text(size=8))
==
?

It looks like you are sending mail in HTML and that can badly mangle code and 
data layouts. Please send an messages to R-help in plain text.  

I don't use facet_wrap() enough to know if what you want to do is doable but I 
am a bit dubious. 

I wonder if you have considered creating 4 independent graphs and using 
grid.Extra or grid.arrange to get the results you want.?

Sorry not to be of more help

John Kane
Kingston ON Canada


> -Original Message-
> From: marna.wag...@gmail.com
> Sent: Wed, 31 Aug 2016 16:35:29 -0700
> To: r-help@r-project.org
> Subject: [R] How can I add text in plot and x axis of figures created in
> ggplot2?
> 
> Hi R users,
> I have created four figures using ggplot2, but I am having trouble  to
> add
> "r2=XXX, p=XX" value on the upper left in each figure and also unit of X
> axis of each figure are different. I was also trying to write following
> :
> 1.  "rainfall (mm/year") on X axix for fig A.
> 2. "temp (degree Celsius)" on X axis for fig B
> 3.  "distance (m)" on X axis for fig C
> 4.  "survival Proba(%) on X axis for fig D
> 
> I am wondering how I can create the figures with the above information
> 
> Thank you for your help in advance
> 
> Sincerely,
> 
> Marna
> 
> following code and the example I have used.
> 
> dat<-structure(list(x = c(0.31, 0.04, 0.1, 0.54, 0.03, 0.86, 0.97,
> 
> 0.4, 0.62, 0.3, 0.44, 0.51, 0.03, 0.12, 0.79, 0.3, 0.22, 0.66,
> 
> 0.75, 0.45), y = c(0.38, 0.61, 0.16, 0.06, 0.42, 0.67, 0.85,
> 
> 0.11, 0.79, 0.21, 0.84, 0.95, 0.3, 0.47, 0.79, 0.2, 0.34, 0.21,
> 
> 0.62, 0.25), group = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L,
> 
> 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L), .Label = c("A",
> 
> "B", "C", "D"), class = "factor")), .Names = c("x", "y", "group"
> 
> ), class = "data.frame", row.names = c(NA, -20L))
> 
> 
> gp<-ggplot(data=dat, aes(x=x, y=y))
> 
> Gp<-gp + geom_point(size=1, col="blue")
> 
> Gp<-Gp+ stat_smooth(method="lm", level=0.99,
> col="black",formula=y~poly(x,1
> ))+
> 
> coord_cartesian(ylim=c(0, 1))+theme_bw()+
> 
> theme(axis.text.y = element_text(angle = 90, vjust = 0))+
> 
> ylab <http://docs.ggplot2.org/0.9.2.1/labs.html>*(*"My Y"*)+*theme(
> axis.text.x = element_text(size=8))
> 
> Gp+ facet_wrap(~group,ncol=5, scales="free_x")
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Off topic, but hopefully not totally irrelevant: on MS Excel and genomics

2016-09-02 Thread John Kane
Over the last few years I came to the conclusion that using a spreadsheet for 
anything more complicated than my shopping list was madness.
 I am now reconsidering my position on shopping lists.

Thanks Bert. I have a small collection of spreadsheet errors that have been  
published here and there and this is a great addition.

John Kane
Kingston ON Canada


> -Original Message-
> From: bgunter.4...@gmail.com
> Sent: Thu, 1 Sep 2016 08:09:46 -0700
> To: r-help@r-project.org
> Subject: [R] Off topic, but hopefully not totally irrelevant: on MS Excel
> and genomics
> 
> http://www.sciencemag.org/news/sifter/one-five-genetics-papers-contains-errors-thanks-microsoft-excel
> 
> Cheers,
> Bert
> 
> 
> Bert Gunter
> 
> "The trouble with having an open mind is that people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] workflow getting UTF-8 csv in and out of R on Mac (spreadsheet editor)

2016-09-02 Thread John Kane
An alternative to Erich Neuwirth's solution might be to use Apache OpenOffice 
or the (roughly) equivalent LibreOffice. I routinely use UTF-8 with these.

John Kane
Kingston ON Canada


> -Original Message-
> From: govo...@gmail.com
> Sent: Fri, 2 Sep 2016 13:03:20 +0200
> To: r-help@r-project.org
> Subject: [R] workflow getting UTF-8 csv in and out of R on Mac
> (spreadsheet editor)
> 
> Hi all,
> 
> I am hoping for some advice on how to handle UTF-8 spreadsheet files in a
> Mac environment - sort of off-topic, but still relevant for hopefully a
> bunch of people.
> 
> I am using R on Mac OS 10.10. Sometimes I have the urge to actually look
> at
> a large spreadsheet on the big screen or make some changes to the tables.
> Since most of my colleagues live in the M$ Excel - world I tend to use
> Excel 2011 as well. However, Excel does not handle UTF-8 (which I like
> because of different system locales).
> So I actually do a write.csv with file-encoding in macroman, but even
> then
> Excel won't just open it and I will have to work my way through the
> import-dialogue.
> 
> The other way around, it's even worse. I save the spreadsheet as
> macroman,
> iconv it to utf-8 and then read.csv it to R.
> 
> It works, but it's just really messy. Is there a (preferably
> light-weight)
> csv-spreadsheet Editor for Mac OS that you use? Open-Office? I would like
> NOT to actually buy another Excel version. However, for collaboration, a
> xls-export would be phenomenal.
> 
> Thanks!
> 
> Kai
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] GGplot annotate by facet

2016-09-10 Thread John Kane
Hi Saad,

Please have a look at 

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
and/or
http://adv-r.had.co.nz/Reproducibility.html

for some suggestions on how to ask a question on R-help

In particular it would be handy to have some sample data in dput() format.

I always mess up geom_bar() calls and at the moment don't understand exactly 
what you are doing here qplot(factor(Value),data=dat1,
  geom="bar",fill=factor(Type))


John Kane
Kingston ON Canada


> -Original Message-
> From: smk...@mail.missouri.edu
> Sent: Sat, 10 Sep 2016 01:55:18 +
> To: r-help@r-project.org
> Subject: [R] GGplot annotate by facet
> 
> Hi,
> 
> I have a dataframe which I need to plot in ggplot2 it looks like this :-
> 
> head(nodelta_firstexon)
>   Value Type  Histone
> 1  0.06 high  H3K27ac
> 2  0.12  low  H3K27ac
> 4  0.04 high H3K27me3
> 5  0.16  low H3K27me3
> 7  0.02 high H3K36me3
> 8  0.13  low H3K36me3
> 
> I have another data frame with p-v alues that looks like this :-
> 
> 
> head(mypval_df)
> 
>   Histone count pvalues
> 
> 1   H3K9ac 0   0.000
> 
> 2 H3K27me3 0   0.000
> 
> 3 H3K36me3  1000   1.000
> 
> 4  H3K4me3   583   0.583
> 
> 5  H3K4me1   882   0.882
> 
> 6  H3K27ac   970   0.970
> 
> This is how I plot the first dataframe  using ggplot
> p <-
> qplot(factor(Value),data=nodelta_firstexon,geom="bar",fill=factor(Type))+facet_wrap(~Histone)
> 
> Next I need to annotate p-values (p <= mypval_df$pvalues)  to each facet
> using the mypval_df.
> 
> I can't seem to find an example on how to do it. Would appreciate any
> help.
> 
> Regards
> Saad
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Drill down reports in R

2016-09-13 Thread John Kane
It is not really clear what you want but have a look at ?subset perhaps.

John Kane
Kingston ON Canada


> -Original Message-
> From: manu.redd...@gmail.com
> Sent: Tue, 13 Sep 2016 16:16:05 +0530
> To: r-help@r-project.org
> Subject: [R] Drill down reports in R
> 
> Hi,
> 
> 
> 
>   How to generate “Drill down reports ”  (like please refer below url) in
> R
> using any package ? I did lot of research in google but I didn’t found
> suitable link .
> 
>  Can anyone help how to do that in R ?
> 
> 
> 
> url :  http://bhushan.extreme-advice.com/drilldown-report-in-ssrs/
> 
> 
> 
> Thanks in Advance !
> 
> Manu.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Query on the R of free soft version 3

2016-09-21 Thread John Kane
What is your operating system?

Please do not post in HTML.

John Kane
Kingston ON Canada


> -Original Message-
> From: kkam-...@echigo.ne.jp
> Sent: Wed, 21 Sep 2016 09:30:15 +0900
> To: r-help@r-project.org
> Subject: [R] Query on the R of free soft version 3
> 
> Dear
> 
> 
> 
> Although I can install the new version of the R, I can not open the soft.
> 
> 
> 
> How do I do it?
> 
> 
> 
> Kyuzi Kamoi, MD.
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fw: R problem

2016-09-27 Thread John Kane
We have a "Do not help with homework" policy on R-help. We think that a student 
should speak with his or her instructor or tutor if help is needed.  So you are 
unlikely to get much help here though it is possible.

For future reference, 1. your script did not arrive. The data did. R-help is 
very fussy about what files it will accept.

It is better include your code (script) and data in the body of the email.  
Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
  or 
http://adv-r.had.co.nz/Reproducibility.html 
for some suggestions on how to ask a question here.

Then send a new email with the code and data included in the body of the email. 
Someone might help.

John Kane
Kingston ON Canada


> -Original Message-
> From: r-help@r-project.org
> Sent: Tue, 27 Sep 2016 16:11:06 + (UTC)
> To: r-help@r-project.org
> Subject: [R] Fw: R problem
> 
> 
> 
> 
> HelloI want to calculate sen slope with out using package. I wrote one
> but,  it is wrong. I attache my data and my script. would you please
> check it.Many thanksSincerely yoursElham
> 
> 
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Share photos & screenshots in seconds...
TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if1
Works in all emails, instant messengers, blogs, forums and social networks.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Extracting xml data to data frames

2015-04-16 Thread John Kane
No attachment : R-help is rather fussy about the files it will accept. You are 
probably okay with .txt .pdf, or png but even .csv is likely to get stripped.  

The best way to supply data is by using dput()  .  Type ?dput for information 
or have a look at  http://adv-r.had.co.nz/Reproducibility.html for some hints.  


John Kane
Kingston ON Canada


> -Original Message-
> From: g.ru...@bham.ac.uk
> Sent: Thu, 16 Apr 2015 17:57:44 +
> To: r-help@r-project.org
> Subject: [R] Extracting xml data to data frames
> 
> Hi Rgonauts,
> 
> I am trying to parse some xml files of transport data using the
> TransExchange format (in this case bus routing information) and obtain
> some data.frames for onward processing for a GIS related task.  Ideally I
> need them in .csv files.
> 
> Each file (an example is attached) contains up to 8 tables of information
> about transport operators and routing information.  I have uploaded an
> example that contains all 8.  In fact I have some hundreds of similar
> files that will need processing. So when I've solved this I will need to
> be able to loop through a bunch of them.
> 
> I'm new to handling xml data and to the xml package so I don't really
> know what I'm doing, this is my first stab at using the xml package.
> So far the workflow goes something like this.
> 
> #get the file
> doc=xmlTreeParse("cen_18-23-D-y11-2.xml")
> top=xmlRoot(doc)
> 
> #look at the names
> top=xmlRoot(doc)
> 
> #pick one of them to use, in this case the forth one, 'routes', a table
> of information about this particular bus route. using some code from
> another forum post, I can get a data.frame with the info i need in it.
> OK I need to do some reshaping but I can handle that later
> 
> fr4<-(top[[4]])
> fr4
> xmlSApply(fr4,function(x) xmlSApply(x,xmlValue))
> df<-as.data.frame(xmlSApply(fr4,function(x) xmlSApply(x,xmlValue)))
> df
> 
> #this works but when I try it with another table, the fifth one say, that
> captures information about the parts of the journey between stops, it
> falls over.
> 
> fr5<-(top[[5]])
> fr5
> xmlSApply(fr5,function(x) xmlSApply(x,xmlValue))
> df<-as.data.frame(xmlSApply(fr5,function(x) xmlSApply(x,xmlValue)))
> df
> 
> Now I guess there is an irregularity in the xml causing this.  I gather
> from other posts I should use Xpath functionality to interrogate this
> section of the data. I've tried reverse engineering some of these
> commands I've seen in solutions to irregular xml problems on other forums
> but not got to what I want. I'm not really up on xml, but I am assuming
> it is something to do with the  part of
> the file is what is causing the problem?  This looks like there should be
> a field called JouneyPattern ID (only I guess without the space) and then
> the ID code as the actual field contents.
> 
> So my question is, is there a way to parse this table correctly and
> output the resulting df as a csv?
> 
> All help gratefully recieved.  BTW the link to the searhable r-help
> archives seems to be broken.
> 
> GavinR
> 
> 
> 
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Where is the R Graph Gallery?

2015-04-18 Thread John Kane
I think it moved to http://rgraphgallery.blogspot.com/ with a different 
interface.

John Kane
Kingston ON Canada


> -Original Message-
> From: jsz...@yeah.net
> Sent: Sat, 18 Apr 2015 20:10:50 +0800
> To: r-help@r-project.org
> Subject: [R] Where is the R Graph Gallery?
> 
> Hi there,
> 
> Does anyone here know where does the R Graph Gallery
> (http://addictedtor.free.fr/graphiques/) move to? I googled, but don't
> find any useful hints.
> 
> Any help? Thanks in advance!
> 
> Best,
> Jinsong
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Where is the R Graph Gallery?

2015-04-18 Thread John Kane
I thought I'd read about a migration. Well so much for memory.

John Kane
Kingston ON Canada


> -Original Message-
> From: e...@debian.org
> Sent: Sat, 18 Apr 2015 09:16:44 -0500
> To: jrkrid...@inbox.com
> Subject: Re: [R] Where is the R Graph Gallery?
> 
> 
> On 18 April 2015 at 05:29, John Kane wrote:
> | I think it moved to http://rgraphgallery.blogspot.com/ with a different
> interface.
> 
> I don't think so. Something I contributed years ago to the original Graph
> Gallery is not on this site.
> 
> Dirk
> 
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with col

2015-04-20 Thread John Kane



> -Original Message-
> From: soniaam...@gmail.com
> Sent: Mon, 20 Apr 2015 18:56:19 +0200
> To: sarah.gos...@gmail.com
> Subject: Re: [R] Problem with col

 --- clip--
> 
> When I type data , I obtain all the numeric values and the headears  I
> added (Consommation,Cylindre,Puissance,Poids)

No you probably do not, as Sarah explained.

As a quick example of the issue look at the two data sets below. Just copy and 
paste into your R editor.  Both data sets are in dput() format which is how you 
should supply sample data to R-help.

ddat1  <-   structure(list(aa = structure(1:4, .Label = c("a", "b", "c",
"d"), class = "factor"), bb = 1:4), .Names = c("aa", "bb"), row.names = c(NA,
-4L), class = "data.frame")

ddat2 <- structure(list(aa = c("a", "b", "c", "d"), bb = c("1", "2", "3", 
"4")), .Names = c("aa", "bb"), row.names = c(NA, -4L), class = "data.frame")

If yo do
dat1
dat2
they look the same on the screen but if you do str()  they are not the same.
str(dat1) 
str(dat2)

Also try 
ddat1$bb * 5  #works
ddat2$bb * 5 # error!


They look the same on the computer screen but they are quite different.

John Kane
Kingston ON Canada



> 
> Thanks
> 
> 
> 
> 2015-04-20 18:40 GMT+02:00 Sarah Goslee :
> 
>> What is the problem? One or more of your columns was read as factor, as
>> 
>> str(data)
>> 
>> would show you. To avoid this, you can add stringsAsFactors=FALSE to
>> the read.table command, but if you expect your data to be entirely
>> numeric then there's something wrong with it that you need to hunt
>> down.
>> 
>> Sarah
>> 
>> On Mon, Apr 20, 2015 at 12:33 PM, Sonia Amin 
>> wrote:
>>> Dear All,
>>> 
>>> I have written the following lines:
>>> 
>>> 
>> data<-read.table("C:\\Users\\intel\\Documents\\SIIID\\datamultiplereg.txt",header
>>> = FALSE, sep = "")
>>>  colnames(data)<-c("Consommation","Cylindre","Puissance","Poids")
>>>  result.model1<-lm(Consommation~Cylindre+Puissance+Poids, data=data)
>>> summary(result.model1)
>>> 
>>> I obtained the following message:
>>> 
>>> 
>>> Call:
>>> lm(formula = Consommation ~ Cylindre + Puissance + Poids, data = data)
>>> 
>>> Residuals:
>>> Error in quantile.default(resid) : factors are not allowed
>>> In addition: warning message:
>>> In Ops.factor(r, 2) :
>>>   ‘^’ This is not relevant for factors
>>> 
>>> 
>>> Where is the problem?
>>> Thank you in advance
>>> 
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] modifications using “stat_summary” in ggplot

2015-04-22 Thread John Kane
It would really help to have some sample data to see what is happening.  The 
best way to supply data to the help group is to use dput().  Type >dput for 
some basic information on using it

Have a look at and/or 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
  for some hints. For this last link it is a good idea to follow the " 
reproducible example  " link for more concrete suggestions.


By the way calling a data.frame "data" is not a good idea.  Data is a 
predefined function in R . Type ?data to see what I mean.
John Kane
Kingston ON Canada


> -Original Message-
> From: michael.eisenr...@agroscope.admin.ch
> Sent: Wed, 22 Apr 2015 09:32:11 +
> To: r-help@r-project.org
> Subject: [R] modifications using “stat_summary” in ggplot
> 
> Dear R-list members
> I am using stat_summary in ggplot to plot a  error bar graph comparing
> three treatmens (damage, see code below).
> I would like to change the shape of the three symbols displaying the mean
> values (e.g one symbol should be a point (default) one should be a
> triangle and one should be a square). Furthermore, I would like that the
> outlines of my error bars are black (and that I can fill them with
> whatever color I want ( I used white, black and gray65).
> 
> Does Anyone of you know how to solve these problems?
> 
> I use the following code:
> 
> line<-ggplot(data,aes(leaf,cor_average,fill=damage, colour=damage))
> #define x (leaf) and y (cor_average) variables within aes() and that they
> should be colored according to damage type
> line+stat_summary(fun.y=mean, geom="point", size=3)+
> #add mean as point symbol
> stat_summary(fun.data=mean_cl_boot,geom="errorbar",width=0.3, size=0.75)+
> scale_colour_manual(values=c("white","black","gray65"))+
> #add CI : width=width of CI whiskers, size=widht of the CI bar
> labs(x="Leaf",y="Average nr. glands corrected for leaf sz.")
> 
> 
> Thank you very much,
> Michael
> 
> Eisenring Michael, Msc.
> PhD Student
> 
> Federal Department of Economic Affairs, Education and Research
> EAER
> Institute of Sustainability Sciences ISS
> Biosafety
> 
> Reckenholzstrasse 191, CH-8046 Zrich
> Tel. +41 44 37 77181
> Fax +41 44 37 77201
> michael.eisenr...@agroscope.admin.ch<mailto:michael.eisenr...@agroscope.admin.ch>
> www.agroscope.ch<http://www.agroscope.ch/>
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] cbind question, please

2015-04-24 Thread John Kane
What are you expecting?

dog <- 1:3
cat <- 2:4
tree <- 5:7
big.char <- c("dog","cat","tree")

xx <-  cbind(dog, cat, tree, big.char)

gives me 
xx1  <-  structure(c("1", "2", "3", "2", "3", "4", "5", "6", "7", "dog", 
"cat", "tree"), .Dim = 3:4, .Dimnames = list(NULL, c("dog", "cat", 
"tree", "big.char")))



John Kane
Kingston ON Canada


> -Original Message-
> From: erinm.hodg...@gmail.com
> Sent: Thu, 23 Apr 2015 18:41:05 -0400
> To: r-h...@stat.math.ethz.ch
> Subject: [R] cbind question, please
> 
> Hello!
> 
> I have a cbind type question, please:  Suppose I have the following:
> 
> dog <- 1:3
> cat <- 2:4
> tree <- 5:7
> 
> and a character vector
> big.char <- c("dog","cat","tree")
> 
> I want to end up with a matrix that is a "cbind" of dog, cat, and tree.
> This is a toy example.  There will be a bunch of variables.
> 
> I experimented with "do.call", but all I got was
> 1
> 2
> 3
> 
> Any suggestions would be much appreciated.  I still think that do.call
> might be the key, but I'm not sure.
> 
> R Version 3-1.3, Windows 7.
> 
> Thanks,
> Erin
> 
> 
> --
> Erin Hodgess
> Associate Professor
> Department of Mathematical and Statistics
> University of Houston - Downtown
> mailto: erinm.hodg...@gmail.com
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help

2015-04-24 Thread John Kane
Bonjour,

We need more information.  See Reproducibility 
http://adv-r.had.co.nz/Reproducibility.html  for some suggestions on how to ask 
a question.



John Kane
Kingston ON Canada


> -Original Message-
> From: mamadouns...@gmail.com
> Sent: Fri, 24 Apr 2015 13:26:32 +0100
> To: r-help@r-project.org
> Subject: [R] help
> 
> Bonjour, je suis un nouveau dans R. Je fais actuellement mon mémoire de
> mastère et je voudrais appliquer le Package BCDating. Mail il se trouve
> que
> je reçois toujours le message d'erreur suivant:
> Erreur dans if (mat_tp[r, 1] < n) mat_tp <- rbind(mat_tp, c(n, 1 -
> mat_tp[r,  :
>   l'argument est de longueur nulle
> J'ai suivi les étapes suivantes:
> LGDPTUND.ts= ts(data=LGDPTUND, start=c(2000,1), end=c(2014,3),
> frequency=4)
> class(LGDPTUND.ts)
> dat <-BBQ(LGDPTUND,name="Datation du Cycle Eco Tunisien")
> Erreur dans if (mat_tp[r, 1] < n) mat_tp <- rbind(mat_tp, c(n, 1 -
> mat_tp[r,  :
>   l'argument est de longueur nulle
> Pour me présenter, je suis un jeune étudiant sénégalais qui fais
> actuellement ses études en Tunisie, en Economie Quantitative. Merci
> Cordialement!!!
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Why is removeSparseTerms() not doing anything?

2015-04-24 Thread John Kane
Reproducibility
http://adv-r.had.co.nz/Reproducibility.html  
 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


John Kane
Kingston ON Canada


> -Original Message-
> From: mikeh...@y7mail.com
> Sent: Wed, 22 Apr 2015 18:52:45 + (UTC)
> To: r-help@r-project.org
> Subject: [R] Why is removeSparseTerms() not doing anything?
> 
> Here's the code and results.  The corpus is the text version of a single
> book.   (r vs. 3.2)
>> docs <- tm_map(docs, stemDocument)
>> dtm <- DocumentTermMatrix(docs)
>> freq <- colSums(as.matrix(dtm))
>> ord <- order(freq)
>> freq[tail(ord)]
> one experi   will   can lucid dream
> 287   312   363   452   1018   2413
>> freq[head(ord)]
> abbey abdomin   abdu abraham absent   abus
>   1   1   1   1   1   1
>> dim(dtm)
> [1]   1 5265
>> dtms <- removeSparseTerms(dtm, 0.1)
>> dim(dtms)
> [1]   1 5265
>> dtms <- removeSparseTerms(dtm, 0.001)
>> dim(dtms)
> [1]   1 5265
>> dtms <- removeSparseTerms(dtm, 0.9)
>> dim(dtms)
> [1]   1 5265
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] download

2015-04-25 Thread John Kane

> -Original Message-
> From: s.f.jal...@gmail.com
> Sent: Sat, 25 Apr 2015 15:46:34 +0200
> To: r-help@r-project.org
> Subject: [R] download
> 
> I am a student from Sweden.

Welcome from Canada

> I would like to download and install R program to work on statistics.
> If I want to download 2014 version, how I can do this.

That is not a version. That is a year.  The most recent version is R 3.2.0  
with the date of (2015-04-16).  

> Also, do I need to choose Sweden in Cran Mirrors list?

No but it is better to do so. Less traffic on the web.

> Regards,
>  Fatemeh

Welcome to R and the R-help list


Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] knittr: non-numeric argument to binary operator

2015-04-26 Thread John Kane
We need some idea of what you were actually doing (i.e code, data, ... )

See http://adv-r.had.co.nz/Reproducibility.html for some suggestions.
John Kane
Kingston ON Canada


> -Original Message-
> From: m...@markdrummond.ca
> Sent: Sun, 26 Apr 2015 16:41:32 -0400
> To: r-h...@stat.math.ethz.ch
> Subject: [R] knittr: non-numeric argument to binary operator
> 
> knittr is giving me the above error. The code it is failing on is
> multiplying two numeric features of a data frame. I can run the code
> by hand and it works fine, but when I try to knit my document, knittr
> chokes on the same line.
> 
> When kitting:
> 
> Quitting from lines 161-175 (RepData_PeerAssessment2.Rmd)
> Error in storm_data$PROPDMG * storm_data$property_damage_cost_factor :
>   non-numeric argument to binary operator
> Calls:  ... handle -> withCallingHandlers -> withVisible ->
> eval -> eval
> Execution halted
> 
> Running the same lines manually (CTRL+Enter) from the .Rmd file:
> 
>> storm_data$total_damage <-
> + (storm_data$PROPDMG * storm_data$property_damage_cost_factor) +
> + (storm_data$CROPDMG * storm_data$crop_damage_cost_factor)
>> str(storm_data$total_damage)
>  num [1:902297] 25 2.5 25 2.5 2.5 2.5 2.5 2.5 25 25 ...
>> 
> 
> Call me baffled. Any pointers are greatly appreciated at this point.
> 
> --
> Cheers, Mark
> 
> Mark Drummond
> m...@markdrummond.ca
> 
> When I get sad, I stop being sad and be Awesome instead. TRUE STORY.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question about base::rank results

2015-04-27 Thread John Kane
Ah, thanks. That makes sense. 

John Kane
Kingston ON Canada


> -Original Message-
> From: petr.pi...@precheza.cz
> Sent: Mon, 27 Apr 2015 08:29:36 +
> To: giorgio.garzi...@ericsson.com, r-help@r-project.org
> Subject: Re: [R] Question about base::rank results
> 
> Hi
> 
> You want to use order.
> 
> rank gives you position of x according their values.
> 
>> x <- c(12,34,15,77,78,22)
> 
>> rank(x)
> [1] 1 4 2 5 6 3
> 
> order gives you sorting vector to get your values in ascending or
> descending order.
> 
>> order(x)
> [1] 1 3 6 2 4 5
>> x[order(x)]
> [1] 12 15 22 34 77 78
> 
> You can see it as
> 
> as first element 12 is selected - 1
> as second element 15 is selected - 3
> as third element 22 is selected - 6
> ...
> 
> Cheers
> Petr
> 
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Giorgio
>> Garziano
>> Sent: Sunday, April 26, 2015 10:18 AM
>> To: r-help@r-project.org
>> Subject: [R] Question about base::rank results
>> 
>> Hi,
>> 
>> I cannot understand why rank(x) behaves as outlined below.
>> Based on the results of first x vector values ranking, which is as
>> expected in my opinion, I cannot explain the following results.
>> 
>>> x <- c(12,34,15,77,78)
>>> x[rank(x)]
>> [1] 12 15 34 77 78  (OK)
>> 
>>> x <- c(12,34,15,77,78,22)
>>> x[rank(x)]
>> [1] 12 77 34 78 22 15   (?)
>> 
>>> x <- c(12,34,77,15,78)
>>> x[rank(x)]
>> [1] 12 77 15 34 78  (?)
>> 
>> Please any feedback ? Thanks.
>> 
>> BR,
>> 
>> Giorgio Garziano
>> 
>> 
>> 
>>   [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
> neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
> kopie vymažte ze svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
> email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi
> či zpožděním přenosu e-mailu.
> 
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
> smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
> přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze
> strany příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
> výslovným dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
> společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
> zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
> adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
> předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
> známá.
> 
> This e-mail and any documents attached to it may be confidential and are
> intended only for its intended recipients.
> If you received this e-mail by mistake, please immediately inform its
> sender. Delete the contents of this e-mail with all attachments and its
> copies from your system.
> If you are not the intended recipient of this e-mail, you are not
> authorized to use, disseminate, copy or disclose this e-mail in any
> manner.
> The sender of this e-mail shall not be liable for any possible damage
> caused by modifications of the e-mail or by delay with transfer of the
> email.
> 
> In case that this e-mail forms part of business dealings:
> - the sender reserves the right to end negotiations about entering into a
> contract in any time, for any reason, and without stating any reasoning.
> - if the e-mail contains an offer, the recipient is entitled to
> immediately accept such offer; The sender of this e-mail (offer) excludes
> any acceptance of the offer on the part of the recipient containing any
> amendment or variation.
> - the sender insists on that the respective contract is concluded only
> upon a

Re: [R] Help Interpreting Linear Mixed Model

2015-04-27 Thread John Kane


John Kane
Kingston ON Canada


> -Original Message-
> From: joshuamichaeldi...@gmail.com
> Sent: Mon, 27 Apr 2015 08:54:51 +0100
> To: thierry.onkel...@inbo.be
> Subject: Re: [R] Help Interpreting Linear Mixed Model
> 
> Hello Thierry,
> 
> No, this isn't homework. Not that young unfortunately.
> 

A few years ago a friend of mine and her daughter were neck-in-neck on who got 
their Ph.D first. What's this "not that young" business?

BTW, a better way to supply sample data is to use the dput() command.

Do a dput(mydata), copy the results into the email and you have supplied us 
with an exact copy of your data.  

It is possible for many reasons that I will not read in your data, as you 
supplied it, in the format you have it in.  This can lead to real confusion.





> Josh
> 
>> On 27 Apr 2015, at 08:06, Thierry Onkelinx 
>> wrote:
>> 
>> Dear Josh,
>> 
>> Is this homework? Because the list has a no homework policy.
>> 
>> Best regards,
>> 
>> 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
>> 
>> To call in the statistician after the experiment is done may be no more
>> than asking him to perform a post-mortem examination: he may be able to
>> say what the experiment died of. ~ Sir Ronald Aylmer Fisher
>> The plural of anecdote is not data. ~ Roger Brinner
>> The combination of some data and an aching desire for an answer does not
>> ensure that a reasonable answer can be extracted from a given body of
>> data. ~ John Tukey
>> 
>> 2015-04-27 2:26 GMT+02:00 Joshua Dixon :
>>> Hello!
>>> 
>>> Very new to R (10 days), and I've run the linear mixed model, below.
>>> Attempting to interpret what it means...  What do I need to look for?
>>> Residuals, correlations of fixed effects?!
>>> 
>>> How would I look at very specific interactions, such as PREMIER_LEAGUE
>>> (Level) 18 (AgeGr) GK (Position) mean difference to CHAMPIONSHIP 18
>>> GK?
>>> 
>>> For reference my data set looks like this:
>>> 
>>> Id Level AgeGr   Position Height Weight BMI YoYo
>>> 7451 CHAMPIONSHIP 14 M NA 63 NA 80
>>> 148 PREMIER_LEAGUE 16 D NA 64 NA 80
>>> 10393 CONFERENCE 10 D NA 36 NA 160
>>> 10200 CHAMPIONSHIP 10 F NA 46 NA 160
>>> 1961 LEAGUE_TWO 13 GK NA 67 NA 160
>>> 10428 CHAMPIONSHIP 10 GK NA 40 NA 160
>>> 10541 LEAGUE_ONE 10 F NA 25 NA 160
>>> 10012 CHAMPIONSHIP 10 GK NA 30 NA 160
>>> 9895 CHAMPIONSHIP 10 D NA 36 NA 160
>>> 
>>> 
>>> Many thanks in advance for time and help.  Really appreciate it.
>>> 
>>> Josh
>>> 
>>> 
>>>> summary(lmer(YoYo~AgeGr+Position+(1|Id)))
>>> Linear mixed model fit by REML ['lmerMod']
>>> Formula: YoYo ~ AgeGr + Position + (1 | Id)
>>> 
>>> REML criterion at convergence: 125712.2
>>> 
>>> Scaled residuals:
>>> Min  1Q  Median  3Q Max
>>> -3.4407 -0.5288 -0.0874  0.4531  4.8242
>>> 
>>> Random effects:
>>>  Groups   NameVariance Std.Dev.
>>>  Id   (Intercept) 15300123.7
>>>  Residual 16530128.6
>>> Number of obs: 9609, groups:  Id, 6071
>>> 
>>> Fixed effects:
>>>  Estimate Std. Error t value
>>> (Intercept) -521.698516.8392  -30.98
>>> AgeGr 62.6786 0.9783   64.07
>>> PositionD139.4682 7.8568   17.75
>>> PositionM141.2227 7.7072   18.32
>>> PositionF135.1241 8.1911   16.50
>>> 
>>> Correlation of Fixed Effects:
>>>   (Intr) AgeGr  PostnD PostnM
>>> AgeGr -0.910
>>> PositionD -0.359 -0.009
>>> PositionM -0.375  0.001  0.810
>>> PositionF -0.349 -0.003  0.756  0.782
>>>> model=lmer(YoYo~AgeGr+Position+(1|Id))
>>>> summary(glht(model,linfct=mcp(Position="Tukey")))
>>> 
>>>  Simultaneous Tests for General Linear Hypotheses
>>> 
>>> Multiple Comparisons of Means: Tukey Contrasts
>>> 
>>> 
>>> Fit: lmer(formula = YoYo ~ AgeGr + Position + (1 | Id))
>>> 
>>> Linear Hypotheses:
>>> Estimate Std. Error z value Pr(>|z|)
>>> D - GK == 0  139.468  7.857  17.751   <1e-04 ***
>>> M - GK == 0 

Re: [R] Help Interpreting Linear Mixed Model

2015-04-27 Thread John Kane

Hi Josh,

Just a sample  is usually  fine. As long as it cover a representative (must be 
time for dinner---I was going to type reprehensibe) sample of the data then 
something like dput(head(mydata, 100) ) works well.  

Kingston ON Canada

-Original Message-
From: joshuamichaeldi...@gmail.com
Sent: Mon, 27 Apr 2015 21:30:39 +0100
To: li...@dewey.myzen.co.uk
Subject: Re: [R] Help Interpreting Linear Mixed Model

Apologies for my ignorance!

Thierry - thank you for the reading.  I'll look into those ASAP!

John - The data set I have is quite large, when using the dput() command I'm 
unsure if it actually fits the whole output into the console.  I can't scroll 
up far enough to see the actual command.  I can paste what is there if that may 
help?  The bottom line: 

Names = c("Id", "Level", "AgeGr", "Position", "Height", "Weight", "BMI", 
"YoYo"), class = "data.frame", row.names = c(NA, -9689L))

Michael - Essentially, I'm looking for differences between "YoYo" outcome for 
"Positions", "Levels" and accounting for repeated measures using "Id" as a 
random factor.  So I was able to figure out points 2 and 3.

I've searched for definitions of "Scaled residuals", "Random effects", "Fixed 
effects", "Correlation of Fixed Effects".  However, I'm confused at the 
different interpretations I've found.  Or quite possibly, I'm just confused...  
What should I be looking out for in these variables?

I've tried to take my analysis smaller, and just look at specifics, to make it 
simpler.  Such as, comparing YoYo (outcome score) for a Premier_League (Level), 
22 (AgeGr) F (Position) with a Premier_League (Level), 22 (AgeGr) M (Position). 
 How do I convert these into a factors for analysis?

Simple question maybe, but it's not when you can't find the answer!

Thank you,

Josh

On Mon, Apr 27, 2015 at 4:10 PM, Michael Dewey  wrote:

Dear Joshua

 It would also help if you told us what your scientific question was. At the 
moment we know what R commands you used and have seen the head of your dataset 
but not why you are doing it.

 I would summarise what you have given us as

 1 - most ID only occur once
 2 - goal keepers do worse than outfield players
 3 - older people (presumably in fact age is in years as a continuous variable) 
do better

 On 27/04/2015 12:42, John Kane wrote:

 John Kane
 Kingston ON Canada

 -Original Message-
 From: joshuamichaeldi...@gmail.com
 Sent: Mon, 27 Apr 2015 08:54:51 +0100
 To: thierry.onkel...@inbo.be
 Subject: Re: [R] Help Interpreting Linear Mixed Model

 Hello Thierry,

 No, this isn't homework. Not that young unfortunately.

 A few years ago a friend of mine and her daughter were neck-in-neck on who got 
their Ph.D first. What's this "not that young" business?

 BTW, a better way to supply sample data is to use the dput() command.

 Do a dput(mydata), copy the results into the email and you have supplied us 
with an exact copy of your data.

 It is possible for many reasons that I will not read in your data, as you 
supplied it, in the format you have it in.  This can lead to real confusion.

 Josh

 On 27 Apr 2015, at 08:06, Thierry Onkelinx 
 wrote:

 Dear Josh,

 Is this homework? Because the list has a no homework policy.

 Best regards,

 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

 To call in the statistician after the experiment is done may be no more
 than asking him to perform a post-mortem examination: he may be able to
 say what the experiment died of. ~ Sir Ronald Aylmer Fisher
 The plural of anecdote is not data. ~ Roger Brinner
 The combination of some data and an aching desire for an answer does not
 ensure that a reasonable answer can be extracted from a given body of
 data. ~ John Tukey

 2015-04-27 2:26 GMT+02:00 Joshua Dixon :

 Hello!

 Very new to R (10 days), and I've run the linear mixed model, below.
 Attempting to interpret what it means...  What do I need to look for?
 Residuals, correlations of fixed effects?!

 How would I look at very specific interactions, such as PREMIER_LEAGUE
 (Level) 18 (AgeGr) GK (Position) mean difference to CHAMPIONSHIP 18
 GK?

 For reference my data set looks like this:

 Id Level AgeGr   Position Height Weight BMI YoYo
 7451 CHAMPIONSHIP 14 M NA 63 NA 80
 148 PREMIER_LEAGUE 16 D NA 64 NA 80
 10393 CONFERENCE 10 D NA 36 NA 160
 10200 CHAMPIONSHIP 10 F NA 46 NA 160
 1961 LEAGUE_TWO 13 GK NA 67 NA 160
 10428 CHAMPIONSHIP 10 GK NA 40 NA 160
 10541 LEAGUE_ONE 10 F NA 25 NA 160
 10012 CHAMPIONSHIP 10 GK NA 30 NA 160
 9895 CHAMPIONSHIP 10 D NA

Re: [R] DeSolver giving "NA" as output, but running fully.

2015-04-27 Thread John Kane
Data?

Use deput()  (see ?dput) to provide some sample data.  Also you might find this 
useful http://adv-r.had.co.nz/Reproducibility.html 

John Kane
Kingston ON Canada


> -Original Message-
> From: walke...@umn.edu
> Sent: Mon, 27 Apr 2015 13:34:54 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] DeSolver giving "NA" as output, but running fully.
> 
> Hello All,
> 
> I am currently looking on a transmission model for STD transmission
> within a
> population.  I am able to run my full code and the ODE function, but when
> I
> look at my output, all I get is "NA" for each time step beyond the first.
> There doesn't seem to be any syntax error, and I do get my entire program
> to
> run.  Here is my code:
> 
> setwd("C:/Users/L/Documents/MastersThesis")
> 
> require(deSolve);
> 
> 
> #Model 1
> 
> 
> #The function
> HPVInfection<-function(t,y,p){
>   XFL = y[1]; #number of susceptible unvaccinated females low risk
>   XFM = y[2]; #number of susceptible unvaccinated females medium risk
>   XFH = y[3]; #number of susceptible unvaccinated females high risk
>   XML = y[4]; #number of susceptible unvaccinated males low risk
>   XMM = y[5]; #number of susceptible unvaccinated males medium risk
>   XMH = y[6]; #number of susceptible unvaccinated males high risk
>   Y1FL = y[7]; #number of infected unvaccinated females low risk infected
> with vaccine strain
>   Y1FM = y[8]; #number of infected unvaccinated females medium risk low
> risk
> infected with vaccine strain
>   Y1FH = y[9]; #number of infected unvaccinated females high risk low risk
> infected with vaccine strain
>   Y1ML = y[10]; #number of infected unvaccinated males low risk low risk
> infected with vaccine strain
>   Y1MM = y[11]; #number of infected unvaccinated males medium risk low
> risk
> infected with vaccine strain
>   Y1MH = y[12]; #number of infected unvaccinated males high risk low risk
> infected with vaccine strain
>   Y2FL = y[13]; #number of infected unvaccinated females low risk infected
> with non-vaccine strain
>   Y2FM = y[14]; #number of infected unvaccinated females medium risk low
> risk
> infected with non-vaccine strain
>   Y2FH = y[15]; #number of infected unvaccinated females high risk low
> risk
> infected with non-vaccine strain
>   Y2ML = y[16]; #number of infected unvaccinated males low risk low risk
> infected with non-vaccine strain
>   Y2MM = y[17]; #number of infected unvaccinated males medium risk low
> risk
> infected with non-vaccine strain
>   Y2MH = y[18]; #number of infected unvaccinated males high risk low risk
> infected with non-vaccine strain
>   ZFL = y[19]; #number of immune females low risk
>   ZFM = y[20]; #number of immune females medium risk
>   ZFH = y[21]; #number of immune females high risk
>   ZML = y[22]; #number of immune males low risk
>   ZMM = y[23]; #number of immune males medium risk
>   ZMH = y[24]; #number of immune males high risk
>   VFL = y[25]; #number of susceptible vaccinated females low risk
>   VFM = y[26]; #number of susceptible vaccinated females medium risk
>   VFH = y[27]; #number of susceptible vaccinated females high risk
>   VML = y[28]; #number of susceptible vaccinated males low risk
>   VMM = y[29]; #number of susceptible vaccinated males medium risk
>   VMH = y[30]; #number of susceptible vaccinated males high risk
>   W1FL = y[31]; #number of infected vaccinated females low risk infected
> with
> vaccine strain
>   W1FM = y[32]; #number of infected vaccinated females medium risk
> infected
> with vaccine strain
>   W1FH = y[33]; #number of infected vaccinated females high risk infected
> with vaccine strain
>   W1ML = y[34]; #number of infected vaccinated males low risk infected
> with
> vaccine strain
>   W1MM = y[35]; #number of infected vaccinated males medium risk infected
> with vaccine strain
>   W1MH = y[36]; #number of infected vaccinated males high risk infected
> with
> vaccine strain
>   W2FL = y[37]; #number of infected vaccinated females low risk infected
> with
> non-vaccine strain
>   W2FM = y[39]; #number of infected vaccinated females medium risk
> infected
> with non-vaccine strain
>   W2FH = y[40]; #number of infected vaccinated females high risk infected
> with non-vaccine strain
>   W2ML = y[41]; #number of infected vaccinated males low risk infected
> with
> non-vaccine strain
>   W2MM = y[42]; #number of infected vaccinated males medium risk infected
> with non-vaccine strain
>   W2MH = y[43]; #number of in

Re: [R] Help Interpreting Linear Mixed Model

2015-04-27 Thread John Kane

Looks great.  How come so many NA's in Height and BMI? Just no data available?

 str(dat1)
'data.frame':   100 obs. of  8 variables:
 $ Id  : int  7451 148 10393 10200 1961 10428 10541 10012 9895 10626 ...
 $ Level   : Factor w/ 5 levels "CHAMPIONSHIP",..: 1 1 1 1 1 1 1 1 1 1 ...
 $ AgeGr   : int  14 16 10 10 13 10 10 10 10 10 ...
 $ Position: Factor w/ 4 levels "D","F","GK","M": 4 1 1 2 3 3 2 3 1 1 ...
 $ Height  : int  NA NA NA NA NA NA NA NA NA NA ...
 $ Weight  : num  63 64 36 46 67 40 25 30 36 33 ...
 $ BMI : num  NA NA NA NA NA NA NA NA NA NA ...
 $ YoYo: int  80 80 160 160 160 160 160 160 160 160 ...

John Kane
Kingston ON Canada

-Original Message-
From: joshuamichaeldi...@gmail.com
Sent: Mon, 27 Apr 2015 23:35:13 +0100
To: jrkrid...@inbox.com
Subject: Re: [R] Help Interpreting Linear Mixed Model

Thanks John!

This ok?

> dput(head(data, 100))

structure(list(Id = c(7451L, 148L, 10393L, 10200L, 1961L, 10428L, 

10541L, 10012L, 9895L, 10626L, 1151L, 8775L, 10083L, 6217L, 90L, 

10168L, 10291L, 8549L, 3451L, 10003L, 5907L, 10136L, 6182L, 6315L, 

10015L, 9956L, 2040L, 4710L, 10747L, 6787L, 1222L, 10757L, 2892L, 

117L, 10328L, 10503L, 768L, 2979L, 1961L, 10520L, 10498L, 3018L, 

10335L, 2448L, 9027L, 362L, 8499L, 10603L, 9489L, 2124L, 707L, 

8501L, 4908L, 9905L, 3000L, 2819L, 9973L, 10550L, 9921L, 10639L, 

8771L, 10121L, 32L, 9935L, 9299L, 3246L, 682L, 10325L, 6741L, 

3295L, 5270L, 727L, 8500L, 50L, 4705L, 3018L, 787L, 2953L, 1391L, 

3682L, 7974L, 5023L, 652L, 727L, 679L, 10212L, 9488L, 9987L, 

10039L, 5025L, 250L, 2539L, 787L, 3000L, 1151L, 8946L, 6177L, 

3296L, 250L, 498L), Level = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = 
c("CHAMPIONSHIP", 

"CONFERENCE", "LEAGUE_ONE", "LEAGUE_TWO", "PREMIER_LEAGUE"), class = "factor"), 

    AgeGr = c(14L, 16L, 10L, 10L, 13L, 10L, 10L, 10L, 10L, 10L, 

    14L, 10L, 10L, 10L, 12L, 10L, 10L, 12L, 10L, 10L, 10L, 10L, 

    12L, 10L, 10L, 10L, 10L, 10L, 10L, 15L, 10L, 10L, 10L, 12L, 

    10L, 10L, 13L, 10L, 13L, 11L, 11L, 13L, 12L, 11L, 12L, 14L, 

    13L, 13L, 13L, 13L, 12L, 11L, 15L, 11L, 14L, 13L, 11L, 11L, 

    11L, 12L, 14L, 12L, 13L, 11L, 13L, 15L, 11L, 13L, 13L, 13L, 

    14L, 13L, 13L, 12L, 13L, 13L, 13L, 14L, 12L, 14L, 13L, 13L, 

    13L, 13L, 13L, 12L, 13L, 14L, 13L, 14L, 13L, 14L, 13L, 14L, 

    14L, 13L, 14L, 13L, 13L, 13L), Position = structure(c(4L, 

    1L, 1L, 2L, 3L, 3L, 2L, 3L, 1L, 1L, 1L, 2L, 4L, 3L, 2L, 3L, 

    4L, 3L, 4L, 2L, 4L, 2L, 3L, 1L, 1L, 2L, 4L, 4L, 2L, 4L, 4L, 

    2L, 1L, 4L, 1L, 1L, 2L, 4L, 3L, 1L, 4L, 1L, 2L, 3L, 3L, 1L, 

    1L, 3L, 1L, 3L, 4L, 2L, 3L, 4L, 1L, 2L, 3L, 4L, 1L, 3L, 1L, 

    2L, 2L, 2L, 4L, 4L, 2L, 4L, 2L, 3L, 3L, 4L, 4L, 1L, 1L, 1L, 

    2L, 2L, 4L, 1L, 1L, 1L, 2L, 4L, 1L, 3L, 4L, 4L, 4L, 4L, 2L, 

    2L, 2L, 1L, 1L, 4L, 1L, 4L, 2L, 2L), .Label = c("D", "F", 

    "GK", "M"), class = "factor"), Height = c(NA, NA, NA, NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 151L, NA, 

    154L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 156L, NA, 

    147L, NA, NA, NA, NA, NA, 138L, 172L, NA, NA, 150L, NA, NA, 

    NA, NA, NA, NA, NA, 140L, 153L, NA, NA, NA, NA, NA, NA, NA, 

    158L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 156L), Weight = c(63, 

    64, 36, 46, 67, 40, 25, 30, 36, 33, 61, 31, 29, 34, 47, 38, 

    32, 44, 32, 32, 30, 34, 51, 34, 28, 27, 33, 31, 28, 44, 37, 

    46, 26, 42, 32, 32, 43, 31, 72, 27, 30, 55, 53, 50, 51, 55, 

    48.6, 49, 48, 64, 35, 32, 55, 32, 50, 61, 42, 33, 37, 45, 

    45, 50, 36, 33, 49, 59, 42, 43, 35.1, 66.9, 52, 47, 40, 38, 

    45, 53, 44, 54, 39, 62, 33, 53.8, 42, 46, 39, 48, 39, 54, 

    40, 42.4, 50, 48, 46, 52, 58, 40, 46, 51, 54, 42), BMI = c(NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    21.2, NA, 20.24, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 

    NA, 18.49, NA, 16.66, NA, NA, NA, NA, NA, 18.57, 22.61, NA, 

    NA, 17.77, NA, NA, NA, NA, NA, NA, NA, 16.84, 22.86, NA, 

    NA, NA, NA, NA, NA, NA, 16.9, NA, NA, NA, NA, NA, NA, NA, 

    NA, NA, 17.26), YoYo = c(80L, 80L, 160L, 160L, 160L, 160L, 

    160L, 160L, 160L, 160L, 160L, 160L, 160L, 160L, 160L, 160L, 

    160L, 

Re: [R] Help Interpreting Linear Mixed Model

2015-04-28 Thread John Kane
You are posting in HTML and the R-help list is a plain text one. Would you 
reset to plain in your e-mail editor before posting, please?

 For security reasons R-help strips the HTML version and, we on the list,  
receive the resulting plain text.  This, often,  mangles code to the point that 
it is almost indecipherable.   

Re your question, if I understood it. Something like this should do it
 fm  <-  subset(dat1, Level =="PREMIER_LEAGUE" &  (Position ==  "F" | Position 
== "m"))

This now gives you a data.frame with only those rows that match your criteria.  
Untested since all 100 rows are CHAMPIONSHIP.  No fPREMIER_LEAGUE in your first 
100 rows of data.  I should have warned you about this but it was late and I 
didn't think through your statement about "The data set I have is quite large". 
 

Here is an example of how to do some random sampling of your data.frame, which 
I should have mentioned yesterday

http://stackoverflow.com/questions/8273313/random-rows-in-dataframe-in-r

But in any case the idea is just to subset the data and go from there.  Just 
type ?subset for help.

##   "Where "F" position are in the same AgeGr as well."

You should be able to add a AgeGr = 99 in the subset statement.

fm  <-  subset(dat1, Level =="PREMIER_LEAGUE" & AgeGr = 10 & (Position ==  "F" 
| Position == "m"))

should work. Untested and again it's almost dinner time so no guarantees.

I think that there are faster and better ways to do this but this is fairly 
basic and "relatively' self-documenting.

After that, it depends on what you want to do with the data.

I hope this helps


John Kane
Kingston ON Canada

-Original Message-
From: joshuamichaeldi...@gmail.com
Sent: Tue, 28 Apr 2015 21:26:31 +0100
To: jrkrid...@inbox.com
Subject: Re: [R] Help Interpreting Linear Mixed Model

*Edit* 

Where "F" position are in the same AgeGr as well.

Thanks,

Josh

On Tue, Apr 28, 2015 at 9:25 PM, Joshua Dixon  
wrote:

John -  Lot's of missing data for height unfortunately.  Which is needed for 
BMI calculation.  

How would I look compare very specific parts of the data, i.e. comparing YoYo 
outcomes between "F" and "M" position that are both in the PREMIER_LEAGUE Level?

Still can't figure it out!

Josh

On Tue, Apr 28, 2015 at 2:39 AM, John Kane  wrote:

 Looks great.  How come so many NA's in Height and BMI? Just no data available?

  str(dat1)
 'data.frame':   100 obs. of  8 variables:
  $ Id      : int  7451 148 10393 10200 1961 10428 10541 10012 9895 10626 ...
  $ Level   : Factor w/ 5 levels "CHAMPIONSHIP",..: 1 1 1 1 1 1 1 1 1 1 ...
  $ AgeGr   : int  14 16 10 10 13 10 10 10 10 10 ...
  $ Position: Factor w/ 4 levels "D","F","GK","M": 4 1 1 2 3 3 2 3 1 1 ...
  $ Height  : int  NA NA NA NA NA NA NA NA NA NA ...
  $ Weight  : num  63 64 36 46 67 40 25 30 36 33 ...
  $ BMI     : num  NA NA NA NA NA NA NA NA NA NA ...
  $ YoYo    : int  80 80 160 160 160 160 160 160 160 160 ...

 John Kane
 Kingston ON Canada

 -Original Message-
 From: joshuamichaeldi...@gmail.com

Sent: Mon, 27 Apr 2015 23:35:13 +0100
 To: jrkrid...@inbox.com
 Subject: Re: [R] Help Interpreting Linear Mixed Model

 Thanks John!

 This ok?

 > dput(head(data, 100))

 structure(list(Id = c(7451L, 148L, 10393L, 10200L, 1961L, 10428L, 

 10541L, 10012L, 9895L, 10626L, 1151L, 8775L, 10083L, 6217L, 90L, 

 10168L, 10291L, 8549L, 3451L, 10003L, 5907L, 10136L, 6182L, 6315L, 

 10015L, 9956L, 2040L, 4710L, 10747L, 6787L, 1222L, 10757L, 2892L, 

 117L, 10328L, 10503L, 768L, 2979L, 1961L, 10520L, 10498L, 3018L, 

 10335L, 2448L, 9027L, 362L, 8499L, 10603L, 9489L, 2124L, 707L, 

 8501L, 4908L, 9905L, 3000L, 2819L, 9973L, 10550L, 9921L, 10639L, 

 8771L, 10121L, 32L, 9935L, 9299L, 3246L, 682L, 10325L, 6741L, 

 3295L, 5270L, 727L, 8500L, 50L, 4705L, 3018L, 787L, 2953L, 1391L, 

 3682L, 7974L, 5023L, 652L, 727L, 679L, 10212L, 9488L, 9987L, 

 10039L, 5025L, 250L, 2539L, 787L, 3000L, 1151L, 8946L, 6177L, 

 3296L, 250L, 498L), Level = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = 
c("CHAMPIONSHIP", 

 "CONFERENCE", "LEAGUE_ONE", "LEAGUE_TWO", "PREMIER_LEAGUE"), class = 
"factor"), 

     AgeGr = c(14L, 16L, 10L, 10L, 13L, 10L, 10L, 10L, 10L, 10L, 

     14L, 10L, 10L, 10L, 12L, 10L, 10L, 12L, 10L, 10L, 10L, 10L, 

     12L, 10L, 10L, 10L, 10L, 10L, 10L, 15L, 10L, 10L, 10

Re: [R] help - hoslem.test

2015-04-30 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -Original Message-
> From: lutipilo...@yahoo.com.br
> Sent: Wed, 29 Apr 2015 18:45:26 -0700
> To: r-help@r-project.org
> Subject: [R] help - hoslem.test
> 
> Hello,
> 
> I'm working with ordinal logistic regression model (polr) and would like
> to test the proportional odds assumption. For this, I ran the binary
> logistic regressions with varying cutpoints on the dependent variable, as
> described in the following commands. When running the test of Hosmer and
> Lemeshow (hoslem.test) for residuals gives error.
> 
> Thanks,
> Luciane
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help - hoslem.test

2015-04-30 Thread John Kane

> -Original Message-
> From: lutipilo...@yahoo.com.br
> Sent: Thu, 30 Apr 2015 04:24:32 -0700
> To: r-help@r-project.org, jrkrid...@inbox.com
> Subject: RE: [R] help - hoslem.test
> 
> load("id3.rda")
And what is this?  

We do not have access to your office or computer hard disc.

Please read 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example,
 see ?dput for sending data?

It is very unlikely anyone here can help if we have no data.


> attach(id3)
> 
> #transformando q13 em binária
> q131<-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2,
> ifelse(q13==4,2,ifelse(q13==5,2,NA)
> id3<-cbind(id3,q131)
> id3$q131 <- as.factor(id3$q131)
> 
> tp1 <- glm(q131 ~ q11 + q10+q12+edcat + q08+q06+ q14, family =
> binomial(link = "logit"), data=id3)
> tp1
> 
> library(ResourceSelection)
> hoslem.test(tp1$q131, fitted(tp1), g=10)
> 
> dataframe: https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0
> 
> 
> __
> Luciane Maria Pilotto
> Mestre e Doutoranda em Saúde Bucal Coletiva - FO/UFRGS
> NDE Odontologia - UNIVATES
> Telefone: (51) 84512344
> 
> 
> Em qui, 30/4/15, John Kane  escreveu:
> 
>  Assunto: RE: [R] help - hoslem.test
>  Para: "Luciane Maria Pilotto" ,
> r-help@r-project.org
>  Data: Quinta-feira, 30 de Abril de 2015, 7:52
> 
>  
> http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
> 
>  John Kane
>  Kingston ON Canada
> 
> 
>  > -Original Message-
>  > From: lutipilo...@yahoo.com.br
>  > Sent: Wed, 29 Apr 2015 18:45:26 -0700
>  > To: r-help@r-project.org
>  > Subject: [R] help - hoslem.test
>  >
>  > Hello,
>  >
>  > I'm working with
>  ordinal logistic regression model (polr) and would like
>  > to test the proportional odds assumption.
>  For this, I ran the binary
>  > logistic
>  regressions with varying cutpoints on the dependent
>  variable, as
>  > described in the following
>  commands. When running the test of Hosmer and
>  > Lemeshow (hoslem.test) for residuals gives
>  error.
>  >
>  > Thanks,
>  > Luciane
>  >
>  >
>  __
>  > R-help@r-project.org
>  mailing list -- To UNSUBSCRIBE and more, see
>  > https://stat.ethz.ch/mailman/listinfo/r-help
>  > PLEASE do read the posting guide
>  > http://www.R-project.org/posting-guide.html
>  > and provide commented, minimal,
>  self-contained, reproducible code.
> 
>  
>  FREE ONLINE PHOTOSHARING - Share your photos
>  online with your friends and family!
>  Visit
>  http://www.inbox.com/photosharing to
>  find out more!


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] help - hoslem.test

2015-04-30 Thread John Kane
Kevin Thorpe pointed out to me that there is a dropbox link at the very bottom 
of the post that I missed. :(

I just downloaded it, read it in and it looks fine.  

John Kane
Kingston ON Canada


> -Original Message-
> From: petr.pi...@precheza.cz
> Sent: Thu, 30 Apr 2015 14:25:23 +
> To: lutipilo...@yahoo.com.br, r-help@r-project.org
> Subject: Re: [R] help - hoslem.test
> 
> Hi
> 
> I agree with John
> 
> Just small refinements in lines
> 
>> -Original Message-
>>> -Original Message-
>>> From: lutipilo...@yahoo.com.br
>>> Sent: Thu, 30 Apr 2015 04:24:32 -0700
>>> To: r-help@r-project.org, jrkrid...@inbox.com
>>> Subject: RE: [R] help - hoslem.test
>>> 
>>> load("id3.rda")
>> And what is this?
>> 
>> We do not have access to your office or computer hard disc.
>> 
>> Please read http://stackoverflow.com/questions/5963269/how-to-make-a-
>> great-r-reproducible-example, see ?dput for sending data?
>> 
>> It is very unlikely anyone here can help if we have no data.
>> 
>> 
>>> attach(id3)
> 
> Do not use attach. It prevents from modifiyng id3.
> 
>>> 
>>> #transformando q13 em binária
>>> q131<-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2,
>>> ifelse(q13==4,2,ifelse(q13==5,2,NA)
> 
> q131 <- as.numeric(cut(q13, c(0,1.5,5)))
> 
>> x<-1:7
>> x
> [1] 1 2 3 4 5 6 7
>> as.numeric(cut(x, c(0,1.5,5)))
> [1]  1  2  2  2  2 NA NA
> 
>>> id3<-cbind(id3,q131)
> 
> rather dangerous in case id3 is not data.frame but matrix
> 
>>> id3$q131 <- as.factor(id3$q131)
>>> 
>>> tp1 <- glm(q131 ~ q11 + q10+q12+edcat + q08+q06+ q14, family =
>>> binomial(link = "logit"), data=id3)
>>> tp1
>>> 
>>> library(ResourceSelection)
>>> hoslem.test(tp1$q131, fitted(tp1), g=10)
> 
> hoslem.test expects x to be a numeric vector of observations, binary
> (0/1).
> If I understand correctly tp1$q131 have values 1, 2 or NA.
> 
> Cheers
> Petr
> 
>>> 
>>> dataframe: https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0
>>> 
>>> 
>>> __
>>> Luciane Maria Pilotto
>>> Mestre e Doutoranda em Saúde Bucal Coletiva - FO/UFRGS
>>> NDE Odontologia - UNIVATES
>>> Telefone: (51) 84512344
>>> 
>>> 
>>> Em qui, 30/4/15, John Kane  escreveu:
>>> 
>>>  Assunto: RE: [R] help - hoslem.test
>>>  Para: "Luciane Maria Pilotto" ,
>>> r-help@r-project.org
>>>  Data: Quinta-feira, 30 de Abril de 2015, 7:52
>>> 
>>>  http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-
>> reproducible-example
>>> 
>>>  John Kane
>>>  Kingston ON Canada
>>> 
>>> 
>>>  > -Original Message-
>>>  > From: lutipilo...@yahoo.com.br
>>>  > Sent: Wed, 29 Apr 2015 18:45:26 -0700
>>>  > To: r-help@r-project.org
>>>  > Subject: [R] help - hoslem.test
>>>  >
>>>  > Hello,
>>>  >
>>>  > I'm working with
>>>  ordinal logistic regression model (polr) and would like
>>>  > to test the proportional odds assumption.
>>>  For this, I ran the binary
>>>  > logistic
>>>  regressions with varying cutpoints on the dependent
>>>  variable, as
>>>  > described in the following
>>>  commands. When running the test of Hosmer and
>>>  > Lemeshow (hoslem.test) for residuals gives
>>>  error.
>>>  >
>>>  > Thanks,
>>>  > Luciane
>>>  >
>>>  >
>>>  __
>>>  > R-help@r-project.org
>>>  mailing list -- To UNSUBSCRIBE and more, see
>>>  > https://stat.ethz.ch/mailman/listinfo/r-help
>>>  > PLEASE do read the posting guide
>>>  > http://www.R-project.org/posting-guide.html
>>>  > and provide commented, minimal,
>>>  self-contained, reproducible code.
>>> 
>>>  
>>>  FREE ONLINE PHOTOSHARING - Share your photos
>>>  online with your friends and family!
>>>  Visit
>>>  http://www.inbox.com/photosharing to
>>>  find out more!
>> 
>> 
>> FREE ONLI

Re: [R] Help with making Loop

2015-05-01 Thread John Kane
Hi Fazal,

In order to help you we probably need some sample data.  Any code you have been 
trying is also probably useful

The png is helpful but it is much better to supply the actual data or a good 
sample of it).  

The best way to supply data to R-help is to use the dput() function.  See 
?dput() for some basic information on how to use it.

In very simple terms, if you have a data set called mydata do

dput(mydata)

copy the output and paste into your e-mail. 
Done.  Fini!
This provides the R-help readers with an exact copy of your data. 

For general information about how to ask questions in R-help see 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

welcome to R-help

John Kane
Kingston ON Canada


> -Original Message-
> From: fazal.h...@curie.fr
> Sent: Fri, 1 May 2015 20:05:22 +
> To: r-help@r-project.org
> Subject: [R] Help with making Loop
> 
> Hi everyone,
> I am a real beginner to R and have probably a very naive issue. I've a
> small data frame with three columns: Unique Sample ID, Gene 1 and Gene 2
> (the columns on Gene1 and Gene2 are empty). I have two separate tables
> for the genes which contain the Unique Subject ID in one column and
> information on whether the gene is mutated or not in that particular
> subject (M, N/M) in another column called (Condition). I want to make a
> loop which can read the Unique Subject ID from my data frame, then look
> up for the same ID in the two tables and depending on whether the gene is
> mutated (M)/not mutated (N/M), inserts Yes like emoticon / No (N) in the
> appropriate gene column (Gene1/Gene2) for each Subject ID.
> If anyone can help, I would really appreciate
> Thanks in advance
> 
> Fazal,
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fwd: Question about paired plotting

2015-05-04 Thread John Kane
Hi Luis,
Ah yes, that paper.  I was rather shocked at what it implied :(  People are 
still using dynamite plots, for heaven's sake! See 
http://biostat.mc.vanderbilt.edu/wiki/Main/DynamitePlots  for some comments.
I see Jim has given you one way to do the plots you want. Here is another way 
using the ggplot2 package. You will probably have to install the package.  The 
code below covers the 2B:2D plots.
===Install ggplot2===
install.packages("ggplot2")

### plot desired graphs==
library(ggplot2)

dat1  <-  data.frame(x1  = rep("A", 4) , x2  =  rep("B", 4), y1  =  5:8,  y2  = 
10:13)

p  <-  ggplot() 
p1  <-   p +  geom_segment( aes(x = x1, y = y1, xend =  x2,  yend = y2)) +
  geom_point(aes(x1, y1, colour = "blue", size = 2)) +
  geom_point(aes(x2, y2, colour = "red", size = 2)) 
p1
  
 p2  <- p1 + theme (legend.position = "none") + 
  xlab("Treatment") + ylab("Change Score")
p2

### end==

We could have all the commands in one statement but it is easier to write the 
code this way to help in debugging (damn typos1) and so I left it to help you 
see what is happening.

For the lower plots, in ggplot2, you should have a look at geom_dotplot() . 
Here is an interesting demo of it in use.  I like the addition of the median 
line in particular.  

http://rstudio-pubs-static.s3.amazonaws.com/1406_947a49f2d7914dad8b0fd050a9df9858.html




John Kane
Kingston ON Canada


> -Original Message-
> From: luysgar...@gmail.com
> Sent: Mon, 4 May 2015 04:52:51 -0300
> To: r-help@r-project.org
> Subject: [R] Fwd: Question about paired plotting
> 
> Hello R experts,
> 
> I just found a new paper which shows the proper way (according to the
> authors) to show data, specially paired. I am very interested in
> presenting
> this kind of data, specially the scatter plott.  I have found a way to
> present it using this link:
> 
> http://journals.plos.org/plosbiology/article?id=10.1371%2Fjournal.pbio.1002128#pbio.1002128.s007
> 
> Nevertheless, I wanted to know if you know some example which allows me
> to
> produce a plot similar to the plots 2B-2D. I could do it by "hand" but it
> was quite time consuming and required editing the pictures,
> 
> Many thanks for any help you can provide!
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MOnth over Month Variance in %

2015-05-06 Thread John Kane
I think we need to know a bit about your level of knowledge of R, what the data 
currently looks like (In R format preferably) and maybe see what you have tried 
so far.  Please have a look at the following link, and pay particular attention 
to the use of dput() as a way to present data on R-help.

John Kane
Kingston ON Canada


> -Original Message-
> From: shivibha...@ymail.com
> Sent: Wed, 6 May 2015 03:21:27 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] MOnth over Month Variance in %
> 
> Hi All,
> I have data based on truck load for various states.
> The data points range from Oct'14 To Mar'15. Now I need to know what was
> the
> difference in load in Nov as compared to Oct in both real numbers as well
> as
> in %. Similarly for all the month in comparison to the previous month.
> I am able to get the desired result in excel and not sure on how to
> achieve
> the same in R.
> 
> Kindly suggest.
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/MOnth-over-Month-Variance-in-tp4706873.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Send your photos by email in seconds...
TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3
Works in all emails, instant messengers, blogs, forums and social networks.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] lm model exported from R to excel

2015-05-06 Thread John Kane
And for those of us who know close to nothing about HTML I found just now that 
under a basic print.xtable commmand we get those horrible HMTL borders that in 
Apache OpenOffice seemed impossible to remove safely.  No idea about Word--I 
have not used it in years.

I did find that adding  html.table.attributes = "border = 0" gets rid of the 
borders.  So 
So something like 

print.xtable(modtable, type = "html", html.table.attributes = "border = 0", 
file = "modtable .html") 
seems to give a reasonable  result in AOO.  At least I managed to do some 
half-decent formatting with it.

Meanwhile, back to LaTeX where the output looks beautiful. I like booktabs :)

John Kane
Kingston ON Canada


> -Original Message-
> From: dulca...@bigpond.com
> Sent: Thu, 7 May 2015 00:32:48 +1000
> To: r-help@r-project.org
> Subject: Re: [R] lm model exported from R to excel
> 
> If you know some basic html language you can jazz up the table headings
> to
> your liking by writing that before the xtable statement.
> It save having to muck around in Microsoft to fix it.
> If you are going to do a lot of it - a little study of html basics can go
> far.
> 
> I was changing the headings to what I wanted using html (although not all
> the tables were lm summaries) before the major upgrade a year or so ago
> Now things are better.
> 
> Even a title and comments in html for yourself if not available in xtable
> are helpful. I have not used xtable and html since the upgrade as I use
> latex
> 
> Duncan
> 
> -Original Message-
> From: Livia Maria Vestergaard [mailto:lves...@student.sdu.dk]
> Sent: Wednesday, 6 May 2015 22:37
> To: Duncan Mackay; R
> Subject: SV: [R] lm model exported from R to excel
> 
> Hi Duncan
> Thank you so much - it worked :)
> 
> Best
> 
> Livia
> 
> Fra: Duncan Mackay [dulca...@bigpond.com]
> Sendt: 6. maj 2015 14:26
> Til: R; Livia Maria Vestergaard
> Emne: RE: [R]  lm model exported from R to excel
> 
> Hi Livia
> 
> There are several html packages that ?could also do it
> 
> Heres a way with xtable
> 
> library(xtable)
> y = rnorm(100)
> x= rnorm(100)+rnorm(100)
> mod <- lm(y ~x)
> 
> # latex example easy view
> xtable(mod)
> 
> # html
> file.create("lm.htm")
> ff <- file("lm.htm", "a+")
> fchars <-  print(xtable(mod),type = "html")
> writeLines(paste(fchars, sep = ""), ff)
> close(ff)
> 
> You can then bring this into Microsoft as an html file
> 
> You may need to fill in some of the arguments in xtable to get the right
> border format etc
> 
> If you are doing many you can make a function to do things
> 
> Duncan
> 
> Duncan Mackay
> Department of Agronomy and Soil Science
> University of New England
> Armidale NSW 2351
> Email: home: mac...@northnet.com.au
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Livia
> Maria
> Vestergaard
> Sent: Wednesday, 6 May 2015 19:37
> To: r-help
> Subject: [R] lm model exported from R to excel
> 
> Hi all
> I all. I am wondering whether anybody know how to export an output of an
> lm
> model from R to excel in order to have excel recognize the table that
> comes
> and divide the numbers in the table into columns and rows?
> I really hope it is possible? :)
> 
> Best Livia
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Special character is graph label

2015-05-06 Thread John Kane
Also have a look at 
http://astrostatistics.psu.edu/su07/R/html/grDevices/html/plotmath.html for a 
list of terms.

Oh and it's called  Xbar or X-bar. 

John Kane
Kingston ON Canada


> -Original Message-
> From: dcarl...@tamu.edu
> Sent: Wed, 6 May 2015 16:33:01 +
> To: tacsun...@yahoo.fr, r-help@r-project.org
> Subject: Re: [R] Special character is graph label
> 
> You do this with plotmath (see the manual page, ?plotmath):
> 
>> plot(rnorm(10), rnorm(10), xlab=expression(bar(X)))
> 
> -
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77840-4352
> 
> 
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Robert U
> Sent: Wednesday, May 6, 2015 8:10 AM
> To: R-help@r-project.org
> Subject: [R] Special character is graph label
> 
> Dear R users,
> I am having issues finding a special character (and how to insert it) in
> the lab of a graph axis.
> 
> Let us say that the label of my axis is "X", i would like the X to have a
> "line" over it, indicating that it is the "mean of X values" (i don't
> even know how to properly state that in english...). Does someone
> understand, and have any idea about how to do that?
> Greetings,
> R.H
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] MOnth over Month Variance in %

2015-05-07 Thread John Kane

Sorry, I see that I forgot the link:

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example


John Kane
Kingston ON Canada


> -Original Message-
> From: shivibha...@ymail.com
> Sent: Wed, 6 May 2015 22:32:37 -0700 (PDT)
> To: r-help@r-project.org
> Subject: Re: [R] MOnth over Month Variance in %
> 
> Thanks John for the tip. I will use it and see what is the output. Also I
> will share my analysis on R & then you can advice accordingly.
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/MOnth-over-Month-Variance-in-tp4706873p4706923.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


GET FREE 5GB EMAIL - Check out spam free email with many cool features!
Visit http://www.inbox.com/email to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How does ARules in R decide on LHS and RHS??

2015-05-07 Thread John Kane
This is pretty sketchy. Perhaps some details might help.
arules is in what package?

Any code ?

Any data?

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

John Kane
Kingston ON Canada


> -Original Message-
> From: krishnakanth...@outlook.com
> Sent: Thu, 7 May 2015 11:45:29 +0530
> To: r-help@r-project.org
> Subject: [R] How does ARules in R decide on LHS and RHS??
> 
> I was trying to study arules in R and got stuck on this doubt:
> 
> How does arules code decide which column  to be in LHS and which in RHS??
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Identifying matched groups based on a rule

2015-05-07 Thread John Kane
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

You have not supplied anywhere near enough information. See the link above for 
some suggestions.

John Kane
Kingston ON Canada


> -Original Message-
> From: ajao...@gmail.com
> Sent: Thu, 7 May 2015 10:52:03 +0300
> To: r-help@r-project.org
> Subject: [R] Identifying matched groups based on a rule
> 
> Hello,
> 
> I'm trying to create a table like below for a data set representing one
> test and indexed by five categories.
> 
> Categories are grouped into a number of buckets (three in this case: A,
> B,
> C) based on the level at which the difference between groups is
> significant
> (0.05).
> 
> Category,  Group,  Mean
> 1,  A,  94.9
> 2,  A,  94.8
> 3,  A+B,  93.4
> 4,  B+C,  91.4
> 5,  C,  91.1
> 
> Is there a way to do this in R?
> 
> Thanks.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] New to R

2015-05-10 Thread John Kane
Welcome to R and the R-help list

Not oriented to finance but just general info
A good source of introductory sources is available at 
http://www.introductoryr.co.uk/R_Resources_for_Beginners.html. BTW I've never 
seen the author's book but it does look interesting. :) 

I have had a look at most of the on-line books listed and I'd say any of them 
is likely to be very helpful. I have read a good bit of the book by Daniel 
Navarro and it is a excellent intro but possibly a bit tedious if you already 
are well grounded in stats.

Pat Burn's (of The R Inferno infamy ) has a new tutorial out which looks 
interesting. It is listed in the above link (Impatient R)

My personal opinion is that An Introduction to R by W.N. Venables and D.M. 
Smith (2004) is an excellent resource but it is only an introduction if you 
already are a pretty knowledgeable stats and programming type. However, when 
you hit a problem it is one of the first places to look for help.

If you have experience with SAS or SPSS then Bob Muenchen's R FOR SAS AND SPSS 
USERS (www.et.bs.ehu.es/~etptupaf/pub/R/RforSAS&SPSSusers.pdf) also available 
in expanded hard-copy format, can be extremely useful.

A couple of very useful sites for crafting questions for R-help or Stack

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html. In fact, just following the 
instructions for preparing a decent example can lead to a solution to the 
problem.

John Kane
Kingston ON Canada


> -Original Message-
> From: chow.bo...@gmail.com
> Sent: Sun, 10 May 2015 10:44:31 +0800
> To: r-help@r-project.org
> Subject: [R] New to R
> 
> Dear R users,
> 
> I am new to R community and would like to dig into it. Would you advise
> what are the appropriate steps to do so?
> 
> I want to do a pricing of an American option as my first exercise. Can
> some experienced users give me some pointers to do so?
> 
> Thanks a lot,
> Boris
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


GET FREE 5GB EMAIL - Check out spam free email with many cool features!
Visit http://www.inbox.com/email to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] binding two lists of lists of dataframes together

2015-05-11 Thread John Kane
 http://adv-r.had.co.nz/Reproducibility.html

and please do not post in Html.


John Kane
Kingston ON Canada


> -Original Message-
> From: newrnew...@hotmail.com
> Sent: Mon, 11 May 2015 20:16:40 +
> To: r-help@r-project.org
> Subject: [R] binding two lists of lists of dataframes together
> 
>  Hi,
> I'm new to R and am stumped.  I'm trying to bind List 1 to List 2 and
> have the corresponding Output.
> 
> I've found the following code - I can't say I understand
> rbindlist(lapply(list12, "[", i, TRUE)).  Either way - it doesn't give
> exactly what's needed.
> 
> library(data.table)
> list12 <- list(List1,List2)
> nr <- as.vector(nrow(list12[[1]]))
> fastbind.ith.rows <- function(i) rbindlist(lapply(list12, "[", i, TRUE))
> fastbound <- lapply(1:nr, fastbind.ith.rows)
> 
> It produces Output 2 - where dataframes are grouped together by rownames,
> but keeps 2 separate vectors - vs. binding the two into 1 vector.
> 
> Any help/guidance would be greatly appreciated!!
> 
> Thanks!
> Vince
> 
> 
> List1List2Output (Wanted) V1V2V3 V1V2V3
> V1V2V3idc(563,623,581)c(563,623,581)c(563,623,581)idc(217,  120,
> 372)c(125,  334, 86)c(130,  349, 576)idc(563,623,581,217,  120,
> 372)c(563,623,581,125,  334, 86)c(563,623,581,130,  349, 576)wgtbandc(0,
> 0, 0, 0, 0)c(0,  0, 0, 0, 0)c(0,  0, 0, 0, 0)wgtbandc(1,  2, 3)c(1,  2,
> 3)c(1,  2, 3)wgtbandc(0,  0, 0, 0, 0,1, 2, 3)c(0,  0, 0, 0, 0,1, 2,
> 3)c(0,  0, 0, 0, 0,1, 2, 3)wgtc(0.007956164,  0.00199414, 0.009970699,
> 0.00994571, 0.011994826)c(0.007956164,  0.00199414, 0.009970699,
> 0.00994571, 0.011994826)c(0.007956164,  0.00199414, 0.009970699,
> 0.00994571, 0.011994826)wgtc(0.003565190625,  0.003565190625,
> 0.003565190625)c(0.003565190625,  0.0051497197917,
> 0.003565190625)c(0.003565190625,  0.003565190625,
> 0.0051497197917)wgtc(0.007956164,  0.00199414, 0.009970699,
> 0.00994571, 0.011994826,0.003565190625,  0.003565190625,
> 0.003565190625)c(0.007956164,  0.00199414, 0.009970699, 0.00994571,
> 0.011994826,0.003565190625,  0.0051497197917,!
>   0.003565190625)c(0.007956164,  0.00199414, 0.009970699, 0.00994571,
> 0.011994826,0.003565190625,  0.003565190625, 0.0051497197917)heldc(2,
> 2, 2, 2, 2)c(2,  2, 2, 2, 2)c(2,  2, 2, 2, 2)heldc(0,  0, 0)c(0,  0,
> 0)c(0,  0, 0)heldc(2,  2, 2, 2, 2,0, 0, 0)c(2,  2, 2, 2, 2,0, 0, 0)c(2,
> 2, 2, 2, 2,0, 0, 0)efficiencyc(765,  1660, 1539, 1377, 1452)c(765,  1660,
> 1539, 1377, 1452)c(765,  1660, 1539, 1377, 1452)efficiencyc(1292,  908,
> 1283)c(1292,  908, 1283)c(1292,  908, 1283)efficiencyc(765,  1660, 1539,
> 1377, 1452,1292, 908, 1283)c(765,  1660, 1539, 1377, 1452,1292, 908,
> 1283)c(765,  1660, 1539, 1377, 1452,1292, 908, 1283)couponc(4,  11, 16,
> 27, 48)c(4,  11, 16, 27, 48)c(4,  11, 16, 27, 48)couponc(735,  403,
> 1366)c(414,  1183, 284)c(435,  1222, 127)couponc(4,  11, 16, 27, 48,735,
> 403, 1366)c(4,  11, 16, 27, 48,414, 1183, 284)c(4,  11, 16, 27, 48,435,
> 1222, 127)
> Output2 from Sample Code
> V1V2V3idc(563,623,581)c(563,623,581)c(563,623,581)c(217, 120, 372)c(125,
> 334, 86)c(130,  349, 576)wgtbandc(0,  0, 0, 0, 0)c(0,  0, 0, 0, 0)c(0,
> 0, 0, 0, 0)c(1, 2, 3)c(1,  2, 3)c(1,  2, 3)wgtc(0.007956164,  0.00199414,
> 0.009970699, 0.00994571, 0.011994826)c(0.007956164,  0.00199414,
> 0.009970699, 0.00994571, 0.011994826)c(0.007956164,  0.00199414,
> 0.009970699, 0.00994571, 0.011994826)c(0.003565190625, 0.003565190625,
> 0.003565190625)c(0.003565190625,  0.0051497197917,
> 0.003565190625)c(0.003565190625,  0.003565190625,
> 0.0051497197917)heldc(2,  2, 2, 2, 2)c(2,  2, 2, 2, 2)c(2,  2, 2, 2,
> 2)c(0, 0, 0)c(0,  0, 0)c(0,  0, 0)efficiencyc(765,  1660, 1539, 1377,
> 1452)c(765,  1660, 1539, 1377, 1452)c(765,  1660, 1539, 1377,
> 1452)c(1292, 908, 1283)c(1292,  908, 1283)c(1292,  908, 1283)couponc(4,
> 11, 16, 27, 48)c(4,  11, 16, 27, 48)c(4,  11, 16, 27, 48)c(735, 403,
> 1366)c(414,  1183, 284)c(435,  1222, 127)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R Commander qcc

2015-05-17 Thread John Kane
Welcome to R and the R-help list.   

If I am not misunderstanding you, you expect use the qcc package from within 
the Rcmdr GUI.

I have never really used RCommander, though I played around with it a few years 
ago,   but I don't believe it can call qcc directly.  I 'think' you have the 
choice of using qcc from a command line interface or possibly installing a 
plug-in for Rcmder.  Have a look at this link 
http://decisionstats.com/2011/01/27/r-commander-plugins-20-and-growing/

BTW you might also be interested in this link 
http://blog.yhathq.com/posts/quality-control-in-r.html for other approaches to 
control charts.

While a good Gui like Rcmdr is useful you really will not get the full power of 
R with a Gui.  It can be a bit intimidating to use a command interface if you 
are not used to one but it is by far the best way.  It may not seem it but it 
is much more efficient in the longer term to go to a command-line interface. 

There is also the issue of whether there is an integration for the package and 
your Gui.  Luckily, it looks like there is a Rcmdr plugin for qcc but there are 
probably 100's, or more likely, 1000's of packages with such a plug-in and you 
cannot capitalize on them other than with a command-line approach.

You can use R by typing commands into the R-GUI (assuming you are using 
Windows) or by typing in the terminal under Linux but this does not work well. 
Most/all R users do all their writing in a text editor or Integrated 
Development Environment (IDE). There are some fierce wars over which editor or 
IDE is best. Here are a couple of links about the issue. Text Editors and IDEs 
http://r.789695.n4.nabble.com/Best-R-text-editors-td903450.html and 
http://en.wikipedia.org/wiki/R_%28programming_language%29#Editors_and_IDEs .

It's worth shopping around to see what best suits you. I have found Tinn-R very 
good when working in Windows though, recently, I have moved to Linux and to the 
IDE, RStudio and the gedit text editor with its R plug-in. A major advantage of 
Tinn-R and gedit , particularly if you are just getting started, is that they 
both have extensive code highlighting which makes it easier to find and fix 
minor syntax errors and typos. RStudio has several advantages, among other 
things, it shows what data objects you have loaded and makes saving and 
handling graphs easier .

BW one  of the obvious things I missed when first using R was  that you can 
just copy and paste code into R if you are working through an example to see 
what is happening

John Kane
Kingston ON Canada


> -Original Message-
> From: gjkr...@gmail.com
> Sent: Sat, 16 May 2015 15:39:12 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] R Commander qcc
> 
> I am completely new to R and am trying to utilize its capabilities as an
> alternative to Minitab.  I don't have any development ability at all, but
> the R Commander GUI is able to give me the functionality I need with the
> exception of control charts.  I have installed the qcc package but when I
> load the package nothing happens (it does not give me any more
> functionality
> or selection choices in Rcmdr).
> 
> I am sure there is something relatively simple that I am missing, but I
> can't figure it out.  Any help would be greatly appreciated!
> 
> -Greg
>


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparing 2 different files in R

2015-05-17 Thread John Kane
Probably but since you  have not told us anything about what you are doing it 
is difficult to say.  

You might find these links helpful 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html


John Kane
Kingston ON Canada


> -Original Message-
> From: lyl...@gmail.com
> Sent: Sun, 17 May 2015 08:32:45 +1000
> To: r-help@r-project.org
> Subject: [R] Comparing 2 different files in R
> 
> Hi,
> 
> I have multiple files that I want to compare in R. They contain SNP data
> with genotype in the 4th column, which is what I want to compare.
> 
> Is there any easy way to do this?
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Comparing 2 different files in R

2015-05-17 Thread John Kane
John Kane
Kingston ON Canada

-Original Message-
From: lyl...@gmail.com
Sent: Sun, 17 May 2015 20:56:24 +1000
To: jrkrid...@inbox.com
Subject: Re: [R] Comparing 2 different files in R
This is not an area I am going to be able to help with but we still need a lot 
more information I think.

At the moment we know nothing about the structure of the data, what you are 
trying to accomplish, in substantive terms, and what you may have tried.  As I 
say. I know nothing about the area but perhaps we need to know if all you want 
is to see if the SNP's are the same in different files, do you need summary 
stats or graphics. Come to think of it, something like a journal abstract might 
do nicely.

It may be that more knowlegeable people can recommend useful approaches or 
suggest that your type of analysis is more suitable in the Bioconductor lists.

Ideally we should see any 'minimal' code you may have written in R if any, &  
some sample data is possible. See ?dput for a handy way to provide data but we, 
 hopefully, don't need to see 8mg of data. Probably just the first few lines of 
data would do.  A command like dput(head(50)) should be enough. See ?dput 
and?head for what these are doing or have a look at the links provided earlier. 
 For various reasons dput() is about the best method available for passing data 
to a help list or forum.  

Oh and one more thing. You seem to have sent this last post in HTML. The R-help 
list is plain-text so we would ask that you send everything in plain. HTML is 
stripped away and the resulting plain text can be so close to unintelligible 
that many readers will just ignore it.
==
Thanks and sorry for being light on detail. 

I have multiple files of raw human genome SNP data. Very large - the compressed 
zip files are about 8mb large. 

On 17 May 2015 at 20:53, John Kane  wrote:

Probably but since you  have not told us anything about what you are 
doing it is difficult to say.

 You might find these links helpful 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 
[http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example]
 and http://adv-r.had.co.nz/Reproducibility.html 
[http://adv-r.had.co.nz/Reproducibility.html]

 John Kane
 Kingston ON Canada

 > -Original Message-
 > From: lyl...@gmail.com
 > Sent: Sun, 17 May 2015 08:32:45 +1000
 > To: r-help@r-project.org
 > Subject: [R] Comparing 2 different files in R
 >
 > Hi,
 >
 > I have multiple files that I want to compare in R. They contain SNP data
 > with genotype in the 4th column, which is what I want to compare.
 >
 > Is there any easy way to do this?
 >

>       [[alternative HTML version deleted]]
 >
 > __
 > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 > https://stat.ethz.ch/mailman/listinfo/r-help 
 > [https://stat.ethz.ch/mailman/listinfo/r-help]
 > PLEASE do read the posting guide
 > http://www.R-project.org/posting-guide.html 
 > [http://www.R-project.org/posting-guide.html]
 > and provide commented, minimal, self-contained, reproducible code.

 
 FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!
 Check it out at http://www.inbox.com/marineaquarium 
[http://www.inbox.com/marineaquarium]


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] R Commander qcc

2015-05-17 Thread John Kane
Thanks John,

I had not realised they were on CRAN.  Definately a great help.

John Kane
Kingston ON Canada


> -Original Message-
> From: j...@mcmaster.ca
> Sent: Sun, 17 May 2015 08:15:14 -0400
> To: jrkrid...@inbox.com, gjkr...@gmail.com
> Subject: Re: [R] R Commander qcc
> 
> Dear John and Greg,
> 
> As John says, even with the about 40 plugin packages that are on CRAN
> (the R package archive network), the Rcmdr covers only a small fraction
> of what's available in base R and the thousands of CRAN packages.
> 
> As it turns out, however, there's an Rcmdr quality-control plugin that
> may meet Greg's needs, RcmdrPlugin.qual
> <http://cran.r-project.org/web/packages/RcmdrPlugin.qual/index.html>. You
> might check that out. Install it via the command
> install.packages("RcmdrPlugin.qual") at the R > command prompt, and then
> either load it via the Rcmdr Tools menu or directly via
> library(RcmdrPlugin.qual).
> 
> More generally, the names of most Rcmdr plugins begin with
> "RcmdrPlugin.". If you go to the alphbetical CRAN packages list at
> <http://cran.r-project.org/web/packages/available_packages_by_name.html>
> and search for "RcmdrPlugin.", you'll see them. Searching for "Rcmdr"
> will turn up a few more.
> 
> I hope this helps,
>  John
> 
> ----
> John Fox, Professor
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/
> 
> 
> 
> 
> On Sun, 17 May 2015 02:51:30 -0800
>  John Kane  wrote:
>> Welcome to R and the R-help list.
>> 
>> If I am not misunderstanding you, you expect use the qcc package from
>> within the Rcmdr GUI.
>> 
>> I have never really used RCommander, though I played around with it a
>> few years ago,   but I don't believe it can call qcc directly.  I
>> 'think' you have the choice of using qcc from a command line interface
>> or possibly installing a plug-in for Rcmder.  Have a look at this link
>> http://decisionstats.com/2011/01/27/r-commander-plugins-20-and-growing/
>> 
>> BTW you might also be interested in this link
>> http://blog.yhathq.com/posts/quality-control-in-r.html for other
>> approaches to control charts.
>> 
>> While a good Gui like Rcmdr is useful you really will not get the full
>> power of R with a Gui.  It can be a bit intimidating to use a command
>> interface if you are not used to one but it is by far the best way.  It
>> may not seem it but it is much more efficient in the longer term to go
>> to a command-line interface.
>> 
>> There is also the issue of whether there is an integration for the
>> package and your Gui.  Luckily, it looks like there is a Rcmdr plugin
>> for qcc but there are probably 100's, or more likely, 1000's of packages
>> with such a plug-in and you cannot capitalize on them other than with a
>> command-line approach.
>> 
>> You can use R by typing commands into the R-GUI (assuming you are using
>> Windows) or by typing in the terminal under Linux but this does not work
>> well. Most/all R users do all their writing in a text editor or
>> Integrated Development Environment (IDE). There are some fierce wars
>> over which editor or IDE is best. Here are a couple of links about the
>> issue. Text Editors and IDEs
>> http://r.789695.n4.nabble.com/Best-R-text-editors-td903450.html and
http://en.wikipedia.org/wiki/R_%28programming_language%29#Editors_and_IDEs
>> .
>> 
>> It's worth shopping around to see what best suits you. I have found
>> Tinn-R very good when working in Windows though, recently, I have moved
>> to Linux and to the IDE, RStudio and the gedit text editor with its R
>> plug-in. A major advantage of Tinn-R and gedit , particularly if you are
>> just getting started, is that they both have extensive code highlighting
>> which makes it easier to find and fix minor syntax errors and typos.
>> RStudio has several advantages, among other things, it shows what data
>> objects you have loaded and makes saving and handling graphs easier .
>> 
>> BW one  of the obvious things I missed when first using R was  that you
>> can just copy and paste code into R if you are working through an
>> example to see what is happening
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -Original Message-
>>> From: gjkr...@gmail.com
>>> Sent: Sat, 16 May 2015 15:39:12 -0700 (PDT)
>>> To: r-help@r-project.org
>>> Subject: [R] R Commander qcc
>>> 
>>&g

Re: [R] Count number in r

2015-05-19 Thread John Kane
And another approach just for the heck of it.

library(plyr)

# where dat1 is your data 
dd1  <-  subset(dat1, Rain >= .01)

dd1$Year  <-  as.factor(dd1$Year)
dd1$Month  <-  as.factor(dd1$Month)

count (dd1, .(Year, Month))

John Kane

Kingston ON Canada


> -Original Message-
> From: hafizuddinarsha...@gmail.com
> Sent: Tue, 19 May 2015 03:10:32 -0700
> To: r-help@r-project.org
> Subject: [R] Count number in r
> 
> Dear R users,
> 
> Could someone help me on this? I have this kind of data set:
> 
> structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
> 1971L, 1971L), Month = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> 2L, 2L, 2L), Rain = c(58.9, 74.6, 17.7, 7.8, 1.2, 1, 5.3, 0.7,
> 1.2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 10.4, 17.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), .Names =
> c("Year",
> "Month", "Rain"), class = "data.frame", row.names = c(NA, -44L
> ))
> 
> I want to count data in "Rain" that is greater and equal to 0.1 mm
> according to their "Month" and "Year". I have used this code, but it
> seems
> so wrong.
> 
> raindat <- read.csv('my data set',header=TRUE)
> yearcorr<-min(raindat$Year)-1
> years<-unique(raindat$Year)
> rainmonth<-as.data.frame(matrix(0,nrow=2,ncol=12))
> for(year in years) {
>   for(month in 1:12) {
> if(any(raindat$Year==year&raindat$Month==month))
>   rainmonth[year-yearcorr,month]<-
>   length((which(raindat$Rain >=
> 0.1))[raindat$Year==year&raindat$Month==month])
>   }
> }
> rownames(rainmonth)<-years
> names(rainmonth)<-month.abb
> rainmonth
> 
> Thank you so much.
> 
> 
> Arshad
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count number in r

2015-05-19 Thread John Kane

If nothing suggested in this thread help I'd suggest asking in R-sig-Geo where 
they will be more familiar with the issues.

Please do not post in HTML. It can serious mangle code to the point it is 
indecipherable.  

John Kane
Kingston ON Canada

-Original Message-
From: johnwas...@gmail.com
Sent: Tue, 19 May 2015 18:26:35 +0200
To: jrkrid...@inbox.com
Subject: Re: [R] Count number in r

Dear all,

I am kindly requesting for help on how I can count pixels with value less and 
equal to -0.08 for a raster stack.

Thanks for your help

John

On Tue, May 19, 2015 at 5:57 PM, John Kane  wrote:

And another approach just for the heck of it.

 library(plyr)

 # where dat1 is your data
 dd1  <-  subset(dat1, Rain >= .01)

 dd1$Year  <-  as.factor(dd1$Year)
 dd1$Month  <-  as.factor(dd1$Month)

 count (dd1, .(Year, Month))

 John Kane

 Kingston ON Canada

 > -Original Message-
 > From: hafizuddinarsha...@gmail.com
 > Sent: Tue, 19 May 2015 03:10:32 -0700
 > To: r-help@r-project.org
 > Subject: [R] Count number in r
 >
 > Dear R users,
 >
 > Could someone help me on this? I have this kind of data set:
 >
 > structure(list(Year = c(1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
 > 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
 > 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
 > 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
 > 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L, 1971L,
 > 1971L, 1971L), Month = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 > 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 > 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
 > 2L, 2L, 2L), Rain = c(58.9, 74.6, 17.7, 7.8, 1.2, 1, 5.3, 0.7,
 > 1.2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 > 0, 10.4, 17.5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)), .Names =
 > c("Year",
 > "Month", "Rain"), class = "data.frame", row.names = c(NA, -44L
 > ))
 >
 > I want to count data in "Rain" that is greater and equal to 0.1 mm
 > according to their "Month" and "Year". I have used this code, but it
 > seems
 > so wrong.
 >
 > raindat <- read.csv('my data set',header=TRUE)
 > yearcorr<-min(raindat$Year)-1
 > years<-unique(raindat$Year)
 > rainmonth<-as.data.frame(matrix(0,nrow=2,ncol=12))
 > for(year in years) {
 >   for(month in 1:12) {
 >     if(any(raindat$Year==year&raindat$Month==month))
 >       rainmonth[year-yearcorr,month]<-
 >       length((which(raindat$Rain >=
 > 0.1))[raindat$Year==year&raindat$Month==month])
 >   }
 > }
 > rownames(rainmonth)<-years
 > names(rainmonth)<-month.abb
 > rainmonth
 >
 > Thank you so much.
 >
 >
 > Arshad
 >
 >       [[alternative HTML version deleted]]
 >
 > __
 > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 > https://stat.ethz.ch/mailman/listinfo/r-help 
 > [https://stat.ethz.ch/mailman/listinfo/r-help]
 > PLEASE do read the posting guide
 > http://www.R-project.org/posting-guide.html 
 > [http://www.R-project.org/posting-guide.html]
 > and provide commented, minimal, self-contained, reproducible code.


 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords & protects your account.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help 
[https://stat.ethz.ch/mailman/listinfo/r-help]
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
[http://www.R-project.org/posting-guide.html]
 and provide commented, minimal, self-contained, reproducible code.

-- 

John Wasige
"Birds born in a Cage think Flying is an illness."


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Count unchanged class attribute

2015-05-19 Thread John Kane
Is this a list of data.frames or what?

Please have a look at one or both of these for some ideas of how to ask a 
question and provide information on the problem.  The better you can describe 
what you have and what you need the better people can help.
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html


John Kane
Kingston ON Canada


> -Original Message-
> From: soe.xi...@gmail.com
> Sent: Tue, 19 May 2015 23:37:13 +0700
> To: r-help@r-project.org
> Subject: [R] Count unchanged class attribute
> 
> Maybe someone can help me.
> Suppose I have data-set like this:
> 
>   Netto   Bruto  class
> 1 10  1000yes
> 2 100 20  yes
> 
> 
>   Netto   Bruto  class
> 1 101 1000yes
> 2 100 210 no
> 
> 
>   Netto   Bruto  class
> 1 10  10  yes
> 2 12  28  yes
> 3 100 20  yes
> 
>   Netto   Bruto  class
> 1 120 200 no
> 2 400 20  yes
> 
> 
>   Netto   Bruto  class
> 1 110 12000   yes
> 2 1100120 yes
> 3 120 100 yes
> 4 1140125 yes
> 
> How to calculate the number of classes has changed.
> The expected result is
> - class changed2
> - class unchanged  3
> 
> 
> Thank you so much.
> Soe Xiyan
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Count unchanged class attribute

2015-05-19 Thread John Kane
John Kane
Kingston ON Canada

-Original Message-
From: gunter.ber...@gene.com
Sent: Tue, 19 May 2015 20:04:58 -0700
To: jrkrid...@inbox.com
Subject: Re: [R] Count unchanged class attribute

Probably "or what."

This demonstrates a fundamental conundrum: many users or prospective users of R 
have had little exposure to data structures in their formal education and 
therefore can be flummoxed by R's fussiness -- as any programming language must 
necessarily be. Consider: data frames, matrices, lists, "classes", objects with 
attributes (e.g. factors),...
==
Nonsense, I am sure that weird feeling that my brain was being wrung out like a 
dishcloth, that I felt for the first 3-5 weeks was due to something I ate and 
had nothing to due with SPSS or SAS.



===


Excel, which is basically structureless, of course, exacerbates the problem. 
Those accustomed to its tolerance (and the confusion that results) expect R to 
behave the same way. Education is the only recourse, either in formal courses 
or through R tutorials that strongly emphasize this aspect of interacting with 
R and especially writing effective code. But that demands effort and, to some 
extent, aptitude... both of which seem to be in increasingly short supply 
amidst the worldwide explosion in R's usage.

I don't think it's lack of aptitude but  I seldom see much in the various 
tutorials and books that really emphasis data structures or typing so people 
can spend a lot of time figuring out what a list is. Who, me?

I agree that Excel is scary. I believe I mentioned before that I live in fear 
that some medical spreadsheet will calculate a medical dose on my telephone 
number rather than my weight.  Of course, Excel being Excel, it would probably 
obligingly translate a character-formatted telephone number into a real number. 
I must try this the next time I get close to a machine with Excel.  
===
Of course, feel free to disagree... Just my $.02

Cheers,

Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge is 
certainly not wisdom."
Clifford Stoll

On Tue, May 19, 2015 at 7:02 PM, John Kane  wrote:

Is this a list of data.frames or what?

 Please have a look at one or both of these for some ideas of how to ask a 
question and provide information on the problem.  The better you can describe 
what you have and what you need the better people can help.
 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 
[http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example]
 and http://adv-r.had.co.nz/Reproducibility.html 
[http://adv-r.had.co.nz/Reproducibility.html]

 John Kane
 Kingston ON Canada

 > -Original Message-
 > From: soe.xi...@gmail.com
 > Sent: Tue, 19 May 2015 23:37:13 +0700
 > To: r-help@r-project.org
 > Subject: [R] Count unchanged class attribute
 >
 > Maybe someone can help me.
 > Suppose I have data-set like this:
 >
 >   Netto   Bruto  class
 > 1 10      1000    yes
 > 2 100     20      yes
 >
 >
 >   Netto   Bruto  class
 > 1 101     1000    yes
 > 2 100     210     no
 >
 >
 >   Netto   Bruto  class
 > 1 10      10      yes
 > 2 12      28      yes
 > 3 100     20      yes
 >
 >   Netto   Bruto  class
 > 1 120     200     no
 > 2 400     20      yes
 >
 >
 >   Netto   Bruto  class
 > 1 110     12000   yes
 > 2 1100    120     yes
 > 3 120     100     yes
 > 4 1140    125     yes
 >
 > How to calculate the number of classes has changed.
 > The expected result is
 > - class changed    2
 > - class unchanged  3
 >
 >
 > Thank you so much.
 > Soe Xiyan
 >
 >       [[alternative HTML version deleted]]
 >
 > __
 > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 > https://stat.ethz.ch/mailman/listinfo/r-help 
 > [https://stat.ethz.ch/mailman/listinfo/r-help]
 > PLEASE do read the posting guide
 > http://www.R-project.org/posting-guide.html 
 > [http://www.R-project.org/posting-guide.html]
 > and provide commented, minimal, self-contained, reproducible code.

 
 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords & protects your account.

 __
 R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
 https://stat.ethz.ch/mailman/listinfo/r-help 
[https://stat.ethz.ch/mailman/listinfo/r-help]
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 
[http://www.R-project.org/post

Re: [R] Vincentizing Reaction Time data in R

2015-05-20 Thread John Kane
John Kane
Kingston ON Canada

> -Original Message-
> From: john.archie.mck...@gmail.com
> Sent: Wed, 20 May 2015 09:38:47 -0500
> To: gabriel.wein...@gmail.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL
> 
> wrote:
> 
>> Dear all,
>> 
>> For my master thesis, I'm currently working in cognitive neuroscience on
>> executive control through measurement of reaction time and I need to get
>> my
>> data 'vincentized' with an exclusive use of R set by my statistic
>> teacher
>> for a test purpose, for this reason I can't use the python code the lab
>> team usually uses.
>> Despite a dozen hours of research I couldn't find any package or R-code
>> which would allow the use of vincentization, that's why I'm querying
>> help
>> on the R forum.
>> 
>> So has anyone ever used vincentization in R ?
>> 
> 
> I haven't. And I failed statistics in school. But a Google search got me
> to
> this page, which I hope might be of some help to you. If not, my
> apologies.
> 
> https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html 
> [https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]
I never heard of it either and I passed a couple out of some number > 2 but we 
always thought the perception and cognition people strange.
I think this paper may be a lead. An email to the authors might help
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/ 
[http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]
>

>> Gabriel Weindel
>> Master student in Neuropsychology - Aix-Marseille University (France)


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vincentizing Reaction Time data in R

2015-05-20 Thread John Kane


> -Original Message-
> From: gabriel.wein...@gmail.com
> Sent: Wed, 20 May 2015 22:31:48 +0200
> To: jrkrid...@inbox.com, john.archie.mck...@gmail.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> John Kane : I already read the paper and wrote an e-mail to the author,
> he used matlab and suggested me to ask this same question on this forum.
> But thank you for your answer.

The paper said that they had used R !  They must have forgotten to add what may 
have been a minor bit of use of mintabl

I had a look at the equation in the Wiki article and I have long ago forgotten 
how to read such a thing but I wonder how complicated it is as an algorithm?  R 
is very flexible and it might be fairly easy to just write a function to do it. 

Actually I just had a very quick look at the Ratcliff paper in Psychological 
Bulletin 1979, Vol. 86, No. 3, 446-461 
(http://star.psy.ohio-state.edu/coglab/People/roger/pdf/Papers/psychbull79.pdf)

I am tired and it is not my area of expertise but it does not look too 
difficult to write a function in R to do this. But I have been wrong before. :)

> 
> John McKown : thanks a lot, this could be a great help to me but I have
> to take a closer look.
> 
> Again thank you for your replies.
> 
> Regards,
> 
> --
> Gabriel Weindel
> Master student in Neuropsychology - Aix-Marseille University (France)
> 
> 
> 
> Le 20/05/2015 18:41, John Kane a écrit :
>> John Kane
>> Kingston ON Canada
>> 
>>> -Original Message-
>>> From: john.archie.mck...@gmail.com
>>> Sent: Wed, 20 May 2015 09:38:47 -0500
>>> To: gabriel.wein...@gmail.com
>>> Subject: Re: [R] Vincentizing Reaction Time data in R
>>> 
>>> On Wed, May 20, 2015 at 5:13 AM, Gabriel WEINDEL
>>> 
>>> wrote:
>>> 
>>>> Dear all,
>>>> 
>>>> For my master thesis, I'm currently working in cognitive neuroscience
>>>> on
>>>> executive control through measurement of reaction time and I need to
>>>> get
>>>> my
>>>> data 'vincentized' with an exclusive use of R set by my statistic
>>>> teacher
>>>> for a test purpose, for this reason I can't use the python code the
>>>> lab
>>>> team usually uses.
>>>> Despite a dozen hours of research I couldn't find any package or
>>>> R-code
>>>> which would allow the use of vincentization, that's why I'm querying
>>>> help
>>>> on the R forum.
>>>> 
>>>> So has anyone ever used vincentization in R ?
>>>> 
>>> 
>>> I haven't. And I failed statistics in school. But a Google search got
>>> me
>>> to
>>> this page, which I hope might be of some help to you. If not, my
>>> apologies.
>>> 
>>> https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html
>>> [https://stat.ethz.ch/pipermail/r-help/2003-May/034272.html]
>> I never heard of it either and I passed a couple out of some number > 2
>> but we always thought the perception and cognition people strange.
>> I think this paper may be a lead. An email to the authors might help
>> http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/
>> [http://www.ncbi.nlm.nih.gov/pmc/articles/PMC4017132/]
>>> 
>> 
>>>> Gabriel Weindel
>>>> Master student in Neuropsychology - Aix-Marseille University (France)
>> 
>> 
>> FREE ONLINE PHOTOSHARING - Share your photos online with your friends
>> and family!
>> Visit http://www.inbox.com/photosharing to find out more!
>> 
>>


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Vincentizing Reaction Time data in R

2015-05-21 Thread John Kane
In line

John Kane
Kingston ON Canada


> -Original Message-
> From: yishinlin...@gmail.com
> Sent: Thu, 21 May 2015 10:13:54 +0800
> To: gabriel.wein...@gmail.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> On Wed, 20 May 2015 18:13:17 +0800,
> Hi Gabriel,
> 
> As far as I could recall, there isn't an R package that has explicitly
> implemented "vincentization". You definitively can find some code
> segments/functions that have implemented "vincentize" on the web. But you
> should verify if they do exactly what you wish to do.  If you could look
> at the question from percentile/quantle perspective, it would not take
> you too much time to realise that they are similar.  I would suggest you
> to read, as John Kane suggested, Prof. Ratcliff's 1979 paper.  Another
> paper that may be very helpful is Prof van Zandt's 2000 RT paper.
> 
> However, you should be aware that there are some different implementation
> of "vincentization", and it is debatable, if not problematic, to use it,
> rather than other more general quantile methods. It would help you to
> understand not only how to do vincentization, but also why/why not if you
> could read papers from Jeff Rouder's as well as from Heathcote's and
> Brown's lab.
> 
> Sorry that I hesitate to give you the code, because this looks like part
> of your course works.  It would be more rewarding for you, if you could
> figure out by yourself.
> 
> Yishin
> 
While I agree the exercise is likely to be a good learning experience I don't 
see this as the equivalent of course work. 

If Gabriel (the OP) was tasked with implementing  "vincentization" in R then, 
strictly speaking it is course work but if I understand him the requirement is 
to do his work in R rather than Minitab.  If such a function existed in an 
existing R package than he could have simply plugged in the numbers et voilà, 
done.

The tenor of the question did not suggest this and it would require the stats 
instructor to know that there was no  "vincentization" function anywhere among 
the, what, a thousand or so packages? And if the OP was working on his own data 
as part of the course then the instructor might have little or no idea of 
exactly what functions are needed

The course  strikes me more as an effort to get psychologists away from SPSS 
which often seems to be the only software package anyone knows.


> Gabriel WEINDEL wrote:
>> 
>> Dear all,
>> 
>> For my master thesis, I'm currently working in cognitive neuroscience
>> on executive control through measurement of reaction time and I need
>> to get my data 'vincentized' with an exclusive use of R set by my
>> statistic teacher for a test purpose, for this reason I can't use the
>> python code the lab team usually uses.
>> Despite a dozen hours of research I couldn't find any package or
>> R-code which would allow the use of vincentization, that's why I'm
>> querying help on the R forum.
>> 
>> So has anyone ever used vincentization in R ?
>> 
>> Best regards,
>> 
>> --
>> Gabriel Weindel
>> Master student in Neuropsychology - Aix-Marseille University (France)
>>


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Vincentizing Reaction Time data in R

2015-05-22 Thread John Kane
Hi, Gabriel,

Do I  understand the idea behind 'vincentizing' reaction times? 
I don't want to work through the Ratcliff, (1979)  paper unless I must.

Let's say we have a subject , s1, with 50 rt scores.
We sort the scores from high to low (or low to high , it makes no difference) 
then we split the 50 scores into quantiles (let's say deciles) and calculate 
the mean/decile?   

Repeat for each subject.  We now have the 'vincentized' means. 

That's it? 

Example, of what I understand for just for one subject (s1)

# install plyr package if not already installed
install.packages("plyr")
#===

library(plyr)

# create some sciency looking sample data
rtmatter   <- c (seq(0.50 , 1.50, 0.01), seq(0.55, 1.55,  0.01) )
str(rtmatter)  # verify it looks sciencey 

# create one subject
s1  <-  sample(rtmatter, 50, replace = TRUE)

# calculate 'vincentized' means for s1
s1  <-  sort(s1)
c1  <-  cut(s1, 10, right = TRUE)
ss1  <-  data.frame(c1,  s1)
vince1   <-   ddply(ss1, .(c1), summarize, decile.mean = mean(s1) )
vince1


John Kane
Kingston ON Canada


> -Original Message-
> From: gabriel.wein...@gmail.com
> Sent: Thu, 21 May 2015 17:50:02 +0200
> To: jrkrid...@inbox.com, yishinlin...@gmail.com, gunter.ber...@gene.com,
> djnordl...@frontier.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> Bert : Thank you for your advice, it would be a little bit difficult to
> do it for my master thesis but, if I want to go further with a PhD
> thesis (and I do want), I would probably follow your advice and get in
> touch with a statistician.
> 
> Yishin : Thank you very much for the references, I will definitively
> read the papers you quote. I'm already a little bit aware of the misuses
> possible with the vincentization in particular thanks to the paper of
> Rouder and Speckman (2004) and it seems to fit with my design. No
> problem if you want to keep the code but I have to tell you that it's
> our first semester using R and the teacher surely didn't thought that we
> will run out of available code with our experiment. Like John guessed
> the purpose of the course was to give a first view of R to get over the
> temptation of SPSS, my bad if I want to avoid biased statistics like
> sample mean ANOVA's on RT.
> 
> Dan : Thank you for your tip, this sure will help but I'm quiet at the
> beginning of my R skills so I hardly trust myself to do it on my own,
> but I can sure give it a try.
> 
> John : I had the same assumption but my research director warned me that
> I might run out of time for my first presentation by doing so but fairly
> enough for my master thesis. But again like I said to Dan I'm quiet
> concerned by my actual R skill.
> 
> Anyway I have to say that I'm really glad to see how much help you can
> get by using the r-help mailing-list.
> 
> Regards,
> Gabriel
> 
> Le 21/05/2015 15:52, John Kane a écrit :
>> In line
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -Original Message-
>>> From: yishinlin...@gmail.com
>>> Sent: Thu, 21 May 2015 10:13:54 +0800
>>> To: gabriel.wein...@gmail.com
>>> Subject: Re: [R] Vincentizing Reaction Time data in R
>>> 
>>> On Wed, 20 May 2015 18:13:17 +0800,
>>> Hi Gabriel,
>>> 
>>> As far as I could recall, there isn't an R package that has explicitly
>>> implemented "vincentization". You definitively can find some code
>>> segments/functions that have implemented "vincentize" on the web. But
>>> you
>>> should verify if they do exactly what you wish to do.  If you could
>>> look
>>> at the question from percentile/quantle perspective, it would not take
>>> you too much time to realise that they are similar.  I would suggest
>>> you
>>> to read, as John Kane suggested, Prof. Ratcliff's 1979 paper.  Another
>>> paper that may be very helpful is Prof van Zandt's 2000 RT paper.
>>> 
>>> However, you should be aware that there are some different
>>> implementation
>>> of "vincentization", and it is debatable, if not problematic, to use
>>> it,
>>> rather than other more general quantile methods. It would help you to
>>> understand not only how to do vincentization, but also why/why not if
>>> you
>>> could read papers from Jeff Rouder's as well as from Heathcote's and
>>> Brown's lab.
>>> 
>>> Sorry that I hesitate to give you the code, because this looks like
>>> part
>>> of your course wo

Re: [R] error message

2015-05-22 Thread John Kane
I think we need a couple of things. First we need your post in text not hmtl.  
R-help removes the html as a security feature and it turns your post into a 
complete mess. See below.

Second we probably need more information and some data.  Please read one or 
both of these 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html

Welcome to the R-help list

John Kane
Kingston ON Canada


> -Original Message-
> From: catarinaramosm...@gmail.com
> Sent: Fri, 22 May 2015 18:08:13 +0100
> To: r-help@r-project.org
> Subject: [R] error message
> 
> Hi
> Can you please help me :(
> 
> I am trying to fit a multilevel model but I have received the following
> message
> 
> skate.3 <- bugs (skate.data, inits=NULL, skate.parameters,
> "skates.bug",+  n.chains=2, n.iter=500, +
> bugs.directory="c:/ProgramFiles(x86)/OpenBUGS/OpenBUGS323",+
>   program=c("OpenBUGS"))model is syntactically correctexpected
> variable name error pos 5 (error on line 1)variable n is not
> definedmodel must be compiled before generating initial valuesSampling
> has been started ...model must be initialized before updatingmodel
> must be initialized before DIC can be monitoredError in
> BRugs::samplesSet(parametersToSave) :
>   model must be initialized before monitors used
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Debian Rcmdr misses sem leaps etc

2015-05-22 Thread John Kane
On Ubuntu I just let R install new packages  wherever it wants.  

Is R on Jesse suggesting a spot?  If so, go with it.

John Kane
Kingston ON Canada


> -Original Message-
> From: peter_van_summe...@hotmail.com
> Sent: Fri, 22 May 2015 16:00:41 +0200
> To: r-help@r-project.org
> Subject: [R] Debian Rcmdr misses sem leaps etc
> 
> Hello,when I start up Rcmdr under Jessie Debian I get the message that
> there are packages missing:sem, markdown, leaps, knitr, aplpackIt then
> wants to get these from cran. But first I have to tell where to put them:
> I HAVE NO IDEA.I downloaded Rcmdr via a package program.Can anyone help
> me to get a good Rcmdr?with friendly greetings,Peter
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] data.table cant find function melt?

2015-05-22 Thread John Kane
Hi Ken,

This is strange but look at the example at ?melt , pick the data.table example 
not the reshape2 example.

It looks to me like data.table is using the reshape2 melt() 

Perhaps data.table used to load reshape2 but now you need to do it explicitly, 
or at least that's my guess.

John Kane
Kingston ON Canada


> -Original Message-
> From: knuss...@mac.com
> Sent: Fri, 22 May 2015 10:26:03 -0700
> To: r-help@r-project.org
> Subject: [R] data.table cant find function melt?
> 
> Hi all, trying to use the melt function in data.table and I'm getting an
> error
> 
> Anyone seen this before or know how to fix it?
> 
> Thanks
> 
> str(Distdata)
> 
> Classes ‘data.table’ and 'data.frame':828451 obs. of  3 variables:
>  $ Poly1   : int  50088 50088 50088 50088 50088 50088 50088 50088 50088
> 50088 ...
>  $ Poly2   : int  44884 11542 11543 11540 11541 11546 11547 11544 11545
> 11548 ...
>  $ Distance: int  788641 3794345 3652511 3915074 3895469 3639175 3644151
> 3648356 3646023 3615863 ...
>  - attr(*, ".internal.selfref")=
> 
> 
> 
> melt.data.table(Distdata, id.vars=Poly1, measure.vars=Poly2)
> 
> Error: could not find function "melt.data.table"
> 
> melt(Distdata, id.vars=Poly1, measure.vars=Poly2)
> 
> Error: could not find function "melt"]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Problem with comparing multiple data sets

2015-05-23 Thread John Kane
Hi Mohammad 

Welcome to the R-help list.

There probably is a fairly easy way to what you want but I think we probably 
need a bit more background information on what you are trying to achieve.  I 
know I'm not exactly clear on your decision rule(s). 

It would also be very useful to see some actual sample data in useable R 
format.Have a look at these links 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html for some hints on what you 
might want to include in your question.

In particular, read up about dput()  in those links and/or see ?dput.  This is 
the generally preferred way to supply sample or illustrative data to the R-help 
list.  It basically creates a perfect copy of the data as it exists on 'your' 
machine so that R-help readers see exactly what you do.  







John Kane
Kingston ON Canada


> -Original Message-
> From: mxalimoha...@ualr.edu
> Sent: Fri, 22 May 2015 12:37:50 -0500
> To: r-help@r-project.org
> Subject: [R] Problem with comparing multiple data sets
> 
> Hi everyone,
> 
> I am very new to R and I have a task to do. I appreciate any help. I have
> 3
> data sets. Each data set has 4 columns. For example:
> 
> Class  Comment   Term   Text
> 0   com1aactext1
> 2   com2aaxtext2
> 1   com3vvxtext3
> 
> Now I need t compare the class section between 3 data sets and assign the
> most available class to that text. For example if text1 is assigned to
> class 0 in data set 1&2 but assigned as 2 in data set 3 then it should be
> assigned to class 0. If they are all the same so the class will be the
> same. The ideal thing would be to keep the same format and just update
> the
> class. Is there any easy way to do this?
> 
> Thanks a lot.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R programming

2015-05-23 Thread John Kane
Read R-help. :) Seriously, you will see all kinds of problems and questions. 
Some of the simpler ones you can try yourself and see how your approach matches 
other peoples. 

Google around for some R blogs and see if you find any that are useful. 
https://learnr.wordpress.com/ might be useful. IIRC there is a mixture of real 
intro and very sophisticated material there.

Think of something simple exercise or analysis that you would normally do in 
Matlab or even in a spreadsheet and see how easily you can translate this to R. 
If needed think more of what you would expect students in first year to be 
doing if you are a TA and duplicate it in R. 

A great intro to R, in my opinion is Dan Navarro's book (available as a pdf at 
my last look) but I suspect from your point of view not so good as he is a 
psychologist and is writing for them. 
http://health.adelaide.edu.au/psychology/ccs/docs/lsr/lsr-0.3.pdf

With your educational background An Introduction to R may be a good read but, 
as a non-techie, my normal advise is not to read it right away. It is a 
fantastic reference and repays reading after a few weeks into R but it is IMHO 
emphatically NOT an introduction in the same way that the Navarro book is. (I 
am now changing my name and entering a witness protection program).

Learn as much as possible about the various basic data structures in R.  As 
someone said use str() a lot.  Here is an example why. Just copy and paste:
dat1  <- structure(list(aa = structure(1:10, .Label = c("1", "2", "3", 
"4", "5", "6", "7", "8", "9", "10"), class = "factor"), bb = c(10L, 
9L, 8L, 7L, 6L, 5L, 4L, 3L, 2L, 1L)), .Names = c("aa", "bb"), row.names = c(NA, 
-10L), class = "data.frame")

dat2  <-  structure(list(aa = 1:10, bb = c(10L, 9L, 8L, 7L, 6L, 5L, 4L, 
3L, 2L, 1L)), .Names = c("aa", "bb"), row.names = c(NA, -10L), class = 
"data.frame")

dat1
dat2  # looks a lot like dat1 :)


with(dat1, aa*bb)
with(dat2 , aa*bb)

str(dat1)
str(dat2)


BTW dat1 and dat2 are in dput() format which is the preferred way to supply 
data to the R-help list.  It provides a perfect copy of the data as it sits on 
your machine and avoids little problems like we see in dat1 vs dat2 if other 
readers are loading data on their machines.

If the course has not already recommended this, get a good dedicatd R text 
editor or IDE.  Everyone has their own, but some popular ones seem to be 
Tinn-R, EMACS, RStudio, and there are many others.

John Kane
Kingston ON Canada

PS: Don't post in HTML. it mangles code.


> -Original Message-
> From: varun1...@gmail.com
> Sent: Fri, 22 May 2015 19:01:12 -0400
> To: r-help@r-project.org
> Subject: [R] R programming
> 
> Hello there,
> 
> I wanted to learn R programming over this summer hence I registered for
> the
> R programming course on Coursera. I understood most part of the lecture
> but
> I'm having a hard time with the assignments.
> 
> Till now I can write small functions such as calculating mean of a vector
> or an array. I can also use arguments such as lapply, sapply, rbind etc.
> 
> I am not very handy with coding in R. I get completely stuck.
> 
> What should I do to learn gradually?
> 
> Can anyone tell me what to do step by step. I'm an average student
> pursuing
> my masters in Engineering Management at UNC Charlotte.
> 
>   [[alternative HTML version deleted]]
>


Publish your photos in seconds for FREE
TRY IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if4

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Stepwise rQTL-unknown warning message and odd QTL curve

2015-05-23 Thread John Kane

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html

John Kane
Kingston ON Canada


> -Original Message-
> From: lig...@statistik.tu-dortmund.de
> Sent: Sat, 23 May 2015 09:36:15 +0200
> To: claire.oq...@uky.edu, r-help@r-project.org
> Subject: Re: [R] Stepwise rQTL-unknown warning message and odd QTL curve
> 
> 
> 
> On 23.05.2015 01:07, Claire O'Quin wrote:
>> Hi There,
>> 
>> I am running a stepwise QTL for a backcross and got the following
>> warning
>> message:
>> 
>> Warning message:
>> In lastout[[i]] - (max(lastout[[i]]) - dropresult[rn == qn[i], 3]) :
>>longer object length is not a multiple of shorter object length
> 
> So dimensions of the arguments may not match?
>> 
>> I can not discern what this means. When I created my plot, the QTL curve
>> on
>> chromosome 3 is very odd (tried attaching it), so I suspect that the
>> warning is connected to that odd curve plot.
>> 
>> I tried running the fitqtl just to see what would happen and got an
>> error
>> (Error in solve.default(t(Z) %*% Z, t(Z) %*% X) : system is
>> computationally
>> singular: reciprocal condition number = 1.49755e-24).
>> 
>> Any thoughts about what is going on?
> 
> No, without knoing what the arguments and the actual code was.
> 
> Best,
> Uwe Ligges
> 
>> 
>> Thank you,
>> Claire
>> 
>> 
>> 
>> ---
>> Claire O'Quin, PhD
>> Postdoctoral Research Scholar
>> University of Kentucky
>> http://www.linnenlab.com/home.html
>> 
>> 
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Looking for help finding a wrapper/package to use TA-Lib in R

2015-05-23 Thread John Kane
"We all know the power and usefulness of TA-Lib. "

Well no, I've never even heard of it before. Can you give us a link or 
something?  
John Kane
Kingston ON Canada


> -Original Message-
> From: c_c_ribe...@hotmail.com
> Sent: Sat, 23 May 2015 17:13:15 +0200
> To: r-help@r-project.org
> Subject: [R] Looking for help finding a wrapper/package to use TA-Lib in
> R
> 
> Dear members,
> 
> We all know the power and usefulness of TA-Lib. There is a python wrapper
> for it but, despite all my searching, I am unable to find it for R. Does
> anyone know why? I am starting learning and using RStudio and would
> really like to be able to call the TA-Lib functions from RStudio. Does
> anyone know where I can find an R wrapper or any other alternative?
> 
> Many thanks.
> Claudio
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Stepwise rQTL-unknown warning message and odd QTL curve

2015-05-23 Thread John Kane
Hi Clare,
I suspect that we need to see some data in dput() format.  See the links I sent 
earlier or have a look at ?dput for more information.

John Kane
Kingston ON Canada


> -Original Message-
> From: claire.oq...@uky.edu
> Sent: Sat, 23 May 2015 07:40:03 -0400
> To: lig...@statistik.tu-dortmund.de
> Subject: Re: [R] Stepwise rQTL-unknown warning message and odd QTL curve
> 
> Sorry, I'll try to provide more detail about what I have done so far with
> code and any relevant output results.
> 
> >library(qtl)
> >sawfly.cross <- read.cross(format="csv",
> file="~/Desktop/Sawfly_data/QTL/Sawfly_QTL.csv", na.strings="NA",
> genotypes=c("A", "B"), alleles=c("A", "B"), estimate.map=F)
> --Read the following data:
>  430  individuals
>  506  markers
>  19  phenotypes
>  --Cross type: bc
> 
> >print(sawfly.cross)
> --This is an object of class "cross".
>   It is too complex to print, so we provide just this summary.
> Backcross
> 
> No. individuals:430
> 
> No. phenotypes: 19
> Percent phenotyped: 99.8 99.8 99.3 99.1 99.1 99.1 99.1 99.1 99.5 99.8
> 99.8 99.5 98.8 99.8 99.8 99.8 99.8 98.4 99.5
> 
> No. chromosomes:7
> Autosomes:  1 2 3 4 5 6 7
> 
> Total markers:  506
> No. markers:103 89 75 74 65 51 49
> Percent genotyped:  96.2
> Genotypes (%):  AA:49.7  AB:50.3
> Backcross
> 
> No. individuals:430
> 
> No. phenotypes: 19
> Percent phenotyped: 99.8 99.8 99.3 99.1 99.1 99.1 99.1 99.1 99.5 99.8
> 99.8 99.5 98.8 99.8 99.8 99.8 99.8 98.4 99.5
> 
> No. chromosomes:7
> Autosomes:  1 2 3 4 5 6 7
> 
> Total markers:  506
> No. markers:103 89 75 74 65 51 49
> Percent genotyped:  96.2
> Genotypes (%):  AA:49.7  AB:50.3
> 
> >sawfly.cross <- calc.genoprob(sawfly.cross, step=2.5, error.prob=0.1,
> map.function="kosambi", stepwidth="fixed")
> 
> **I am using head size as a covariant.**
> 
> >head.covar <- pull.pheno(sawfly.cross, pheno.col=19)
> >sawfly.cross.stepwise.peryellow <- scantwo(sawfly.cross, pheno.col=2,
> model="normal", method="hk", addcovar=head.covar, use="all.obs",
> clean.output=F, verbose=T, n.perm=1000, batchsize=100);
> save.image("~/Desktop/Sawfly_data/QTL/SawflyQTL.RData")
> --Warning messages:
> 1: In checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata,  :
>   Dropping 1 individuals with missing phenotypes.
> 
> 2: In checkcovar(cross, pheno.col, addcovar, intcovar, perm.strata,  :
>   Dropping 1 individuals with missing covariates.
> 
>> sawfly.cross.stepwise.peryellow.pen <- calc.penalties(alpha=0.05,
> perms=sawfly.cross.stepwise.peryellow)
> 
>>> sawfly.cross.stepwise.peryellow.stepqtl <- stepwiseqtl(sawfly.cross,
> pheno.col=2, method="hk", max.qtl=10,
> penalties=sawfly.cross.stepwise.peryellow.pen , verbose=T,
> keeplodprofile=T, covar=head.covar, scan.pairs=F, keeptrace=T)
> --Error in covar[!hasmissing, , drop = FALSE] : incorrect number of
> dimensions
> 
> **I corrected this with the next piece of code
> 
> >sawfly.cross.stepwise.peryellow.stepqtl <- stepwiseqtl(sawfly.cross,
> pheno.col=2, method="hk", max.qtl=10,
> penalties=sawfly.cross.stepwise.peryellow.pen , verbose=T,
> keeplodprofile=T, covar=as.data.frame(sawfly.cross$pheno$Head.Area),
> scan.pairs=F, keeptrace=T)
> 
> The stepwise than ran and I got to the point where I got the warning
> message I posted
> 
> about:Warning message:
> In lastout[[i]] - (max(lastout[[i]]) - dropresult[rn == qn[i], 3]) :
>   longer object length is not a multiple of shorter object length
> 
> I proceeded to examine the output
> 
> >sawfly.cross.stepwise.peryellow.stepqtl
>   QTL object containing genotype probabilities.
> 
>   name chrpos n.gen
> Q1 1@106.1   1 106.11 2
> Q2 2@180.0   2 179.97 2
> Q3 3@181.9   3 181.91 2
> Q4 3@181.9   3 181.91 2
> Q5 5@142.5   5 142.50 2
> 
>   Formula: y ~ sawfly.cross$pheno$Head.Area + Q1 + Q2 + Q3 + Q4 + Q5 +
> Q4:Q5
> 
>   pLOD:  166.23
> 
> 
> In my late night of googling, I did see that the warning can indicate
> that
> dimensions of the arguments do not match, but I do not know how to
> translate that to my data or output.
> 
> Thank you.
> 
> On Sat, May 23, 2015 at 3:36 AM, Uwe Ligges
> > wrote:
> 
>> 
>> 
>> On 23.05.2015 01:07, Claire O'Quin wrote:
>>> Hi There,
>>> 
>>> I am 

Re: [R] Looking for help finding a wrapper/package to use TA-Lib in R

2015-05-23 Thread John Kane
Terribly uninformative web-site but it does give us some idea. Thanks

John Kane
Kingston ON Canada


> -Original Message-
> From: c_c_ribe...@hotmail.com
> Sent: Sat, 23 May 2015 19:50:26 +0200
> To: jrkrid...@inbox.com
> Subject: Re: [R] Looking for help finding a wrapper/package to use TA-Lib
> in R
> 
> Apologies. I assumed it was widely known. My mistake. The link is
> www.ta-lib.org
> 
> 
> 
> 
>> On May 23, 2015, at 5:57 PM, John Kane  wrote:
>> 
>> "We all know the power and usefulness of TA-Lib. "
>> 
>> Well no, I've never even heard of it before. Can you give us a link or
>> something?
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -Original Message-
>>> From: c_c_ribe...@hotmail.com
>>> Sent: Sat, 23 May 2015 17:13:15 +0200
>>> To: r-help@r-project.org
>>> Subject: [R] Looking for help finding a wrapper/package to use TA-Lib
>>> in
>>> R
>>> 
>>> Dear members,
>>> 
>>> We all know the power and usefulness of TA-Lib. There is a python
>>> wrapper
>>> for it but, despite all my searching, I am unable to find it for R.
>>> Does
>>> anyone know why? I am starting learning and using RStudio and would
>>> really like to be able to call the TA-Lib functions from RStudio. Does
>>> anyone know where I can find an R wrapper or any other alternative?
>>> 
>>> Many thanks.
>>> Claudio
>>> __
>>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
>> Can't remember your password? Do you need a strong and secure password?
>> Use Password manager! It stores your passwords & protects your account.
>> Check it out at http://mysecurelogon.com/manager
>> 
>>


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Vincentizing Reaction Time data in R

2015-05-25 Thread John Kane

Thanks Gabriel, 
That new method you found looks interesting even if it is a long way from 
anything I am likely to be doing.

Re my code below.  It looks like  vincentization is actually straight-forward.  
I used bins = 10 since it was a convenient number.  I imagine if one was to 
actually turn this into a function it would not be that hard to come up with 
some formula to calculate bin size although statisticians may be wincing when 
they read that last remark.

I played a little more with the idea and it really looks pretty easy to  
vincentizatise a data.frame.  

John Kane
Kingston ON Canada


> -Original Message-
> From: gabriel.wein...@gmail.com
> Sent: Mon, 25 May 2015 11:55:04 +0200
> To: jrkrid...@inbox.com
> Subject: Re: [R] Vincentizing Reaction Time data in R
> 
> Hi John,
> 
> Sorry for the response delay.
> 
> I found a way to do it in a slight different way :
> http://www.nicebread.de/comparing-all-quantiles-of-two-distributions-simultaneously/
> 
> You're right with the application. I just put some comments in your post.
> 
> Thank you for your time. I will now use the quantile comparison for my
> statistic test, and perform vincentization later for my thesis result.
> If I create something useful I will share it on this topic.
> 
> Gabriel
> 
>> Do I  understand the idea behind 'vincentizing' reaction times?
>> I don't want to work through the Ratcliff, (1979)  paper unless I must.
>> 
>> Let's say we have a subject , s1, with 50 rt scores.
>> We sort the scores from high to low (or low to high , it makes no
>> difference) then we split the 50 scores into quantiles (let's say
>> deciles) and calculate the mean/decile?
>> 
>> Repeat for each subject.  We now have the 'vincentized' means.
>> 
>> That's it?
> 
> Yes, the point is to get rid of the shape blindness of, for example
> ANOVA sample mean, by using quantiles to also reduce influence of
> outliers.
>> 
>> Example, of what I understand for just for one subject (s1)
>> 
>> # install plyr package if not already installed
>> install.packages("plyr")
>> #===
>> 
>> library(plyr)
>> 
>> # create some sciency looking sample data
>> rtmatter   <- c (seq(0.50 , 1.50, 0.01), seq(0.55, 1.55,  0.01) )
>> str(rtmatter)  # verify it looks sciencey
>> 
>> # create one subject
>> s1  <-  sample(rtmatter, 50, replace = TRUE)
>> 
>> # calculate 'vincentized' means for s1
>> s1  <-  sort(s1)
>> c1  <-  cut(s1, 10, right = TRUE)
> 
> You cut the distribution in 10, the use of vincentization fix the cut to
> n ≥ bins. So a formula should be used to compute it for each set of data
> 
>> ss1  <-  data.frame(c1,  s1)
>> vince1   <-   ddply(ss1, .(c1), summarize, decile.mean = mean(s1) )
>> vince1
>> 
> That's right too.
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> 
>>> -Original Message-
>>> From: gabriel.wein...@gmail.com
>>> Sent: Thu, 21 May 2015 17:50:02 +0200
>>> To: jrkrid...@inbox.com, yishinlin...@gmail.com,
>>> gunter.ber...@gene.com,
>>> djnordl...@frontier.com
>>> Subject: Re: [R] Vincentizing Reaction Time data in R
>>> 
>>> Bert : Thank you for your advice, it would be a little bit difficult to
>>> do it for my master thesis but, if I want to go further with a PhD
>>> thesis (and I do want), I would probably follow your advice and get in
>>> touch with a statistician.
>>> 
>>> Yishin : Thank you very much for the references, I will definitively
>>> read the papers you quote. I'm already a little bit aware of the
>>> misuses
>>> possible with the vincentization in particular thanks to the paper of
>>> Rouder and Speckman (2004) and it seems to fit with my design. No
>>> problem if you want to keep the code but I have to tell you that it's
>>> our first semester using R and the teacher surely didn't thought that
>>> we
>>> will run out of available code with our experiment. Like John guessed
>>> the purpose of the course was to give a first view of R to get over the
>>> temptation of SPSS, my bad if I want to avoid biased statistics like
>>> sample mean ANOVA's on RT.
>>> 
>>> Dan : Thank you for your tip, this sure will help but I'm quiet at the
>>> beginning of my R skills so I hardly trust myself to do it on my own,
>>> but I can sure give it a try.
>>> 
>>> John : I had the same as

Re: [R] png package in Ubuntu 12.04 with R 3.1.0

2015-05-26 Thread John Kane
Have you loaded the png package?

library(png)

John Kane
Kingston ON Canada


> -Original Message-
> From: gudrun.gy...@wur.nl
> Sent: Tue, 26 May 2015 07:10:35 +
> To: r-help@r-project.org
> Subject: [R] png package in Ubuntu 12.04 with R 3.1.0
> 
> 
> Dear All,
> 
> 
> I am using R to analyse computer simulations of ligand docking in a
> protein.
> 
> I am plotting the results as scatterplots and bopxplots, using the code
> below.
> 
> This works perfectly fine.
> 
> 
> I would like now to add a png file to that plot, meaning I want sth like:
> 
> 
> png(file="analysis.png")
> par(mfrow=c(1,3), oma=c(0,0,2,0))
> 
> plot
> 
> boxplot
> 
> PNG figure I read in
> 
> 
> I am running Ubuntu 12.04 and R 3.1.0.
> 
> 
> readPNG and the png packge do NOT work for me at this point.
> 
> 
> when I try to install the png package I get the error below.
> 
> 
> Any ideas what's wrong or other options to import png files?
> 
> 
> Thank you in advance for the help.
> 
> 
> Best regards
> 
> 
> Gudrun
> 
> 
> 
> png(file="analysis.png")
> par(mfrow=c(1,2), oma=c(0,0,2,0))
> plot(data, main="all", xlab="simulations run", ylab="steps")
> boxplot(data, main="steps", horizontal = FALSE, axes = FALSE, staplewex =
> 1)
> text(y = boxplot.stats(data)$stats, labels = boxplot.stats(data)$stats, x
> = 1.35)
> title("analysis", outer=TRUE)
> 
> 
> 
> install.packages("png")
> 
> 
> downloaded 24 Kb
> 
> 
> * installing *source* package 'png' ...
> ** package 'png' successfully unpacked and MD5 sums checked
> ** libs
> gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG  `libpng-config
> --cflags` -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4
> -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g
> -c read.c -o read.o
> /bin/bash: libpng-config: command not found
> read.c:3:17: fatal error: png.h: No such file or directory
> compilation terminated.
> make: *** [read.o] Error 1
> ERROR: compilation failed for package 'png'
> * removing '/home/g1/R/x86_64-pc-linux-gnu-library/3.1/png'
> 
> The downloaded source packages are in
> '/tmp/Rtmpvo3r8J/downloaded_packages'
> Warning message:
> In install.packages("png") :
>   installation of package 'png' had non-zero exit status
> 
> 
> 
> 
> Gudrun Gygli, MSc
> 
> PhD candidate
> 
> Wageningen University
> Laboratory of Biochemistry
> Dreijenlaan 3
> 6703 HA Wageningen
> The Netherlands
> 
> Phone  31 317483387
> e-mail: gudrun.gy...@wur.nl
> 
> - - - - - - - - - - - - - - - - - -
> 
> Project information:
> http://www.wageningenur.nl/en/show/Bioinformatics-structural-biology-and-molecular-modeling-of-Vanillyl-Alcohol-Oxidases-VAOs.htm
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem merging data frames and duplicates

2015-05-27 Thread John Kane
y has unequal n's . There are 6 states and 7 loci.  

It is safer to submit data in the dput() form. See ?dput for information.



John Kane
Kingston ON Canada


> -Original Message-
> From: burbrink...@gmail.com
> Sent: Tue, 26 May 2015 20:12:55 -0400
> To: r-help@r-project.org
> Subject: [R] Problem merging data frames and duplicates
> 
> Hello All,
> 
> I am attempting to merge two data frames that naturally contain duplicate
> entries, however when using either merge or dMerge I get even more
> duplicates.
> 
> For example:
> 
> data.frame(state=c("IL", "IL", "LA","LA", "MS","MS", "AR", "AR"),
> locus=c(1,1,2,2,3,4,5,6))->x
> 
> data.frame(state=c("IL", "IL", "AR", "AR", "TN","TN"),
> locus=c(1,1,2,3,3,4,4))->y
> 
> These yield:
> 
>  x
>   state locus
> 1IL 1
> 2IL 1
> 3LA 2
> 4LA 2
> 5MS 3
> 6MS 4
> 7AR 5
> 8AR 6
> 
> y
>   state locus
> 1IL 1
> 2IL 1
> 3AR 2
> 4AR 3
> 5TN 3
> 6TN 4
> 
> However, when merged by "state: they produce another second set of AR and
> IL:
> merge(x,y,by=1,all=T)->z
> 
>state locus.x locus.y
> 1 AR   5   2
> 2 AR   5   3
> 3 AR   6   2
> 4 AR   6   3
> 5 IL   1   1
> 6 IL   1   1
> 7 IL   1   1
> 8 IL   1   1
> 9 LA   2  NA
> 10LA   2  NA
> 11MS   3  NA
> 12MS   4  NA
> 13TN  NA   3
> 14TN  NA   4
> 
> While, the NAs are desired when states are missing, I don't want the
> extra
> duplicated states and values but rather:
> 
>state locus.x locus.y
> 1 AR   5   2
> 4 AR   6   3
> 7 IL   1   1
> 8 IL   1   1
> 9 LA   2  NA
> 10LA   2  NA
> 11MS   3  NA
> 12MS   4  NA
> 13TN  NA   3
> 14TN  NA   4
> 
> Any help would be much appreciated.
> 
> Thanks!
> 
> Frank
> 
> --
> 
> *
> *Frank T. Burbrink, Ph.D.*
> *Professor*
> *Biology Department*
> *6S-143*
> *2800 Victory Blvd.*
> *College of Staten Island/CUNY*
> *Staten Island, New York 10314*
> *E-Mail:frank.burbr...@csi.cuny.edu
> *
> *Phone:718-982-3961*
> *Web Page: http://scholar.library.csi.cuny.edu/~fburbrink/
> <http://scholar.library.csi.cuny.edu/%7Efburbrink/>*
> *
> *Chair *
> *Ecology, Evolutionary Biology, and Behavior*
> *Doctoral Subprogram*
> *Biology Program*
> *City University of New York *
> *Graduate Center*
> *365 Fifth Avenue*
> *New York, NY 10016-4309*
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread John Kane
Hi Mohammad, 

I went back and reread your original statement of the problem about and I think 
I kinda grasp it. It is actually quite clear and I misunderstood it completely.

At the moment I have no idea how to approach it.  As Jim Lemon said, it looks 
easy but may not be.  I'll go back and re-examine Jim's approach.

You might want to create three sample data sets of the original data layouts 
and upload them, in dput() format, to the list.  It may be easier to tackle 
from that approach.

In any case, in the existing data set is a 2 a numeric value 2 or just an 
on/off indicator?  

John Kane
Kingston ON Canada


> -Original Message-
> From: mxalimoha...@ualr.edu
> Sent: Tue, 26 May 2015 20:11:08 -0500
> To: r-help@r-project.org
> Subject: Re: [R] Problem with comparing multiple data sets
> 
> Thank you John. Yes. as you mentioned this is not really what I am
> looking
> for.
> 
> It's interesting because I was really thinking that it should be pretty
> easy. All I need to do is just compare class1, class2 and class3 for each
> text and put the most frequent number next to it in each row. Repeat it
> for
> all the rows. Apparently it's not that simple.
> 
> Sorry I didn't notice that I sent it only to you! Thanks for letting me
> know.
> 
> I appreciate if anybody can help on this.
> 
> Thank you.
> 
> 
> 
> 
> On Tue, May 26, 2015 at 7:27 PM, John Kane  wrote:
> 
>> Hi Mohammad,
>> 
>> The data came through beautifully despite the fact that you posted in
>> HTML.  Please, post in plain text.
>> 
>> Oh, just as I was ready to push Send, I  noticed you only replied to me.
>> You really should reply to the R-help list since there are a lot more
>> and
>> better people to help there. Besides it's a world-wide list. Others can
>> play with the problem while we sleep :) .
>> 
>> I will just reply to you but I really suggest sending all of this to the
>> list.
>> 
>> Now I am wondering what to do with the data. As a first swipe I just
>> added
>> up all the values in each class by each text value. Results are below.
>> Not
>> what you want by any means but perhaps a small step.
>> 
>> Then I started to think are we really interested in the sum or should we
>> be looking at incidence, that is should we be looking at the frequency
>> rather than the sum?
>> 
>> Is
>> class.1 class.2   class  #dac
>>   0   2  0
>> 
>> a value of 2 (sum) or a hit of 1 (count or freq) ?
>> 
>> Anyway below is what I have tried so far -- it may not be anywhere near
>> what you want but if it makes any sense then I think we just need to
>> pick
>> off the highest values for each combination of terms and class to give
>> you
>> what you want.
>> 
>> I suspect our real data-munging gurus can do  all this faster and better
>> than I can but hopefully it is a start.
>> 
>> Where your data set is dat1
>> #=
>> # If reshape2 is not installed.
>> install.packages("reshape2")
>> #=
>> 
>> library(reshape2)
>>  mdat  <-  melt(dat1, id.vars= c("terms"),
>>variable.name = "class",
>>value.name = "value",
>>na.rm = FALSE)
>> 
>> mdat1  <-  aggregate(value ~ terms + class, data = mdat, sum)
>> 
>> mdat1[order(mdat1$terms, mdat1$class), ]
>> 
>> #=
>> 
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> -Original Message-
>> From: mxalimoha...@ualr.edu
>> Sent: Tue, 26 May 2015 09:50:43 -0500
>> To: jrkrid...@inbox.com
>> Subject: Re: [R] Problem with comparing multiple data sets
>> 
>> Thank you John for being patient with me.
>> 
>> My original post was to compare 3 sets of data which had difference in
>> their class value for the same text. However, I thought it might be
>> easier
>> to combine those 3 data sets into one that shows the 3 different classes
>> and then find the most frequent class value for the text. So that's what
>> I
>> did. Now I only want to add the most frequent class value in a new
>> column.
>> 
>> I tried to create a dput version of the data set (Only a small part of
>> it)
>> so you can see. I hope it works.
>> 
>>> Tweet1<- read.csv(file="part1_complete.csv",head=TRUE,sep= ",")
>> 
>>> dput(head(Tweet1, 100))
>> 
>> structure(list(class.1 = c(0L,

Re: [R] Doubts on Forecasting

2015-05-27 Thread John Kane
I doubt if there is enough information in your email to let anyone really 
comment. 

Have a look at Reproducibility :
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html
for some suggestions on how to frame a question for R-help.


John Kane
Kingston ON Canada


> -Original Message-
> From: venkyno...@gmail.com
> Sent: Wed, 27 May 2015 18:37:36 +0530
> To: r-help@r-project.org
> Subject: [R] Doubts on Forecasting
> 
> Hello Team.
> 
> I have one doubts on Forecasting
> I have the 2 years of data by month wise i need to find 3rd year Value
> based on the past 2 years value if we using forecasting trend value
> coming
> i want to find the exact value please help
> 
> 
> 
> Thanks and Regards
> Venkatesan
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Printing with Header & no of observations

2015-05-27 Thread John Kane
I am not totally clear on the header question but would something like ?head 
help here?  It will show a certain number of rows of data with headers included 
.  I think the default is 6 rows but if all you want to do is check names and a 
bit of data something like head(xx, 2) works nicely.

RE output -- yes there is a limit, 
http://stackoverflow.com/questions/6758727/how-to-increase-the-limit-for-max-print-in-r.
If you want to examine 'really' huge outputs you might want to use ?sink or 
perphaps write the file to disc (?write.file) and examine it in a text editor.

John Kane
Kingston ON Canada


> -Original Message-
> From: shivibha...@ymail.com
> Sent: Wed, 27 May 2015 04:32:30 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] Printing with Header & no of observations
> 
> HI Team,
> A quick question.
> 
> When I used the print option in R to see the output of my syntax I do not
> see the headers or column names. Is there a way to see the headers in the
> print.
> Also as most of the datasets we work today have huge number of
> observations
> but when I print it only shows a portion of the output. Is there a
> limitation to the number of rows that can be printed.
> 
> Kindly suggest. Thanks, Shivi
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Printing-with-Header-no-of-observations-tp4707747.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread John Kane
I was wondering about the layout of each of your data sets. I cobbled together 
what I think is the most likely scenarios.  My bet is the data sets most 
closely resemble my data set 4 in structure. Am I correct?  I dropped the other 
two columns in your data layout as likely to be immaterial to the problem.

data set 1 (unique text and class)
class text
0 text1
2 text2
1 text3
2 text4

data set 2 (unique class, multiple text)
class text
0 text1
0 text1
0 text1
2 text2
1 text3
2 text4

data set 3 (multiple classes, multiple text)
class text
0 text1
0 text1
1 text1
2 text2
1 text3
2 text4

data set 4 (mutltiple classes , multiple text, text not found in other data 
sets)
0 text1
0 text1
1 text1
2 text2
1 text3
2 text4
2 text6
0 text6

John Kane
Kingston ON Canada


> -Original Message-
> From: mxalimoha...@ualr.edu
> Sent: Tue, 26 May 2015 20:11:08 -0500
> To: r-help@r-project.org
> Subject: Re: [R] Problem with comparing multiple data sets
> 
> Thank you John. Yes. as you mentioned this is not really what I am
> looking
> for.
> 
> It's interesting because I was really thinking that it should be pretty
> easy. All I need to do is just compare class1, class2 and class3 for each
> text and put the most frequent number next to it in each row. Repeat it
> for
> all the rows. Apparently it's not that simple.
> 
> Sorry I didn't notice that I sent it only to you! Thanks for letting me
> know.
> 
> I appreciate if anybody can help on this.
> 
> Thank you.
> 
> 
> 
> 
> On Tue, May 26, 2015 at 7:27 PM, John Kane  wrote:
> 
>> Hi Mohammad,
>> 
>> The data came through beautifully despite the fact that you posted in
>> HTML.  Please, post in plain text.
>> 
>> Oh, just as I was ready to push Send, I  noticed you only replied to me.
>> You really should reply to the R-help list since there are a lot more
>> and
>> better people to help there. Besides it's a world-wide list. Others can
>> play with the problem while we sleep :) .
>> 
>> I will just reply to you but I really suggest sending all of this to the
>> list.
>> 
>> Now I am wondering what to do with the data. As a first swipe I just
>> added
>> up all the values in each class by each text value. Results are below.
>> Not
>> what you want by any means but perhaps a small step.
>> 
>> Then I started to think are we really interested in the sum or should we
>> be looking at incidence, that is should we be looking at the frequency
>> rather than the sum?
>> 
>> Is
>> class.1 class.2   class  #dac
>>   0   2  0
>> 
>> a value of 2 (sum) or a hit of 1 (count or freq) ?
>> 
>> Anyway below is what I have tried so far -- it may not be anywhere near
>> what you want but if it makes any sense then I think we just need to
>> pick
>> off the highest values for each combination of terms and class to give
>> you
>> what you want.
>> 
>> I suspect our real data-munging gurus can do  all this faster and better
>> than I can but hopefully it is a start.
>> 
>> Where your data set is dat1
>> #=
>> # If reshape2 is not installed.
>> install.packages("reshape2")
>> #=
>> 
>> library(reshape2)
>>  mdat  <-  melt(dat1, id.vars= c("terms"),
>>variable.name = "class",
>>value.name = "value",
>>na.rm = FALSE)
>> 
>> mdat1  <-  aggregate(value ~ terms + class, data = mdat, sum)
>> 
>> mdat1[order(mdat1$terms, mdat1$class), ]
>> 
>> #=
>> 
>> 
>> John Kane
>> Kingston ON Canada
>> 
>> -Original Message-
>> From: mxalimoha...@ualr.edu
>> Sent: Tue, 26 May 2015 09:50:43 -0500
>> To: jrkrid...@inbox.com
>> Subject: Re: [R] Problem with comparing multiple data sets
>> 
>> Thank you John for being patient with me.
>> 
>> My original post was to compare 3 sets of data which had difference in
>> their class value for the same text. However, I thought it might be
>> easier
>> to combine those 3 data sets into one that shows the 3 different classes
>> and then find the most frequent class value for the text. So that's what
>> I
>> did. Now I only want to add the most frequent class value in a new
>> column.
>> 
>> I tried to create a dput version of the data set (Only a small part of
>> it)
>> so y

Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread John Kane
Thanks Mohammad. 
The data appear to have come through just fine. This probably means you can 
ignore some of the questions I just sent you -- our emails are crossing. 

I probably will not get a chance  to look at this til this afternoon (10:25 
here now). We can hope someone with more skill than I have will have solved the 
problem by then.

This is starting to sound a bit like a psychometric inter-rater reliability 
study.  Does each data set contain the same set of items ?


John Kane
Kingston ON Canada

-Original Message-
From: mxalimoha...@ualr.edu
Sent: Wed, 27 May 2015 09:18:12 -0500
To: jrkrid...@inbox.com, r-help@r-project.org
Subject: Re: [R] Problem with comparing multiple data sets

Hi John,

I created the original data set with dput . This time I only loaded 50 values 
for each data set (dat1, dat2, dat3).

About your question, all 0,1 and 2 are indicator of a specific class. The task 
is to compare 3 independent classification of a certain term and and determine 
the actual class of the term by finding the most frequent assigned number for 
that term.

I thought it might be easier to combine them into 1 data frame but either way 
is fine.

Let me know if it shows up clean. I saved the dput in txt file and copied here 
from that file. I assume this is the right way to do it. I might be wrong.

==

dat1

structure(list(class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L, 

1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), terms = structure(c(1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = c("#dac", 

"#mac,#security", "accountability,anonymous", "data 
security,encryption,security"

), class = "factor")), .Names = c("class.1", "terms"), class = "data.frame", 
row.names = c(NA, 

-49L))

dat2

structure(list(class.2 = c(2L, 2L, 2L, 2L, 0L, 0L, 2L, 0L, 0L, 

2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 2L, 2L, 2L, 1L, 1L, 2L, 

2L, 0L, 0L, 0L, 0L, 1L, 1L, 1L), terms = structure(c(1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = c("#dac", 

"#mac,#security", "accountability,anonymous", "data 
security,encryption,security"

), class = "factor")), .Names = c("class.2", "terms"), class = "data.frame", 
row.names = c(NA, 

-49L))

dat3

structure(list(class.3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L, 

1L, 0L, 0L, 0L, 0L, 2L, 1L, 2L), terms = structure(c(1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = c("#dac", 

"#mac,#security", "accountability,anonymous", "data 
security,encryption,security"

), class = "factor")), .Names = c("class.3", "terms"), class = "data.frame", 
row.names = c(NA, 

-49L))

=

On Wed, May 27, 2015 at 8:05 AM, John Kane  wrote:

Hi Mohammad,

 I went back and reread your original statement of the problem about and I 
think I kinda grasp it. It is actually quite clear and I misunderstood it 
completely.

 At the moment I have no idea how to approach it.  As Jim Lemon said, it looks 
easy but may not be.  I'll go back and re-examine Jim's approach.

 You might want to create three sample data sets of the original data layouts 
and upload them, in dput() format, to the list.  It may be easier to tackle 
from that approach.

 In any case, in the existing data set is a 2 a numeric value 2 or just an 
on/off indicator?

 John Kane
 Kingston ON Canada

 > -Original Message-
 > From: mxalimoha...@ualr.edu

> Sent: Tue, 26 May 2015 20:11:08 -0500
 > To: r-help@r-project.org
 > Subject: Re: [R] Problem with comparing multiple data sets
 >
 > Thank you John. Yes. as you mentioned this is not really what I am
 > looking
 > for.
 >
 > It's interesting because I was really thinking that it should be pretty
 > easy. All I need to do is just compare class1, class2 and class3 for each
 > text and put the most frequent number next to it in each row. Repeat it
 > for
 > all the rows. Apparently it's not that

Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread John Kane
Hi Mohammad,

My mantra for the day is "Plain Text", Plain Text". A bas HTML.
And I really need to get out of here.  

I have not found a solution but is this a bit more like what you want?

#===

dat1  <-  structure(list(class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L,
1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), terms = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label =
c("#dac",
"#mac,#security", "accountability,anonymous", "data
security,encryption,security"
), class = "factor")), .Names = c("class.1", "terms"), class =
"data.frame", row.names = c(NA,
-49L))

dat2  <-  structure(list(class.2 = c(2L, 2L, 2L, 2L, 0L, 0L, 2L, 0L, 0L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 2L, 2L, 2L, 1L, 1L, 2L,
2L, 0L, 0L, 0L, 0L, 1L, 1L, 1L), terms = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label =
c("#dac",
"#mac,#security", "accountability,anonymous", "data
security,encryption,security"
), class = "factor")), .Names = c("class.2", "terms"), class =
"data.frame", row.names = c(NA,
-49L))

dat3  <-  structure(list(class.3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L,
1L, 0L, 0L, 0L, 0L, 2L, 1L, 2L), terms = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label =
c("#dac",
"#mac,#security", "accountability,anonymous", "data
security,encryption,security"
), class = "factor")), .Names = c("class.3", "terms"), class =
"data.frame", row.names = c(NA,
-49L))

names(dat1) <-  names(dat2)  <-  names(dat3)  <-  c("class", "term")

bbind  <-  rbind(dat1, dat1, dat3)

with(bbind, table( term, class))

#=

John Kane
Kingston ON Canada

-Original Message-
From: mxalimoha...@ualr.edu
Sent: Wed, 27 May 2015 09:37:24 -0500
To: jrkrid...@inbox.com, r-help@r-project.org
Subject: Re: [R] Problem with comparing multiple data sets

Thanks John,

I really hope it can be answered. Yes all 3 data sets have the same items.

On Wed, May 27, 2015 at 9:32 AM, John Kane  wrote:

Thanks Mohammad.
 The data appear to have come through just fine. This probably means you can 
ignore some of the questions I just sent you -- our emails are crossing.

 I probably will not get a chance  to look at this til this afternoon (10:25 
here now). We can hope someone with more skill than I have will have solved the 
problem by then.

 This is starting to sound a bit like a psychometric inter-rater reliability 
study.  Does each data set contain the same set of items ?

 John Kane
 Kingston ON Canada

 -Original Message-
 From: mxalimoha...@ualr.edu

Sent: Wed, 27 May 2015 09:18:12 -0500
 To: jrkrid...@inbox.com, r-help@r-project.org
 Subject: Re: [R] Problem with comparing multiple data sets

 Hi John,

 I created the original data set with dput . This time I only loaded 50 values 
for each data set (dat1, dat2, dat3).

 About your question, all 0,1 and 2 are indicator of a specific class. The task 
is to compare 3 independent classification of a certain term and and determine 
the actual class of the term by finding the most frequent assigned number for 
that term.

 I thought it might be easier to combine them into 1 data frame but either way 
is fine.

 Let me know if it shows up clean. I saved the dput in txt file and copied here 
from that file. I assume this is the right way to do it. I might be wrong.

 ==

 dat1

 structure(list(class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 

 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L, 

 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), terms = structure(c(1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 

 1L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = 
c("#dac", 

 "#mac,#security", "

Re: [R] Problem with comparing multiple data sets

2015-05-28 Thread John Kane
Lovely solution Mohammed. I had not even heard of the modeest package.   

For names, I'd just create another data.frame

mode.names  <-  data.frame(df[,1], Out)

John Kane
Kingston ON Canada


> -Original Message-
> From: dcarl...@tamu.edu
> Sent: Thu, 28 May 2015 00:31:45 +
> To: mxalimoha...@ualr.edu, r-help@r-project.org
> Subject: Re: [R] Problem with comparing multiple data sets
> 
> cat(paste0("[", 1:length(Out), "] #dac ", Out), sep="\n")
> 
> David
> From: Mohammad Alimohammadi [mailto:mxalimoha...@ualr.edu]
> Sent: Wednesday, May 27, 2015 2:29 PM
> To: David L Carlson; r-help@r-project.org
> Subject: Re: [R] Problem with comparing multiple data sets
> 
> Thanks David it worked !
> 
> One more thing. I hope it's not complicated. Is it also possible to
> display the terms for each row next to it?
> 
> for example:
> 
> [1] #dac2
> [2] #dac0
> [3] #dac1
> ...
> 
> 
> 
> 
> On Wed, May 27, 2015 at 2:18 PM, David L Carlson
> mailto:dcarl...@tamu.edu>> wrote:
> Save the result of the apply() function:
> 
> Out <- apply(df[ ,2:length(df)], 1, mfv)
> 
> Then there are several options:
> 
> Approximately what you asked for
> data.frame(Out)
> t(t(Out))
> 
> More typing but exactly what you asked for
> cat(paste0("[", 1:length(Out), "] ", Out), sep="\n")
> 
> 
> David L. Carlson
> Department of Anthropology
> Texas A&M University
> 
> 
> -Original Message-
> From: R-help
[mailto:r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org>]
> On Behalf Of Mohammad Alimohammadi
> Sent: Wednesday, May 27, 2015 1:47 PM
> To: John Kane; r-help@r-project.org<mailto:r-help@r-project.org>
> Subject: Re: [R] Problem with comparing multiple data sets
> 
> Ok. so I read about the ("modeest") package that gives the results that I
> am looking for (most repeated value).
> 
> I modified the data frame a little and moved the text to the first
> column.
> This is the data frame with all 3 possible classes for each term.
> 
> =
> structure(list(terms = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L,
> 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = c("#dac",
> "#mac,#security",
> "accountability,anonymous", "data security,encryption,security"
> ), class = "factor"), class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L,
> 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), class.2 = c(2L, 2L,
> 2L, 2L, 0L, 0L, 2L, 0L, 0L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L,
> 0L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 0L, 0L, 0L, 0L, 1L, 1L, 1L),
> class.3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
> 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L, 1L,
> 0L, 0L, 0L, 0L, 2L, 1L, 2L)), .Names = c("terms", "class.1",
> "class.2", "class.3"), class = "data.frame", row.names = c(NA,
> -49L))
> =
> #Then I applied the function below:
> 
> ==
> library(modeest)
> df<- read.csv(file="short.csv", head= TRUE, sep=",")
> apply(df[ ,2:length(df)], 1, mfv)
> 
> 
> # It gives the most frequent value for each row which is what I need. The
> only problem is that all the values are displayed in one single row.
> 
>  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0
> 0 0 2 1 1 1 1 0 0 0 0 2 1 2
> 
> It would be much better to show them in separate rows.
> For example:
> 
>  [1] 0
> 
>  [2] 0
> 
>  [3] 1
> 
> 
> Any idea how to do this?
> 
> 
> 
> On Wed, May 27, 2015 at 10:11 AM, Mohammad Alimohammadi <
> mxalimoha...@ualr.edu<mailto:mxalimoha...@ualr.edu>> wrote:
> 
>> Hi Jim,
>> 
>> Thank you for your advice.
>> 
>> I'm not sure how to exactly incorporate this function though. I added a
>> portion of the actual data sets. all 3 data sets have the same items
>> (text)
>> with different class values. So I need to assign the most repeated class
>> (0,1,2) for each text.
>> 
>> For example: if line1 has text "aaa". It may be ass

Re: [R] about transforming a data.frame

2015-05-29 Thread John Kane
Bogdan, the request was for data in dput() format. 

Type ?dput for more information.

Do dput(myfile) copy the ouput and paste into the email

You should get something like: 
structure(list(c1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 
2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 
5L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 
8L, 8L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L), .Label = c("(0.509,0.614]", 
"(0.614,0.718]", "(0.718,0.822]", "(0.822,0.926]", "(0.926,1.03]", 
"(1.03,1.13]", "(1.13,1.24]", "(1.24,1.34]", "(1.34,1.45]", "(1.45,1.55]"
), class = "factor"), s1 = c(0.51, 0.52, 0.58, 0.58, 0.59, 0.6, 
0.63, 0.65, 0.68, 0.74, 0.74, 0.75, 0.77, 0.77, 0.77, 0.78, 0.79, 
0.84, 0.84, 0.85, 0.87, 0.93, 0.93, 0.95, 0.99, 1.04, 1.09, 1.11, 
1.13, 1.14, 1.14, 1.14, 1.17, 1.18, 1.19, 1.22, 1.22, 1.23, 1.28, 
1.29, 1.3, 1.32, 1.37, 1.38, 1.38, 1.4, 1.43, 1.47, 1.52, 1.55
)), .Names = c("c1", "s1"), row.names = c(NA, -50L), class = "data.frame")

Data in duput() format is the preferred way to get data in R-help since it 
provides a perfect copy of what you have on your machine.  Any other way of 
providing data risks the recipients reading it into R differently than it is on 
your machine.

John Kane
Kingston ON Canada


> -Original Message-
> From: tan...@gmail.com
> Sent: Fri, 29 May 2015 13:58:20 -0700
> To: sarah.gos...@gmail.com
> Subject: Re: [R] about transforming a data.frame
> 
> Hi Sarah,
> 
> thank you for your help. I have simplified the example, by reading the
> elements in a data frame, eg :
> 
> df <- data.frame (row_names = c("B4:B5:B6", "B7:B8:B9", "D4:D5:D6",
> "D10:D11:D12", "D10:D11:D12", "E10:E11:E12", "A1:A2:A3", "B10:B11:B12"),
> col_names = c
> ("B1:B2:B3","B1:B2:B3","H4:H5:H6","F10:F11:F12","H1:H2:H3","G7:G8:G9","D1:D2:D3","B1:B2:B3"),
> CT = c(5,2,2,2,2,2,4,4) )
> 
> I have used the the count() in the plyr package :
> 
> count_row_names <- count(df$row_names)
> count_col_names <- count(df$col_names)
> 
> however, I would need to correlate these UNIQUE ELEMENTS in the columns
> "row_names" or "col_names" with the numbers they associate in the  CT
> columns, eg :
> 
> ""B1:B2:B3" associate with "5, 2, 4" (in CT column), or "D10:D11:D12"
> associate with "2" (in the CT column).
> 
> thank you very much,
> 
> bogdan
> 
> 
> 
> 
> On Fri, May 29, 2015 at 1:32 PM, Sarah Goslee 
> wrote:
> 
>> Hi,
>> 
>> Please use dput() to provide your data, as it can get somewhat mangled
>> by copy and pasting, especially if you post in HTML (as you are asked
>> not to do in the posting guide).
>> 
>> What is a unique element? is "B4:B5:B6" an element, or are "B4" and
>> "B5" each elements? That is, what is the result you expect to obtain
>> for the sample data you provided?
>> 
>> What code have you tried? I would think table() might be involved, and
>> possibly strsplit(), but will refrain from putting more time into this
>> until you provide a reproducible dataset with dput() and some clearer
>> idea of your intent.
>> 
>> Sarah
>> 
>> On Fri, May 29, 2015 at 4:19 PM, Bogdan Tanasa  wrote:
>>> Dear all,
>>> 
>>> I would appreciate a suggestion on the following : I am working with a
>>> data.frame (below) :
>>> 
>>>   EXPCT   row_names   col_names
>>> 1   test -5B4:B5:B6B1:B2:B3
>>> 2   test -2B7:B8:B9B1:B2:B3
>>> 3   test -2D4:D5:D6H4:H5:H6
>>> 4   test -2D10:D11:D12 F10:F11:F12
>>> 5   test -2D10:D11:D12H1:H2:H3
>>> 6   test -2E10:E11:E12G7:G8:G9
>>> 7   test -4 A1:A2:A3D1:D2:D3
>>> 8   test -4   B10:B11:B12B1:B2:B3
>>> 
>>> what would be the easiest way to consider UNIQUE elements in the
>> ROW_NAMES
>>> or the UNIQUE elements in the COL_NAMES and :
>>> 
>>> print how many times these UNIQUE ELEMENTS associate with the numbers
>>> -5,
>>> -2, or -4 (these numbers are on the column names CT) ..
>>> 
>>> thanks,
>>> 
>>> bogdan
>>> 
>> --
>> Sarah Goslee
>> http://www.functionaldiversity.org
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Problem with comparing multiple data sets

2015-05-29 Thread John Kane
Hi Mohammad,
I have no idea what is happening but for some reason your new data (renamed df1 
since df is a reserved word in R) is outputting a list whereas dff1 (your 
original test data) is giving a vector as you wanted.

It may be obvious but I don't see why df1 is giving us a list.  As far as I can 
tell the two data sets are structually the same.

The two data sets are below the program.  
## =
library(modeest)

# Original test data 
str(dff2)
head(dff2)

# sample of new data
str(d1)
head(df1)

Out.dff2  <- apply(dff2[ ,2:length(dff2)], 1, mfv)
str(Out.dff2)

Out.df1  <-  apply(df1[ , 2:length(df1)], 1, mfv)
str(Out.df1)


## =
## New data set 
df1  <- structure(list(terms = structure(c(2L, 4L, 4L, 4L, 3L, 1L, 5L,
5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label =
c("#authentication,access control",
"#privacy,personal data", "#security,malicious,security", "data controller",
"id management,security", "password,recovery"), class = "factor"),
class.1 = c(2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 1L,
2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L), class.2 = c(2L, 2L, 2L,
0L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L,
2L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 2L,
2L, 2L), class.3 = c(2L, 0L, 2L, 2L, 1L, 1L, 0L, 0L, 0L,
2L, 2L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L)), .Names = c("terms",
"class.1", "class.2", "class.3"), class = "data.frame", row.names = c(NA,
-50L))

## Original test data set

dff2  <-   structure(list(terms = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 4L, 4L,
 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L, 2L), .Label = c("#dac",
 "#mac,#security",
 "accountability,anonymous", "data security,encryption,security"
 ), class = "factor"), class.1 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L,
 1L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L), class.2 = c(2L, 2L,
 2L, 2L, 0L, 0L, 2L, 0L, 0L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L,
 0L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 0L, 0L, 0L, 0L, 1L, 1L, 1L),
 class.3 = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 2L, 1L, 1L, 1L, 1L,
     0L, 0L, 0L, 0L, 2L, 1L, 2L)), .Names = c("terms", "class.1",
 "class.2", "class.3"), class = "data.frame", row.names = c(NA,
 -49L))

##=



John Kane
Kingston ON Canada

-Original Message-
From: mxalimoha...@ualr.edu
Sent: Fri, 29 May 2015 11:40:41 -0500
To: dcarl...@tamu.edu, drjimle...@gmail.com, jrkrid...@inbox.com, 
r-help@r-project.org
Subject: Re: [R] Problem with comparing multiple data sets

Hi everyone.

I tried the (modeest) package on my initial test data and it worked. However, 
it doesn't work on the entire data set. I saved one of the protions that gives 
error. (Not for all of the values but for some of them). For example: lines 36 
and 37 and 39 correctly show the mode value but 38 and 40 are not correct. Such 
error is repeated for many of the values.

[36,] 2        

[37,] 2        

[38,] Numeric,3

[39,] 1        

[40,] Numeric,3



#This is what I did:

> df<- read.csv(file="Part1-modif.csv", head=TRUE, sep=",")

> Out<- apply(df[,2:length(df)],1, mfv)

> t(t(Out))

#This is the data set 

structure(list(terms = structure(c(2L, 4L, 4L, 4L, 3L, 1L, 5L, 

5L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 

6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 

6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("#authentication,access 
control", 

"#privacy,personal data", "#security,malicious,security", "data controller", 

"id management,security", "password,recovery"), class = "factor"), 

    class.1 = c(2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 

    2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 

    

Re: [R] metagen - plotStudySizes: order by year and not alphabetical

2015-05-30 Thread John Kane
Yes you can do it fairly easily in 'basic' ggplot2.  You need to change the 
references from factors to ordered factors and then plot.

Note your data is now called dat1 as df is an R function. Do ?df to see what it 
is.

dat1$reference  <- factor(dat1$reference, levels = 
dat1$reference[order(dat1$year)])
p1  <-  ggplot(dat1, aes( reference, size)) + geom_bar( stat = "identity") + 
coord_flip()
 p2   <- p1 + ggtitle("Studies with Cross-sectional estimates")
p2


I hope this helps
John Kane
Kingston ON Canada


> -Original Message-
> From: antovi...@gmail.com
> Sent: Sat, 30 May 2015 14:01:28 +0200
> To: r-help@r-project.org
> Subject: [R] metagen - plotStudySizes: order by year and not alphabetical
> 
> HI everybody.
> I'm using the package 'metagen' to plot sample size in meta-analysis.
> The plot function of the package reorders the studies by alphabetcial
> order.
> However, I would like to have the studies listed by year.
> How can I force the plotting function to order the study by the variable
> 'year' rather than by the first initial of the variable 'reference'?
> 
> Thank you in advance,
> Antonello
> 
> Here my sample code:
> 
> 
> ### the data
> 
> df <- structure(list(reference = structure(c(3L, 6L, 9L, 2L, 8L, 5L,
> 7L, 10L, 4L, 1L), .Label = c("Bellani et al. 2012 ",
> "Bocco et al. 2004  ", "Costa 1998  ",
> "Dalla Volta et al. 2011   ", "Manzanere et al. 2006
> ",
> "McEnty et al. 2001 ", "Ossian et al. 2006",
> "Simone et al. 2004   ", "Tanter et al. 2002 ",
> "Zimmian et al. 2006  "), class = "factor"), size = c(20,
> 288, 70, 138, 475, 191, 918, 80, 508, 205), year = c(1998, 2001,
> 2002, 2004, 2004, 2006, 2006, 2006, 2011, 2012)), .Names = c("reference",
> "size", "year"), class = "data.frame", row.names = c(NA, -10L
> ))
> 
> ### a quick look at the data
> 
> head(df)
> str(df)
> 
> ### the library
> 
> library(metagen); library(ggplot2)
> 
> ### the plot
> 
> p1 <- plotStudySizes(df)
> p1 <- p1 + ggtitle("Studies with Cross-sectional estimates")
> p1
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] metagen - plotStudySizes: order by year and not alphabetical

2015-05-30 Thread John Kane
Adding a bit of formatting
Where your data is dat1


dat1$reference  <- factor(dat1$reference, levels = 
dat1$reference[order(dat1$year)])
pp2 <-  ggplot(dat1, aes( reference, size)) + geom_bar( stat = "identity") + 
coord_flip()
 pp2   <- pp2 + ggtitle("Studies with Cross-sectional estimates") + 
 xlab("") + ylab("Total Number of Subjects")
pp2

John Kane
Kingston ON Canada


> -Original Message-
> From: antovi...@gmail.com
> Sent: Sat, 30 May 2015 14:01:28 +0200
> To: r-help@r-project.org
> Subject: [R] metagen - plotStudySizes: order by year and not alphabetical
> 
> HI everybody.
> I'm using the package 'metagen' to plot sample size in meta-analysis.
> The plot function of the package reorders the studies by alphabetcial
> order.
> However, I would like to have the studies listed by year.
> How can I force the plotting function to order the study by the variable
> 'year' rather than by the first initial of the variable 'reference'?
> 
> Thank you in advance,
> Antonello
> 
> Here my sample code:
> 
> 
> ### the data
> 
> df <- structure(list(reference = structure(c(3L, 6L, 9L, 2L, 8L, 5L,
> 7L, 10L, 4L, 1L), .Label = c("Bellani et al. 2012 ",
> "Bocco et al. 2004  ", "Costa 1998  ",
> "Dalla Volta et al. 2011   ", "Manzanere et al. 2006
> ",
> "McEnty et al. 2001 ", "Ossian et al. 2006",
> "Simone et al. 2004   ", "Tanter et al. 2002 ",
> "Zimmian et al. 2006  "), class = "factor"), size = c(20,
> 288, 70, 138, 475, 191, 918, 80, 508, 205), year = c(1998, 2001,
> 2002, 2004, 2004, 2006, 2006, 2006, 2011, 2012)), .Names = c("reference",
> "size", "year"), class = "data.frame", row.names = c(NA, -10L
> ))
> 
> ### a quick look at the data
> 
> head(df)
> str(df)
> 
> ### the library
> 
> library(metagen); library(ggplot2)
> 
> ### the plot
> 
> p1 <- plotStudySizes(df)
> p1 <- p1 + ggtitle("Studies with Cross-sectional estimates")
> p1
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] merge function

2015-06-01 Thread John Kane
As Burt says it is not exactly clear what you want but is something like this 
what you are looking for?

dat1  <-  data.frame(aa = c("a", "b", "c"), bb = 1:3)
dat2  <-  data.frame(xx = c("b", "c", "d"), yy = 3:1)
merge(dat1, dat2, by.x = "aa", by.y = "xx")

For further reference here are some suggestions about asking questions on the 
R-help list.  In particular it is very helpful if data is supplied in dput() 
form (See ?dput for details)

John Kane
Kingston ON Canada


> -Original Message-
> From: r-help@r-project.org
> Sent: Mon, 1 Jun 2015 13:46:15 + (UTC)
> To: r-help@r-project.org
> Subject: [R] merge function
> 
> Hi,By default the merge function should take the intersection of column
> names (if this is understood from by = intersect(names(x), names(y)), but
> it takes all columns. How to specify the intersection of column names?
>  Thanks
> Carol
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] merge function

2015-06-01 Thread John Kane
Let me try this again. Here are the links I forgot. My apologies.
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html

John Kane
Kingston ON Canada


> -Original Message-
> From: jrkrid...@inbox.com
> Sent: Mon, 1 Jun 2015 06:29:41 -0800
> To: wht_...@yahoo.com, r-help@r-project.org
> Subject: RE: [R] merge function
> 
> As Burt says it is not exactly clear what you want but is something like
> this what you are looking for?
> 
> dat1  <-  data.frame(aa = c("a", "b", "c"), bb = 1:3)
> dat2  <-  data.frame(xx = c("b", "c", "d"), yy = 3:1)
> merge(dat1, dat2, by.x = "aa", by.y = "xx")
> 
> For further reference here are some suggestions about asking questions on
> the R-help list.  In particular it is very helpful if data is supplied in
> dput() form (See ?dput for details)
> 
> John Kane
> Kingston ON Canada
> 
> 
>> -Original Message-
>> From: r-help@r-project.org
>> Sent: Mon, 1 Jun 2015 13:46:15 + (UTC)
>> To: r-help@r-project.org
>> Subject: [R] merge function
>> 
>> Hi,By default the merge function should take the intersection of column
>> names (if this is understood from by = intersect(names(x), names(y)),
>> but
>> it takes all columns. How to specify the intersection of column names?
>>  Thanks
>> Carol
>> 
>>  [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> 
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/manager


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] merge function

2015-06-01 Thread John Kane
Exactly what I thought too the first time I read ?merge. R sometimes has its 
own approach.

John Kane
Kingston ON Canada


> -Original Message-
> From: r-help@r-project.org
> Sent: Mon, 1 Jun 2015 14:47:07 + (UTC)
> To: li...@dewey.myzen.co.uk, r-help@r-project.org
> Subject: Re: [R] merge function
> 
> I understood that by would take the intersection of names(x) and
> names(y), names(x) being the column names of x and names(y), column names
> of y.
> if x has 5 col and the col names of x are col1, col2... col5 and y has 3
> col and their names are col1, col2, col3, I thought that the merged data
> set will have 3 col, namely col1, col2, col3 but all 5 col, i.e. col1,
> col2... col5 are taken if nothing is specified for the by arg.
> Cheers,
> 
> 
> 
>  On Monday, June 1, 2015 4:32 PM, Michael Dewey
>  wrote:
> 
> 
> 
> 
> On 01/06/2015 14:46, carol white via R-help wrote:
>> Hi,By default the merge function should take the intersection of column
>> names
> 
>   (if this is understood from by = intersect(names(x), names(y)),
> 
> Dear Carol
> The by parameter specifies which columns are used to merge by. Did you
> understand it to be which columns are retained in the result?
> 
> Just a hunch, and if not then you need to give us a toy example.
> 
> 
> 
>   but it takes all columns. How to specify the intersection of column
> names?
> >  Thanks
>> Carol
>> 
>>     [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
> 
> --
> Michael
> http://www.dewey.myzen.co.uk/home.html
> 
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] ggplot stat_bin question

2015-06-03 Thread John Kane
I don't think there is any reason to get rid of that message unless you have a 
presentation problem, that is, you are including that output in a paper. 

 All that is, AFAIK, is a notice that ggplot() is using the default binning 
rule.  You can change the number  of the bins if you need more granular or more 
agglomerated plots.  

It can be fu/informative  to change binwidth and see what is happening.

John Kane
Kingston ON Canada


> -Original Message-
> From: glennmschu...@me.com
> Sent: Wed, 03 Jun 2015 00:32:10 + (GMT)
> To: r-help@r-project.org
> Subject: [R] ggplot stat_bin question
> 
> All,
> 
> I am using gglpot to produce combination density and histogram plots,
> which are actually kinda cool, everything works well and the plots look
> nice.  However after each plot run I receive the following message:
> 
> stat_bin: binwidth defaulted to range/30. Use 'bin width = x' to adjust
> this.
> 
> Below is the code I used to create the graph.  I think I am pretty much
> following the examples in Hadley's ggplot2 book and really just need to
> eliminate the message as the graphs look fine.  Any suggestions are
> appreciated.
> 
> Best Regards,
> Glenn
> 
>   Mdur.dist <- ggplot(OAS.Mdur, aes(x = value )) +
>     geom_density(fill = "#56B4E9", colour = "#56B4E9", alpha = .6) +
>     geom_histogram(aes(y =..density..), color = "lightgrey", fill =
> "#0072B2", bindwidth = .01) +
>     theme_minimal() +
>     #scale_x_continuous(breaks = seq(80,120, 5)) +
>     labs(title = "Mod. Duration Distribution") +
>     ylab("Density")+
>     xlab("Path Mod. Duration") +
>     theme(panel.grid.major = element_line(size = .25, color = "grey")) +
>     theme(axis.text = element_text(size = 15)) +
>     theme(axis.title = element_text(size = 20)) +
>     theme(legend.position = "none")


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Upload Error Occurred in uploading markdown file to RPubs

2015-06-03 Thread John Kane
Hi Antonello,
I had never heard of Rpubs until now so I went and had a look.  It seems to 
have allowed me to register but I don't seem to be able to do anything. I tried 
goign to the support page (bottom of intro page) and go a message "This site is 
closed" so it may be they are down or having a few technical difficulties
Visit to site at approx 2115-06-03 08:42 EDT

John Kane
Kingston ON Canada


> -Original Message-
> From: antovi...@gmail.com
> Sent: Wed, 3 Jun 2015 11:49:23 +0200
> To: r-help@r-project.org
> Subject: [R] Upload Error Occurred in uploading markdown file to RPubs
> 
> Hi, I do not know whether someone had the same problem and if s/he can
> help
> me with some advice.
> 
> I'm using RPubs from RStudio to publish tutorials and exercises.
> 
> On June 2, I've published a Markdown post in RPubs with RStudio.
> So, I'm sure the system can connect to Rpubs without any issues.
> 
> Some hours later, I've prepared another short Markdown post, an exercise
> with ggmap (which plots maps from Google and other repositories).
> 
> I've got a message of error (Upload Error Occurred), with this
> specification:
> {"continueUrl":"
> http://rpubs.com/publish/claim/84372/337a3056d40548f4ae3d1c3d7b1f2f34"}
> 
> I do not know what happens and what to do.
> Thank you in advance,
> Antonello
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reshape a data frame

2015-06-03 Thread John Kane

And I think this will do it too.

library(reshape2)
 
melt(ex, id.vars= c("gIN", "group"), 
   variable.name = "bc",
   value.name = "value", 
   na.rm = FALSE) 

John Kane
Kingston ON Canada


> -Original Message-
> From: jonsle...@gmail.com
> Sent: Wed, 3 Jun 2015 18:25:02 -0400
> To: r-help@r-project.org
> Subject: Re: [R] reshape a data frame
> 
> I found the gather function from the tidyr package, which worked nicely:
> 
> gather(ex,bcX,value, bc1:bc2)
>gIN group bcX value
> 1  A_1 A bc1  1219.79
> 2  A_2 A bc1  1486.84
> 3  A_3 A bc1  1255.80
> 4  A_4 A bc1   941.87
> 5  B_1 B bc1   588.19
> 6  B_2 B bc1   304.02
> 7  A_1 A bc2   319.79
> 8  A_2 A bc2   186.84
> 9  A_3 A bc2   125.80
> 10 A_4 A bc294.87
> 11 B_1 B bc2  1008.19
> 12 B_2 B bc2   314.02
> 
> Thanks.
> 
> 
> 
> 
> 
> On Wed, Jun 3, 2015 at 5:44 PM, Jon BR  wrote:
> 
>> Hello,
>> 
>> I would like to ask for some advice in reformatting a data frame such as
>> the following one:
>> 
>> 
>> gIN <- c("A_1","A_2","A_3","A_4","B_1","B_2")
>> bc1 <- c(1219.79, 1486.84, 1255.80, 941.87, 588.19, 304.02)
>> bc2 <- c(319.79, 186.84, 125.80, 94.87, 1008.19, 314.02)
>> group <- c("A","A","A","A","B","B")
>> 
>> ex <- data.frame("gIN" = gIN, "bc1" = bc1, "bc2"=bc2, "group" = group)
>> 
>>> ex
>>   gIN bc1 bc2 group
>> 1 A_1 1219.79  319.79 A
>> 2 A_2 1486.84  186.84 A
>> 3 A_3 1255.80  125.80 A
>> 4 A_4  941.87   94.87 A
>> 5 B_1  588.19 1008.19 B
>> 6 B_2  304.02  314.02 B
>> 
>> I would like to reshape this data frame where all the columns that have
>> bc1, bc2,...etc are merged into a single column (call it bcX or
>> something)
>> and the other variables are kept apart, the example solution follows:
>> 
>> 
>>> ex_reshaped
>>   gIN bcX group
>> 1 A_1 1219.79   A
>> 2 A_2 1486.84   A
>> 3 A_3 1255.80   A
>> 4 A_4  941.87A
>> 5 B_1  588.19  B
>> 6 B_2  304.02   B
>> 7 A_1 319.79   A
>> 8 A_2 186.84   A
>> 9 A_3 125.80   A
>> 10 A_4 94.87   A
>> 11 B_1 1008.19   B
>> 12 B_2 314.02 B
>> 
>> Does anyone know of a package, and/or command to accomplish this?
>> 
>> Thank you
>> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help to solve an Error

2015-06-04 Thread John Kane
It seems to be some kind of "translation" error from R (or the text editior) to 
HMTL. That > does not work.

Try
 grecent <- subset(gtemp,  Year >= 1995,
  select = c(Year, Annual))




John Kane
Kingston ON Canada


> -Original Message-
> From: jacksonmrodrig...@gmail.com
> Sent: Thu, 4 Jun 2015 12:20:58 +0200
> To: r-help@r-project.org
> Subject: [R] Help to solve an Error
> 
> Hi,
> 
> 
> 
> I want to apply the codes of Gavin Simpson from
> http://www.fromthebottomoftheheap.net/2011/06/11/global-warming-since-1995-now-significant/
> on my own data to detect trends in a subset. However, when I run:
> 
>> grecent <- subset(gtemp, subset = Year >= 1995,select = c(Year,
> Annual))
> 
> I get error:
> 
> Error: unexpected ';' in "grecent <- subset(gtemp, subset = Year >"
> 
> I've tried to replace ";" with several things, but it does not work at
> all.
> 
> Could anyone help me to solve this "problem"?
> 
> Best Regards,
> 
> Jackson Rodrigues
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help to solve an Error

2015-06-04 Thread John Kane
Hi Jim,
It is an problem in Gavin Simpson's code itself. Bad translation from R to HMTL 
it appears

John Kane
Kingston ON Canada


> -Original Message-
> From: drjimle...@gmail.com
> Sent: Thu, 4 Jun 2015 21:22:37 +1000
> To: jacksonmrodrig...@gmail.com
> Subject: Re: [R] Help to solve an Error
> 
> Hi Jackson,
> It looks like you have picked up the HTML code for the right angle
> bracket. Try replacing this with a right angle bracket:
> 
> grecent<-subset(gtemp,subset = Year>=1995,select = c(Year,Annual))
> 
> Jim
> 
> 
> On Thu, Jun 4, 2015 at 8:20 PM, Jackson Rodrigues
>  wrote:
>> Hi,
>> 
>> 
>> 
>> I want to apply the codes of Gavin Simpson from
>> http://www.fromthebottomoftheheap.net/2011/06/11/global-warming-since-1995-now-significant/
>> on my own data to detect trends in a subset. However, when I run:
>> 
>>> grecent <- subset(gtemp, subset = Year >= 1995,select = c(Year,
>> Annual))
>> 
>> I get error:
>> 
>> Error: unexpected ';' in "grecent <- subset(gtemp, subset = Year >"
>> 
>> I've tried to replace ";" with several things, but it does not work at
>> all.
>> 
>> Could anyone help me to solve this "problem"?
>> 
>> Best Regards,
>> 
>> Jackson Rodrigues
>> 
>> [[alternative HTML version deleted]]
>> 
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Decision tree in R using csv files

2015-06-04 Thread John Kane
No attachment. See 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html

John Kane
Kingston ON Canada


> -Original Message-
> From: aks...@cosmicad.com
> Sent: Thu, 4 Jun 2015 08:55:42 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] Decision tree in R using csv files
> 
> Hi
> Pls check the attachment.  I am having some error while making a decision
> tree in R .   Pls help.
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Decision-tree-in-R-using-csv-files-tp4708193.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread John Kane
d1  <-  apply(c0, 1, min)  I think does it.

John Kane
Kingston ON Canada


> -Original Message-
> From: sergio.fond...@gmail.com
> Sent: Fri, 5 Jun 2015 15:06:34 +0200
> To: r-help@r-project.org
> Subject: [R] Matrix of indexes to extract sparse data in dataframe
> 
> I would like to avoid a "for loop" to get a vector of data taken from
> rows of a data frame for specific columns.
> An example is the following (I can't apply min to every row of df, this
> is
> just an example):
> 
> c0=data.frame(a=c(3,-2,12,7,-23,17) , b=c(-1,-3,14,2,6,19))
> c1=apply(c0,1,which.min)
>> c1
> [1] 2 2 1 2 1 1
> 
> I would like to get a result like the following call, but without
> employing a "for loop":
> 
> d1=c(c0[1,c1[1]], c0[2,c1[2]], c0[3,c1[3]], c0[4,c1[4]], c0[5,c1[5]],
> c0[6,c1[6]])
>> d1
> [1]  -1  -3  12   2 -23  17
> 
> Thanks a lot for any help!
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] if else statement for rain data to define zero for dry and one to wet

2015-06-05 Thread John Kane
Please do not post in HTML. It made your posting unreadable.  R-help is a plain 
text list and when it removes all the HTML tags often the result is gibberish

Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html for some suggestions on how to 
post to R-help.


John Kane
Kingston ON Canada


> -Original Message-
> From: roslina...@gmail.com
> Sent: Fri, 5 Jun 2015 16:49:08 +0800
> To: r-help@r-project.org
> Subject: [R] if else statement for rain data to define zero for dry and
> one to wet
> 
> Dear r-users,
> 
> I have a set of rain data:
> 
> X1950 X1951 X1952 X1953 X1954 X1955 X1956 X1957 X1958 X1959 X1960 X1961
> X1962
> 
> 1   0.0   0.0  14.3   0.0  13.5  13.2   4.0 0   3.3 0 0   0.0
> 
> 
> 2   0.0   0.0  21.9   0.0  10.9   6.6   2.1 0   0.0 0 0   0.0
> 
> 
> 3  25.3   6.7  18.6   0.8   2.3   0.0   8.0 0   0.0 0 0  11.0
> 
> 
> 4  12.7   3.4  37.2   0.9   8.4   0.0   5.8 0   0.0 0 0   5.5
> 
> 
> 5   0.0   0.0  58.3   3.6  21.1   4.2   3.0 0   0.0 0 0  15.9
> 
> 
> I would like to go through each column and define each cell with value
> greater than 0.1 mm will be 1 and else zero. Hence I would like to attach
> the rain data and the category side by side:
> 
> 
> 1950   state
> 
> 1 0.00
> 
> 2 0.00
> 
> 3 25.3   1
> 
> 4 12.7   1
> 
> 5 0.00
> 
> 
> ...
> 
> 
> This is my code:
> 
> 
> wet_dry  <- function(dt)
> 
> { cl   <- length(dt)
> 
>   tresh  <- 0.1
> 
> 
>   for (i in 1:cl)
> 
>   {  xi <- dt[,i]
> 
>  if (xi < tresh ) 0 else 1
> 
>   }
> 
> dd <- cbind(dt,xi)
> 
> dd
> 
> }
> 
> 
> wet_dry(dt)
> 
> 
> Results:
> 
>> wet_dry(dt)
> 
>X1950 X1951 X1952 X1953 X1954 X1955 X1956 X1957 X1958 X1959 X1960
> X1961
> X1962 X1963 X1964 X1965 X1966 X1967 X1968 X1969 X1970 X1971 X1972 X1973
> X1974 X1975 X1976 X1977
> 
> 10.0   0.0  14.3   0.0  13.5  13.2   4.0   0.0   3.3   0.0   0.0
> 0.0
>   4.2   0.0   2.2   0.0   4.4   5.1 0   7.2   0.0   0.0   0.0   5.1
> 0   0.0 0   0.3
> 
> 20.0   0.0  21.9   0.0  10.9   6.6   2.1   0.0   0.0   0.0   0.0
> 0.0
>   8.4   0.0   4.0   0.0   4.9   0.7 0   0.0   0.0   0.0   0.0   5.4
> 0   3.3 0   0.3
> 
> 3   25.3   6.7  18.6   0.8   2.3   0.0   8.0   0.0   0.0   0.0   0.0
> 11.0
>   4.2   0.0   2.0   0.0  14.2  17.1 0   0.0   0.0   0.0   0.0   2.1
> 0   1.7 0   4.4
> 
> 4   12.7   3.4  37.2   0.9   8.4   0.0   5.8   0.0   0.0   0.0   0.0
> 5.5
>   0.0   0.0   5.4   0.0   6.4  14.9 0  10.1   2.9 143.4   0.0   6.1
> 0   0.0 0  33.5
> 
> 
> It does not work and give me the original data.  Why is that?
> 
> 
> Thank you so much for your help.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Summarizing data based on Date

2015-06-09 Thread John Kane
Hi,

As David said have a look at str(test). You have a factor in there or else that 
weird "list(format(test$CR_DT,"%m"))" command in aggregate() is mucking things 
up.  What is "list(format(test$CR_DT,"%m"))" intended to do?  No ,a quick test 
says it is mucking something else up and not giving the us the factor problem. 

Here is your sample data and what I think is what you are trying to do. Note 
the data is supplied in dput() format which is the preferred way to supply 
sample data to the R-help list.  See 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html for more information.  I used 
lubridate's dmy() function rather than as.Date() to format the dates.

dat1  <-  structure(list(dd = structure(c(1426204800, 142776, 1426377600, 
1426550400, 1426550400, 1426032000, 1426032000, 1426723200), tzone = "UTC", 
class = c("POSIXct", 
"POSIXt")), wt = c(0, 0, 0, 770, 3.73, 70, 10, 500)), .Names = c("dd", 
"wt"), row.names = c(NA, -8L), class = "data.frame")

str(dat1)

aggregate(dat1$wt, list(dat1$dd), sum)


John Kane
Kingston ON Canada


> -Original Message-
> From: shivibha...@ymail.com
> Sent: Tue, 9 Jun 2015 05:01:23 -0700 (PDT)
> To: r-help@r-project.org
> Subject: Re: [R] Summarizing data based on Date
> 
> Hi Petr
> 
> I researched a lot over the net and R manual as well based on which I
> revamped my code and came to the code as:
> test$CR_DT <- as.Date(test$CR_DT, '%d-%b-%y')
> 
> iii<- aggregate(test$CHG_WT,list(format(test$CR_DT,"%m")),FUN=sum)
> 
> However it still gives me the error as below:
> Error in Summary.factor(c(1L, 1L, 1L, 3286L, 1646L, 3241L, 1L, 1L, 1307L,
> :
>   ‘sum’ not meaningful for factors.
> 
> If could you guide on how to achieve the desired output. Thanks.
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Summarizing-data-based-on-Date-tp4708328p4708384.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if5
Capture screenshots, upload images, edit and send them to your friends
through IMs, post on Twitter®, Facebook®, MySpace™, LinkedIn® – FAST!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Cross tabulation with top one variable and side as multiple variables

2015-06-09 Thread John Kane
We probably should have a better idea of what the raw data looks like and 
perhaps a bit better idea of what the analyis is to show.  Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html for some suggestions. In 
particular see the discussion about dput() for the best way to provide sample 
data to the help list.


John Kane
Kingston ON Canada


> -Original Message-
> From: p.jagad...@inrhythm-inc.com
> Sent: Tue, 9 Jun 2015 01:40:53 -0700 (PDT)
> To: r-help@r-project.org
> Subject: [R] Cross tabulation with top one variable and side as multiple
> variables
> 
> Hi:
> 
> I have a huge data with lot of variables and I need to check the trend
> variations from year to year. In order to do so, I have to cross tabulate
> the year variable as top (constant) and all the remaining variables as
> side
> (attached the cross tabulation report). I have searched the forums but
> the
> syntax I could find for cross tabulation is between 2 or 3 variables. So
> i
> would request to provide a code which can print the data in the same way
> as
> in the attached.
> <http://r.789695.n4.nabble.com/file/n4708379/Untitled.png>
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Cross-tabulation-with-top-one-variable-and-side-as-multiple-variables-tp4708379.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Summarizing data based on Date

2015-06-10 Thread John Kane
Hi Shivi

I think the names issue is just that that is aggregate()'s default. Just rename 
using ?names

For the 'sort' problem, AFAIK you cannot sort within aggregate(), at least not 
how you are doing it, nor do you want to do a sort().  You need ?order for what 
you want to do with a data.frame.

Sort is for vectors 

Does this do what you want?

dat1  <-  structure(list(dd = structure(c(1426204800, 142776, 1426377600,
1426550400, 1426550400, 1426032000, 1426032000, 1426723200), tzone = "UTC", 
class =
c("POSIXct",
"POSIXt")), wt = c(0, 0, 0, 770, 3.73, 70, 10, 500)), .Names = c("dd",
"wt"), row.names = c(NA, -8L), class = "data.frame")

str(dat1)

dat2  <-  aggregate(dat1$wt, list(dat1$dd), sum)

names(dat2)  <-  c("dd", "wt")

dat2 [order(dat2$dd),]

John Kane
Kingston ON Canada


> -Original Message-
> From: shivibha...@ymail.com
> Sent: Tue, 9 Jun 2015 22:51:47 -0700 (PDT)
> To: r-help@r-project.org
> Subject: Re: [R] Summarizing data based on Date
> 
> HI All,
> 
> I am able to get the desired result. Thanks for extending help.
> while reading the csv file I made some changes as :
> 
> Test<-read.csv("Testdata.csv", head=TRUE, stringsAsFactors = FALSE,
> strip.white = TRUE)
> with this character var were not changed to factors.
> 
> Then aggregation was simple:
> aggregate(test$CHG_WT, list(test$CR_DT), sum)
> 
> However the output is not sorted based on Dates and the columns names
> appearing as very different:
> 
> Group.1   x
> 1   1-Mar-15  909791
> 2  10-Mar-15  822436
> 3  11-Mar-15  848609
> 4  12-Mar-15  924842
> 5  13-Mar-15  895270
> 6  14-Mar-15  93238
> 7 2-Mar-15 731600
> 
> Can you all please suggest why the column names are so different and how
> I
> could sort based on dates. I added the sort option in the above syntax
> aggregate(test$CHG_WT, list(test$CR_DT), sum,sort(test$CR_DT,decreasing =
> TRUE))
> 
> But it gave me an error:
> Error in FUN(X[[i]], ...) : invalid 'type' (character) of argument
> Thanks All.
> 
> 
> 
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Summarizing-data-based-on-Date-tp4708328p4708423.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] graphs, need urgent help (deadline :( )

2015-06-10 Thread John Kane
Hi Jim,

I was looking at that last night and had the same problem of visualizing what 
Rosa needed.  

Hi Rosa
This is nothing like what you wanted and I really don't understand your data 
but would something like this work as a substitute or am I completely lost?


dat1  <-  structure(list(region = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 
0.2), sample = c(10L, 10L, 20L, 20L, 30L, 30L, 40L, 40L), factora = c(0.895, 
0.811, 0.735, 0.777, 0.6, 0.466, 0.446, 0.392), factorb = c(0.903, 
0.865, 0.966, 0.732, 0.778, 0.592, 0.432, 0.294), factorc = c(0.37, 
0.688, 0.611, 0.653, 0.694, 0.461, 0.693, 0.686)), .Names = c("region", 
"sample", "factora", "factorb", "factorc"), class = "data.frame", row.names = 
c(NA, 
-8L))


mdat1  <-   melt(dat1, id.var = c("region", "sample"),
variable.name = "factor",
value.name = "value")
str(mdat1)
 
ggplot(mdat1, aes(region, value, colour = factor)) +
geom_line() + facet_grid(sample ~ .)

John Kane
Kingston ON Canada


> -Original Message-
> From: drjimle...@gmail.com
> Sent: Wed, 10 Jun 2015 20:51:52 +1000
> To: rosit...@gmail.com
> Subject: Re: [R] graphs, need urgent help (deadline :( )
> 
> Hi Rosa,
> Like Don, I can't work out what you want and I don't even have the
> picture. For example, your specification of color and line type leaves
> only one point for each color and line type, and the line from one
> point to the same point is not going to show up. Here is a possibility
> that may lead (eventually) to a solution.
> 
> library(plotrix)
> par(tcl=-0.1)
> gap.plot(x=rep(seq(10,45,by=5),3),
>  y=unlist(my.data[,c("factora","factorb","factorc")]),
>  main="A plot of factorial mystery",
>  gap=c(1.1,174),ylim=c(0,175),ylab="factor score",xlab="Group",
>  xticlab=c(" \n0.1\n10"," \n0.2\n10"," \n0.1\n20"," \n0.2\n20",
>   " \n0.1\n30"," \n0.2\n30"," \n0.1\n40"," \n0.2\n40"),
>  ytics=c(0,0.5,1,174.59),pch=rep(1:3,each=8),col=rep(c(4,2,3),each=8))
> mtext(c("Region","Sample"),side=1,at=6,line=c(0,1))
> lines(seq(10,45,by=5),my.data$factora,col=4)
> lines(seq(10,45,by=5),my.data$factorb[c(1:5,NA,7,8)],col=2)
> lines(seq(10,45,by=5),my.data$factorc,col=3)
> 
> Jim
> 
> 
> On Wed, Jun 10, 2015 at 10:53 AM, Rosa Oliveira 
> wrote:
>> Dear Don and all,
>> 
>> I’ve read the tutorial and tried several codes before posting :)
>> I’m really naive.
>> 
>> 
>> 
>> what I was trying to :  is something like the graph in the picture I
>> drawee.
>> 
>> 
>> 
>> 
>> Is it more clear now?
>> 
>> Atenciosamente,
>> Rosa Oliveira
>> 
>> --
>> 
>> 
>> 
>> Rosa Celeste dos Santos Oliveira,
>> 
>> E-mail: rosit...@gmail.com <mailto:rosit...@gmail.com>
>> Tlm: +351 939355143
>> Linkedin: https://pt.linkedin.com/in/rosacsoliveira
>> <https://pt.linkedin.com/in/rosacsoliveira>
>> 
>> "Many admire, few know"
>> Hippocrates
>> 
>>> On 09 Jun 2015, at 19:23, Don McKenzie >> <mailto:d...@u.washington.edu>> wrote:
>>> 
>>> The answer lies in learning to use the help (and knowing where to
>>> start).  Did you look at the tutorial that comes with the R
>>> installation?
>>> 
>>> ?plot
>>> ?lines
>>> 
>>> ?par
>>> 
>>> In the last, look for the descriptions of “col” and “lty”.
>>> 
>>> Using plot() and lines(), and subsetting the four unique values of
>>> “sample”, you can create your lines.
>>> 
>>> Here is a crude start, assuming your columns are part of a data frame
>>> called “my.data”.   Untested...
>>> 
plot(my.data$region[my.data$sample==10],my.data$factora[my.data$sample==10],col=4)
>>> # blue line, not dashed
>>> .
>>> .
>>> .
lines(my.data$region[my.data$sample==20],my.data$factorb[my.data$sample==20],col=2,lty=2)
>>> # red dashed line
>>> 
>>> 
>>>> On Jun 9, 2015, at 10:36 AM, Rosa Oliveira >>> <mailto:rosit...@gmail.com>> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> another naive question (i’m pretty sure :( )
>>>> 
>>>> 
>>>> I’m trying to plot a multi

Re: [R] How to validate the cluster analysis?

2015-06-10 Thread John Kane
Hi Harmeet,

Welcome to R-help but I think you are here too soon.  This is a list for 
helping people do things in R once they have some idea of what tey need to do  
in terms of statistics etc.  There are mobs of stats experts here but this not 
the list you should be asking in unless I am misunderstanding you.


I'd suggest reading some texts on cluster analysis and enquiring in 
http://stats.stackexchange.com/ for some opinions and help.  

If I misunderstood where you are at in your project and need concrete advice on 
packages, please excuse me.  

If I did misunderstand then you might find 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html useful resources on how to 
frame questions here.  

John Kane
Kingston ON Canada


> -Original Message-
> From: mylistt...@gmail.com
> Sent: Wed, 10 Jun 2015 11:58:22 +0530
> To: r-help@r-project.org, r-de...@r-project.org
> Subject: [R] How to validate the cluster analysis?
> 
> All,
> 
> I am new to the world of statistics. I am interested in finding out the
> validation techniques employed on a cluster analysis. Any point of
> reference or site would be helpful. I have read about the clValid package
> and usage of the function on cluster.stats() in the fpc package.
> 
> Thanks in Advance,
> Harmeet
> 
> PS: I have marked this mail to both help and devel list. Is it ok?
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] graphs, need urgent help (deadline :( )

2015-06-10 Thread John Kane

Hi Don,
You got caught by the old curly quotation marks vs plain quotations problem.  
My guess is  that at one point the code went through HTML or a word processor 
that automatically changes straight quotes " to curly ”  (if that comes 
through). 

A couple of long and painful debugging sessions a few years ago make me 
sensitive to such problems.

John Kane
Kingston ON Canada

-Original Message-
From: d...@u.washington.edu
Sent: Wed, 10 Jun 2015 12:07:27 -0700
To: rosit...@gmail.com
Subject: Re: [R] graphs, need urgent help (deadline :( )

Here is code that IS tested.  I am sending Rosa the (ugly) output in a separate 
file.  Crazy problems with argument order; I never figured out
exactly what was wrong.

# therapy plot

 
plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],xlab="Region",ylab="factor",type="l",col=4,ylim=c(0,1.5))
lines(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.b[therapy.df$sample==50],col=2)
lines(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.c[therapy.df$sample==50],col=3)

lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.a[therapy.df$sample==250],col=4,lty=2)
lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.b[therapy.df$sample==250],col=2,lty=2)
lines(therapy.df$Region[therapy.df$sample==250],therapy.df$factor.c[therapy.df$sample==250],col=3,lty=2)

lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.a[therapy.df$sample==1000],col=4,lty=3)
lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.b[therapy.df$sample==1000],col=2,lty=3)
lines(therapy.df$Region[therapy.df$sample==1000],therapy.df$factor.c[therapy.df$sample==1000],col=3,lty=3)

legend(7,1.4,c("factor.a","factor.b","factor.c"),col=c(4,2,3),lty=1)

On Jun 10, 2015, at 11:03 AM, Rosa Oliveira  wrote:

Sorry,

I taught I attached the cvs file :)



Don,

I tried, but I got an error:

> my.data$Region
 [1]  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5 
 6  7  8  9 10
> my.data$sample
 [1]   50   50   50   50   50   50   50   50   50   50  250  250  250  250  250 
 250  250  250  250  250 1000 1000 1000 1000 1000 1000 1000 1000
[29] 1000 1000
> my.data$factor.a
 [1] 0.895 0.811 0.685 0.777 0.600 0.466 0.446 0.392 0.256 0.198 0.136 0.121 
0.875 0.777 0.685 0.626 0.550 0.466 0.384 0.330 0.060 0.138 0.065
[24] 0.034 0.931 0.124 0.060 0.028 0.017 0.014

> plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")
Error: unexpected input in 
"plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=�”

I’m really naive, right?

Best,
RO

Atenciosamente,
Rosa Oliveira

-- 




Rosa Celeste dos Santos Oliveira, 

E-mail: rosit...@gmail.com
Tlm: +351 939355143 
Linkedin: https://pt.linkedin.com/in/rosacsoliveira

"Many admire, few know"
Hippocrates

On 10 Jun 2015, at 18:10, Don McKenzie  wrote:

For a legend, try (untested)

legend(0.15,0.9,c("factora","factorb","factorc"),col=c(4,2,3),lty=1)

If it overlaps data points move the first two arguments (0.15 and 0.9) around, 
or change the “ylim” argument in the plot() to ~1.2.

to avoid clutter, put the line-types information in the figure caption (IMO)

On Jun 10, 2015, at 10:03 AM, Don McKenzie  
wrote:

On Jun 10, 2015, at 9:08 AM, Rosa Oliveira  wrote:

Dear All,

I attach my data.

Dear Jim, 

when I run your code (even the one you send me, not in my data), I get: 

Don't know how to automatically pick scale for object of type function. 
Defaulting to continuous
Error in data.frame(x = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1,  : 
  arguments imply differing number of rows: 24, 0

Dear Don,

It’s meant that I will have 12 lines: 
3 factors - lines colors
with 3 different values of “sample” for each - line types

[Three colors, one for each factor,
and  three line types (lty=1,2,3), one for eachvalue of “sample - preferable 
dash, thin and thick).

in the X - I should have region (because I have 10 regions)
for each region I have the outcome of 3 different treatments (factor)
for each region and each treatment I have 3 different sample size.

But in your original post you had 4 sample sizes: 10,20,30,40.

I need to “see” the the influence of the region in the treatment outcome for 
each sample size.

So, at the end I should have 9 lines
3 red (1 dash, 1 thin, 1 thick) - concerning factor a (dash for sample size 50, 
thin for sample size 250 and thick for sample size 1000)
3 blue (1 dash, 1 thin, 1 thick) - concerning factor b (dash for sample size 
50, thin for sample size 250 and thick for sample size 1000)
3 gree

Re: [R] graphs, need urgent help (deadline :( )

2015-06-10 Thread John Kane
You have curly quotes rather than plain ones here : 
col=4,type=“l”,xlab=“Region”,ylab=“factor")



John Kane
Kingston ON Canada

-Original Message-
From: d...@u.washington.edu
Sent: Wed, 10 Jun 2015 11:32:59 -0700
To: rosit...@gmail.com
Subject: Re: [R] graphs, need urgent help (deadline :( )

You were caught by a mysterious issue that I don’t understand either.

plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")

Error: unexpected input in 
"plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],col=4,type=‚”

but if I change the order of arguments to plot(), it’s fine

plot(therapy.df$Region[therapy.df$sample==50],therapy.df$factor.a[therapy.df$sample==50],type="l",col=4,xlab="Region",ylab="factor”)

I don’t know what to tell you.  If someone wiser than I is still reading, maybe 
s(he) can explain.  Possibly a bug has crept into the call to “par”, but “bugs" 
suspected by non-experts like me usually turn out to be naive user errors.  

For your purposes, use the one that works.  :-)

On Jun 10, 2015, at 11:03 AM, Rosa Oliveira  wrote:

Sorry,

I taught I attached the cvs file :)



Don,

I tried, but I got an error:

> my.data$Region

 [1]  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5  6  7  8  9 10  1  2  3  4  5 
 6  7  8  9 10

> my.data$sample

 [1]   50   50   50   50   50   50   50   50   50   50  250  250  250  250  250 
 250  250  250  250  250 1000 1000 1000 1000 1000 1000 1000 1000

[29] 1000 1000

> my.data$factor.a

 [1] 0.895 0.811 0.685 0.777 0.600 0.466 0.446 0.392 0.256 0.198 0.136 0.121 
0.875 0.777 0.685 0.626 0.550 0.466 0.384 0.330 0.060 0.138 0.065

[24] 0.034 0.931 0.124 0.060 0.028 0.017 0.014

> plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=“l”,xlab=“Region”,ylab=“factor")

Error: unexpected input in 
"plot(my.data$Region[my.data$sample==50],my.data$factor.a[my.data$sample==50],col=4,type=�”

I’m really naive, right?

Best,

RO

 Atenciosamente,
Rosa Oliveira

-- 




Rosa Celeste dos Santos Oliveira, 

E-mail: rosit...@gmail.com
Tlm: +351 939355143 
Linkedin: https://pt.linkedin.com/in/rosacsoliveira 
[https://pt.linkedin.com/in/rosacsoliveira]


"Many admire, few know"
Hippocrates

On 10 Jun 2015, at 18:10, Don McKenzie  wrote:

For a legend, try (untested)

legend(0.15,0.9,c("factora","factorb","factorc"),col=c(4,2,3),lty=1)

If it overlaps data points move the first two arguments (0.15 and 0.9) around, 
or change the “ylim” argument in the plot() to ~1.2.

to avoid clutter, put the line-types information in the figure caption (IMO)

On Jun 10, 2015, at 10:03 AM, Don McKenzie  wrote:

On Jun 10, 2015, at 9:08 AM, Rosa Oliveira  wrote:

Dear All,

I attach my data.

Dear Jim, 

when I run your code (even the one you send me, not in my data), I get: 

Don't know how to automatically pick scale for object of type function. 
Defaulting to continuous

Error in data.frame(x = c(0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1, 0.2, 0.1,  : 

  arguments imply differing number of rows: 24, 0

Dear Don,

It’s meant that I will have 12 lines: 

3 factors - lines colors

with 3 different values of “sample” for each - line types

[Three colors, one for each factor,
and  three line types (lty=1,2,3), one for eachvalue of “sample - preferable 
dash, thin and thick).

in the X - I should have region (because I have 10 regions)

for each region I have the outcome of 3 different treatments (factor)

for each region and each treatment I have 3 different sample size.

But in your original post you had 4 sample sizes: 10,20,30,40.

I need to “see” the the influence of the region in the treatment outcome for 
each sample size.

So, at the end I should have 9 lines

3 red (1 dash, 1 thin, 1 thick) - concerning factor a (dash for sample size 50, 
thin for sample size 250 and thick for sample size 1000)

3 blue (1 dash, 1 thin, 1 thick) - concerning factor b (dash for sample size 
50, thin for sample size 250 and thick for sample size 1000)

3 green (1 dash, 1 thin, 1 thick) - concerning factor c (dash for sample size 
50, thin for sample size 250 and thick for sample size 1000)

Hope this time is clear.

I also though about doing 3 different graphs, each one for 1 different sample 
size, and in that case I should have 3 graphs each one with 3 lines

1 red to factor a, 1 blue to factor b and 1 green to factor c.

Do you all think is better?

A matter of style perhaps but I would use dotplots because you have only two 
data points for each “line”.  The lines will be misleading.  You also could use 

panel plots, but given your skill set (unless someone wants to spend a fair bit 
of time with

Re: [R] Problem with Volcanoplot

2015-06-11 Thread John Kane
Do you already have an R package that will do a  Spearman
Correlation Volcano plot ?

What do the data look like?

Have a look at 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 and http://adv-r.had.co.nz/Reproducibility.html
for some suggestions on how to ask a question on the R-help list.


Welcome to R and the R-help list.

John Kane
Kingston ON Canada


> -Original Message-
> From: gabinpier...@yahoo.fr
> Sent: Thu, 11 Jun 2015 15:05:34 + (UTC)
> To: r-help@r-project.org
> Subject: [R] Problem with Volcanoplot
> 
> Hi all,
> I have a data frame composed by 25 numerical variables. I want to do a
> Spearman Correlation Volcano plot (i. e. x = correlation coefficient and
> y = -log10(p value))
> I'm a begginer in R, so how can I do this ?
> PS : Sorry for my English, this is not my mother tongue.
> 
> Thank you !
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your 
desktop!

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


  1   2   3   4   5   6   7   8   9   10   >