Re: [R-es] como hacer un simple barchart horizontal ordenado por el valor ...

2015-05-19 Thread Emilio L. Cano
Eric,

En un barplot, el orden que se usa es el de los niveles del factor. Al
crear un factor, por defecto este orden es alfabético. Lo que tienes que
hacer es reordenar los niveles del factor usando el criterio de la otra
variable (podría ser cualquier función aplicada a las observaciones del
factor, en tu caso sólo tienes una). Prueba este código:

math - read.table(math.txt, header = TRUE,  sep=,, stringsAsFactors =
TRUE, row.names = 1)
math$CNT - reorder(math$CNT, math$mave1, mean)
library(lattice)
barchart(CNT ~ mave1, data = math[order(math$mave1),], horizontal = TRUE)


Por otra parte, ¿qué quieres pintar en la leyenda? Necesitarías alguna otra
variable, por ejemplo el continente, el idioma, o algo así...

Un saludo,
Emilio


*Emilio L. Cano*

Mobile: +34 665 676 225
skype: emilopezcano
twitter: @emilopezcano
http://emilio.lcano.com


El 19 de mayo de 2015, 7:56, eric ericconchamu...@gmail.com escribió:

 Estimada comunidad, me resulta muy frustrante no poder hacer un simple
 barchart como yo quisiera (es la primera vez que intento hacer uno en todo
 caso :)). Gaste todo el dia buscando y no puedo darle las caracteristicas
 que necesito:

 Tengo un simple data.frame que adjunto, con paises y los puntajes que
 obtuvieron en una prueba y quiero hacer un barchart con los puntajes en
 orden ascendente, con las barras horizontales y que muestre el nombre de
 los paises, aunque sea con la fuente pequeña. Uso el siguiente codigo y no
 resulta:

 barchart(ave ~ CNT, data=math, horizontal=TRUE)

 con eso consigo que sea horizontal, pero no se como hacer que las barras
 se ordenen de acuerdo al valor de ave, lo que sospecho tiene que ver con
 index.cond, pero no se como usarlo.

 Tampoco puedo siquiera hacer que aparezca una leyenda con auto.key=TRUE

 Alguna sugerencia ?

 Adjunto los datos.

 Muchas gracias.







 --
 Forest Engineer
 Master in Environmental and Natural Resource Economics
 Ph.D. student in Sciences of Natural Resources at La Frontera University
 Member in AguaDeTemu2030, citizen movement for Temuco with green city
 standards for living

 Nota: Las tildes se han omitido para asegurar compatibilidad con algunos
 lectores de correo.

 ___
 R-help-es mailing list
 R-help-es@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-help-es



[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Livia Maria Vestergaard
Hi guys

I have a statistical question to an analyse I ran in R. It is a dummy variable  
model with the 5 regions of Denmark as 4 independent dummy variables and price 
as the dependent variable:

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I understand the R^2 = 0.7348  - that it shows the explanatory force of the 
model (between 0 and 1)
My question is simply how to interpret the standard error = 0.7348 on 342199 
degrees of freedom? How is it calculated when the model is a dummy variable 
model. And what does  it mean that the F-statistic says that there are 1894 on 
4 and 342199 DF (degrees if freedom?) with a p-value  0?

I have been searching for hours - and can't quite figure out how R reached the 
numbers and how to interpret the output of standard error and the p-value of 
the dummy model.

I really hope you can help :)

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.

Re: [R] Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Jim Lemon
Hi Livia,
You seem to have mixed up the residual error with the R^2, which is
just over 0.02. The bottom line on your summary table says that the
obtained F statistic was equal to 1894 (this has been truncated to
four significant places). The probability of obtaining that value with
your data given the F distribution for 4 numerator and 342199
denominator degrees of freedom is very small, but not less than 0. The
notation 2.2e-16 can be roughly translated in English as about as
close to zero as this function can calculate. You should note that
with that many observations, a significant result is almost
guaranteed, but the linear model explains almost none of the variance
in prices.

Jim


On Tue, May 19, 2015 at 6:16 PM, Livia Maria Vestergaard
lves...@student.sdu.dk wrote:
 Hi guys

 I have a statistical question to an analyse I ran in R. It is a dummy 
 variable  model with the 5 regions of Denmark as 4 independent dummy 
 variables and price as the dependent variable:

 price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
 Syddanmark

 I understand the R^2 = 0.7348  - that it shows the explanatory force of the 
 model (between 0 and 1)
 My question is simply how to interpret the standard error = 0.7348 on 342199 
 degrees of freedom? How is it calculated when the model is a dummy variable 
 model. And what does  it mean that the F-statistic says that there are 1894 
 on 4 and 342199 DF (degrees if freedom?) with a p-value  0?

 I have been searching for hours - and can't quite figure out how R reached 
 the numbers and how to interpret the output of standard error and the p-value 
 of the dummy model.

 I really hope you can help :)

 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.


[R] Finding Optimum of Stochastic Function

2015-05-19 Thread Prof J C Nash (U30A)
Most of the stochastic optimization methods are directed at multiple
optima. You appear to have an imprecisely determined function e.g., time
taken for racing driver to get round the track, and indeed this is a
different form of stochastic optimization.

With Harry Joe of UBC I did quite a bit of work about 20 years ago on
response surface minimization, but none of this is (to my knowledge)
translated to R. David Wagstaff at Penn State just sent me a msg that
he's making some progress translating our Fortran 77 to Fortran 95 (I
think to R might actually be easier). I believe Harry had at least a
partial C version.

reference is Statistics and Computing 13: 277–286, 2003 Numerical
optimization and surface estimation with imprecise function evaluations

Our approach was to generate some points and model them as a paraboloid
and then search near the minimum of that model. All the smarts are in
choosing which points to add to or remove from the set of points for
modelling the surface. Clearly there are no guarantees, but for some
applications we found this worked not too badly.

JN

On 15-05-19 06:00 AM, r-help-requ...@r-project.org wrote:
 Message: 11
 Date: Mon, 18 May 2015 14:47:49 -0700
 From: ivo welch ivo.we...@anderson.ucla.edu
 To: r-help@r-project.org
 Subject: [R] Finding Optimum of Stochastic Function
 Message-ID:
   CAPr7RtV99V3=3qumkamlridyecor2maq6cqxrv3929madcu...@mail.gmail.com
 Content-Type: text/plain; charset=UTF-8
 
 Could someone please point me to an optimizer for stochastic functions?
(In http://cran.r-project.org/web/views/Optimization.html, I saw methods
 that use random directions for deterministic functions, which is not the
 kind of stochastic I need.)
 
 For clarification, say I have an outcome function f(x), where x is a vector
 of, say, 3 choices.  f(x) yields a simulated result that depends on random
 draws.  That is, if I run it twice, it will give me different answers.  I
 want to find the value of x that has the highest average f(x).
 
 There are apparently well-defined algorithms, such as Robbins-Monro,
 Kiefer-Wolfowitz, and Spall, although I don't know how they work nor do I
 need to know much.  Presumably, a good algorithm knows not to draw too many
 points at a given x too early (when far away from the optimum), but to
 start more scattershot; and not to try to climb too aggressively.
 Intuitively, I probably want to start from a point, draw in a cloud around
 this point, and slowly sample-crawl into the direction where values tend to
 be higher.  Ideally, the algorithm would try to solve an updatable
 least-squares problem to determine its next sample.
 
 Pointers appreciated.
 
 regards, /iaw
 
 Ivo Welch (ivo.we...@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.


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 jrkrid...@inbox.com 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/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  

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 Rolf Turner

On 20/05/15 04:37, Soe Xiyan wrote:

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


The actual structure of your data set is unclear.  You appear to have 
your data stored in a number of separate data frames, but this is not 
made explicit.  The details must be specified in order for anyone to be

able to help you.

Moreover it is not at all clear what you want to achieve.

Why is class changed equal to 2 and class unchanged equal to 3?

I count 2 no-s and 11 yes-s (not 3 yes-s).

There are many clever people who subscribe to the R-help list, but few 
if any of them are mind-readers.


cheers,

Rolf Turner


--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
Home phone: +64-9-480-4619

__
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 Bert Gunter
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),...

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.

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 jrkrid...@inbox.com 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
 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.


[[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.


Re: [R] Error in dimnames(phi) - list(rn, dims) : length of 'dimnames' [2] not equal to array extent

2015-05-19 Thread Yonas Yohannes
Dear Oleg,
Thank you so much for your advice! But I tried to update the packages and
check whether the problem is fixed. But I end up with the same error.
Error in dimnames(phi) - list(rn, dims) :
  length of 'dimnames' [2] not equal to array extent

It seems to me that, what I got to update from R-forge is version 0.60 not
version 0.61. Please see below the script I got while updating the package:

trying URL 'http://R-Forge.R-project.org/bin/windows/contrib/3.1/ca_0.60.zip
'

Content type 'application/zip' length 98081 bytes (95 KB)

opened URL

downloaded 95 KB


Do you think version 0.60 is not fixing the problem?

Kindly,

Yonas


On Mon, May 18, 2015 at 6:52 PM, Oleg Nenadić onen...@uni-goettingen.de
wrote:

 David, Thanks for forwarding this to me.

 Yonas, Please try updating your ca package to version 0.61 which fixes
 this issue. This is not the latest official CRAN version, so get it from
 R-forge via
  update.packages(ca, repos = http://r-forge.r-project.org;)

 All the best,
 Oleg.



 On 18/05/2015 16:27, David L Carlson wrote: I think this is a bug in the
 current version of ca() in package ca. I am copying the package maintainer
 with this example:
 
  # Reproducible example from manual page for ca():
 
  library(ca)
  data(author)
  author.ca - ca(author) # No problem
  author.ca - ca(author, nd=3)
  Error in dimnames(phi) - list(rn, dims) :
 length of 'dimnames' [2] not equal to array extent
  library(MASS)
  author.ca - corresp(author, nf=3) # No problem
 
  So the MASS version of correspondence analysis, corresp(), is able to
 extract three dimensions (actually up to 11) from author. I am certain I
 have used ca() in the past and extracted more than two dimensions from
 similar tables.
 
  -
  David L Carlson
  Department of Anthropology
  Texas AM University
  College Station, TX 77840-4352
 
 
 
  -Original Message-
  From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim
 Lemon
  Sent: Sunday, May 17, 2015 7:31 PM
  Cc: r-help mailing list
  Subject: Re: [R] Error in dimnames(phi) - list(rn, dims) : length of
 'dimnames' [2] not equal to array extent
 
  Hi Yonas,
  If this is the ca function from the package of the same name, it
  looks to me as though your data set is only two dimensions and you are
  requesting 3 dimensions in the output. Have you tried calling ca with
  the default nd=NA?
 
  Jim
 
 
  On Mon, May 18, 2015 at 3:22 AM, Jeff Newmiller
  jdnew...@dcn.davis.ca.us wrote:
  You desperately need to study [1] and the Posting Guide mentioned at
 the bottom of this and every other message on this list.
 
  [1]
 http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
 
 ---
  Jeff NewmillerThe .   .  Go
 Live...
  DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#. Live
 Go...
 Live:   OO#.. Dead: OO#.. Playing
  Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
  /Software/Embedded Controllers)   .OO#.   .OO#.
 rocks...1k
 
 ---
  Sent from my phone. Please excuse my brevity.
 
  On May 17, 2015 7:31:08 AM PDT, Yonas Yohannes yo...@wku.edu.et
 wrote:
  Dears,
  I have presence and absence data set (8 rows and 33 columns) and when I
  want to get out of the default two dimensions command using
  summary(ca(mydata,
  nd=3)) the following error message displyed:
 
  Error in dimnames(phi) - list(rn, dims) :
length of 'dimnames' [2] not equal to array extent
 
  Please help! So many thanks in advance!
  Kindly,
  * mail%3ayo...@wku.edu.et*
 
 [[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.
 
  __
  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.
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help

[R] Count number in r

2015-05-19 Thread Hafizuddin Arshad
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==yearraindat$Month==month))
  rainmonth[year-yearcorr,month]-
  length((which(raindat$Rain =
0.1))[raindat$Year==yearraindat$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.


Re: [R] Count number in r

2015-05-19 Thread Jorge I Velez
Dear Arshad,

Here is a possibility using tapply():

with(d, tapply(Rain, list(Month, Year), function(x) sum(x  .1)))
##1971
#1   12
#20


where d is your data.frame().   See also ?aggregate and ?ave.

Best,
Jorge.-


On Tue, May 19, 2015 at 8:10 PM, Hafizuddin Arshad 
hafizuddinarsha...@gmail.com wrote:

 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==yearraindat$Month==month))
   rainmonth[year-yearcorr,month]-
   length((which(raindat$Rain =
 0.1))[raindat$Year==yearraindat$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.


[[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.


Re: [R] Error in dimnames(phi) - list(rn, dims) : length of 'dimnames' [2] not equal to array extent

2015-05-19 Thread Oleg Nenadić

Dear Yonas,
It usually takes some time until a Windows binary version is available 
on R-Forge. It is version 0.61 you want here.


So, you can either install the source version using
 install.packages(ca, repos=http://R-Forge.R-project.org;, 
type=source)

or manually download and install the binary package from
https://r-forge.r-project.org/R/?group_id=1859

Kind regards,
Oleg.


On 19.05.2015 08:23, Yonas Yohannes wrote:
 Dear Oleg,
 Thank you so much for your advice! But I tried to update the packages
 and check whether the problem is fixed. But I end up with the same error.
 Error in dimnames(phi) - list(rn, dims) :
 length of 'dimnames' [2] not equal to array extent

 It seems to me that, what I got to update from R-forge is version 0.60
 not version 0.61. Please see below the script I got while updating the
 package:

 trying URL
 'http://R-Forge.R-project.org/bin/windows/contrib/3.1/ca_0.60.zip'

 Content type 'application/zip' length 98081 bytes (95 KB)

 opened URL

 downloaded 95 KB


 Do you think version 0.60 is not fixing the problem?

 Kindly,

 Yonas



 On Mon, May 18, 2015 at 6:52 PM, Oleg Nenadić onen...@uni-goettingen.de
 mailto:onen...@uni-goettingen.de wrote:

 David, Thanks for forwarding this to me.

 Yonas, Please try updating your ca package to version 0.61 which
 fixes this issue. This is not the latest official CRAN version, so
 get it from R-forge via
   update.packages(ca, repos = http://r-forge.r-project.org;)

 All the best,
 Oleg.



 On 18/05/2015 16:27, David L Carlson wrote: I think this is a bug
 in the current version of ca() in package ca. I am copying the
 package maintainer with this example:
  
   # Reproducible example from manual page for ca():
  
   library(ca)
   data(author)
   author.ca http://author.ca - ca(author) # No problem
   author.ca http://author.ca - ca(author, nd=3)
   Error in dimnames(phi) - list(rn, dims) :
   length of 'dimnames' [2] not equal to array extent
   library(MASS)
   author.ca http://author.ca - corresp(author, nf=3) # No 
problem

  
   So the MASS version of correspondence analysis, corresp(), is
 able to extract three dimensions (actually up to 11) from author.
 I am certain I have used ca() in the past and extracted more than
 two dimensions from similar tables.
  
   -
   David L Carlson
   Department of Anthropology
   Texas AM University
   College Station, TX 77840-4352
  
  
  
   -Original Message-
   From: R-help [mailto:r-help-boun...@r-project.org
 mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon
   Sent: Sunday, May 17, 2015 7:31 PM
   Cc: r-help mailing list
   Subject: Re: [R] Error in dimnames(phi) - list(rn, dims) :
 length of 'dimnames' [2] not equal to array extent
  
   Hi Yonas,
   If this is the ca function from the package of the same name, it
   looks to me as though your data set is only two dimensions and
 you are
   requesting 3 dimensions in the output. Have you tried calling 
ca with

   the default nd=NA?
  
   Jim
  
  
   On Mon, May 18, 2015 at 3:22 AM, Jeff Newmiller
   jdnew...@dcn.davis.ca.us mailto:jdnew...@dcn.davis.ca.us 
wrote:

   You desperately need to study [1] and the Posting Guide
 mentioned at the bottom of this and every other message on this list.
  
   [1]
 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

  
 
---

   Jeff Newmiller The . . Go Live...
   DCN:jdnew...@dcn.davis.ca.us mailto:jdnew...@dcn.davis.ca.us
 Basics: ##.#. ##.#. Live Go...
   Live: OO#.. Dead: OO#.. Playing
   Research Engineer (Solar/Batteries O.O#. #.O#. with
   /Software/Embedded Controllers) .OO#. .OO#. rocks...1k
  
 
---

   Sent from my phone. Please excuse my brevity.
  
   On May 17, 2015 7:31:08 AM PDT, Yonas Yohannes yo...@wku.edu.et
 mailto:yo...@wku.edu.et wrote:
   Dears,
   I have presence and absence data set (8 rows and 33 columns)
 and when I
   want to get out of the default two dimensions command using
   summary(ca(mydata,
   nd=3)) the following error message displyed:
  
   Error in dimnames(phi) - list(rn, dims) :
   length of 'dimnames' [2] not equal to array extent
  
   Please help! So many thanks in advance!
   Kindly,
   * mail%3ayo...@wku.edu.et mailto:mail%253ayo...@wku.edu.et*
  
   [[alternative HTML version deleted]]
  
   __
   R-help@r-project.org mailto:R-help@r-project.org mailing list
 -- To UNSUBSCRIBE and more, see
   

[R-es] Formador en R en México DF....

2015-05-19 Thread Carlos Ortega
Hola,

Eduard (le conocemos del grupo de Periodismo de Datos) nos ha pedido ayuda
para localizar a un formador en R en México DF.

Si alguien de la lista está interesado, por favor que se ponga en contacto
con él o con Tamar (ambos en copia) para concretar detalles de la
colaboración.

​G
​racias,​

Carlos Ortega
www.qualityexcellence.es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] Count number in r

2015-05-19 Thread David L Carlson
Here's an approach using xtabs() if you want the output as a table:

 flag - as.integer(d$Rain=.1)
 xtabs(flag~Year+Month, d)
  Month
Year1  2
  1971 12  0

-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX 77840-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jorge I Velez
Sent: Tuesday, May 19, 2015 8:21 AM
To: Hafizuddin Arshad
Cc: R Help
Subject: Re: [R] Count number in r

Dear Arshad,

Here is a possibility using tapply():

with(d, tapply(Rain, list(Month, Year), function(x) sum(x  .1)))
##1971
#1   12
#20


where d is your data.frame().   See also ?aggregate and ?ave.

Best,
Jorge.-


On Tue, May 19, 2015 at 8:10 PM, Hafizuddin Arshad 
hafizuddinarsha...@gmail.com wrote:

 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==yearraindat$Month==month))
   rainmonth[year-yearcorr,month]-
   length((which(raindat$Rain =
 0.1))[raindat$Year==yearraindat$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.


[[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.


[R] Count unchanged class attribute

2015-05-19 Thread Soe Xiyan
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.


[R] RJDBC and Unicode characters on Windows

2015-05-19 Thread Joshua Ainsley
Hello,

I am using the RJDBC library to connect to a SQL database and pull out text
that includes Hebrew characters. If I do this on a Mac, the data frames I
construct display the characters properly. If I do it on a Windows PC, then
the characters are converted to strings like this:

U+05DEU+05E2U+05D5U+05EA U+05D7U+05D8U+05D9U+05DD

I have tried UTF-8, UCS-2LE, UTF-8-BOM, and UTF-16LE encodings with
no luck. Any suggestions on getting the data to display properly?

Thanks,
Josh

[[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.


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==yearraindat$Month==month))
   rainmonth[year-yearcorr,month]-
   length((which(raindat$Rain =
 0.1))[raindat$Year==yearraindat$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 Wasige
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 jrkrid...@inbox.com 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==yearraindat$Month==month))
rainmonth[year-yearcorr,month]-
length((which(raindat$Rain =
  0.1))[raindat$Year==yearraindat$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.




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

[[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.


Re: [R] Urgent :) Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Livia Maria Vestergaard
Hi :)

I have an an examination tomorrow, and don't quite understand how R calculated 
the values. 

Yes. You are right R^2=0.02166 :)
As mentioned It is a dummy variable  model with the 5 regions of Denmark as 4 
independent dummy variables and price as the dependent variable. 

 price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I will probably be asked how to interpret the standard error = 0.7348 on 342199 
degrees of freedom (= 342 204 observations - 5 categories); about the 5 
standard errors for the beta values, the F-statistic = 1894 on 4 categories and 
the p-value ≈ 0. But I don't quite understand how R reached the outputs and 
what parameter are F-distributed, what the standard errors says something about 
and the standard errors and the F-statistic = 1894  when it is a dummy variable 
model. 

Hopefully the answer is out there somewhere  and you can help :)

Best  Livia

Fra: Livia Maria Vestergaard
Sendt: 19. maj 2015 10:16
Til: r-help@r-project.org
Emne: [R] Output interpretation: standard error of lm dummy variable

Hi guys

I have a statistical question to an analyse I ran in R. It is a dummy variable  
model with the 5 regions of Denmark as 4 independent dummy variables and price 
as the dependent variable:

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland - 0.120* 
Syddanmark

I understand the R^2 = 0.7348  - that it shows the explanatory force of the 
model (between 0 and 1)
My question is simply how to interpret the standard error = 0.7348 on 342199 
degrees of freedom? How is it calculated when the model is a dummy variable 
model. And what does  it mean that the F-statistic says that there are 1894 on 
4 and 342199 DF (degrees if freedom?) with a p-value  0?

I have been searching for hours - and can't quite figure out how R reached the 
numbers and how to interpret the output of standard error and the p-value of 
the dummy model.

I really hope you can help :)

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] Fixed effects regression and robust regression

2015-05-19 Thread michael westphal via R-help
Hello:
I am using R 3.0.2.  
I have panel data on countries' renewable energy net generation (and installed 
capacity) over time.  I am regressing these dependent variables on various 
socioeconomic variables, as well as binary policy variables.  I have have done 
basic OLS, but I wanted to explore both fixed effects models, as there are 
likely significant country effects (using plm) and robust regression (using 
rlm), as Q-Q plots indicate that there are some strong outliers.  This might be 
a question of apples and oranges, but how do I compare the goodness of fit of 
the fixed effects models with the robust regression models?  One can use 
F-tests to compare OLS and the fixed effects, and since the OLS and robust 
regressions have the same number of DFs, looking at the residual standard error 
is insightful.  Any help would be appreciated.
Cheers,
Michael

[[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.

Re: [R] Fixed effects regression and robust regression

2015-05-19 Thread Bert Gunter
On Tue, May 19, 2015 at 1:23 PM, michael westphal via R-help
r-help@r-project.org wrote:

You can't compare them (statistically -- you can of course draw
pictures). Note, from ?rlm:

 Note that the df.residual component is deliberately set to NA to
avoid inappropriate estimation of the residual scale from the residual
mean square by lm methods. 

Further questions should probably go to a statistics list like
stats.stackexchange.com, as statistical questions are generally
offtopic here.

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

__
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 jrkrid...@inbox.com 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==yearraindat$Month==month))
        rainmonth[year-yearcorr,month]-
        length((which(raindat$Rain =
  0.1))[raindat$Year==yearraindat$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] Urgent :) Output interpretation: standard error of lm dummy variable

2015-05-19 Thread Jeff Newmiller
Technically it is not on topic to discuss the statistics behind R calculations 
here, and certainly not our job to do so within the context of your educational 
institution's schedule. However, you have the power to read the source code of 
any function in R or contributed packages, so go for it. Just enter the name of 
most functions without parentheses at the R command line. Page 43 of [1] should 
help for more deeply hidden code.

[1] http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On May 19, 2015 1:37:13 PM PDT, Livia Maria Vestergaard 
lves...@student.sdu.dk wrote:
Hi :)

I have an an examination tomorrow, and don't quite understand how R
calculated the values. 

Yes. You are right R^2=0.02166 :)
As mentioned It is a dummy variable  model with the 5 regions of
Denmark as 4 independent dummy variables and price as the dependent
variable. 

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland -
0.120* Syddanmark

I will probably be asked how to interpret the standard error = 0.7348
on 342199 degrees of freedom (= 342 204 observations - 5 categories);
about the 5 standard errors for the beta values, the F-statistic = 1894
on 4 categories and the p-value ≈ 0. But I don't quite understand how R
reached the outputs and what parameter are F-distributed, what the
standard errors says something about and the standard errors and the
F-statistic = 1894  when it is a dummy variable model. 

Hopefully the answer is out there somewhere  and you can help :)

Best  Livia

Fra: Livia Maria Vestergaard
Sendt: 19. maj 2015 10:16
Til: r-help@r-project.org
Emne: [R] Output interpretation: standard error of lm dummy variable

Hi guys

I have a statistical question to an analyse I ran in R. It is a dummy
variable  model with the 5 regions of Denmark as 4 independent dummy
variables and price as the dependent variable:

price = 10.325 - 0.176*Sjaeland - 0.368 * NJylland - 0.230*MJylland -
0.120* Syddanmark

I understand the R^2 = 0.7348  - that it shows the explanatory force of
the model (between 0 and 1)
My question is simply how to interpret the standard error = 0.7348 on
342199 degrees of freedom? How is it calculated when the model is a
dummy variable model. And what does  it mean that the F-statistic says
that there are 1894 on 4 and 342199 DF (degrees if freedom?) with a
p-value  0?

I have been searching for hours - and can't quite figure out how R
reached the numbers and how to interpret the output of standard error
and the p-value of the dummy model.

I really hope you can help :)

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.