Re: [R] Creating hanging bar plot in r from dplyr

2019-04-20 Thread Scott Colwell
That is perfect. Thanks!

--
Scott R. Colwell, PhD

On 2019-04-20, 1:23 PM, "Jeff Newmiller"  wrote:

Not really sure I understand what you want. Here is some code to 
consider:



library(ggplot2)
library(dplyr)
library(tidyr)

dta <- read.table( text =
"samp.N   RSQMRB_uc  MRB_sb  MRB_bp
  50  0.3  1.4237.6   37.6
  50  0.4  8.6143.1   43.1
  50  0.5  7.4131.6   31.6
  50  0.6  5.0621.5   21.5
  50  0.7  3.3814.1   14.1
  50  0.8 -1.075.16   5.16
100  0.3 -6.4140.3   40.3
100  0.4 -10.621.0   21.0
100  0.5 -9.0213.2   13.2
100  0.6 -9.855.14   5.14
100  0.7 -7.942.08   2.08
100  0.8 -4.811.28   1.28
", header = TRUE )
dta2 <- (   dta
 %>% mutate( samp.N = factor( samp.N )
   , RSQ = factor( RSQ )
   )
 %>% gather( Measure, value, -c( samp.N, RSQ ) )
 )

ggplot( dta2, aes( x = RSQ, y = value, fill = samp.N ) ) +
   geom_bar( stat = "identity", position = "dodge", colour = "black" ) +
   facet_wrap( ~ Measure, ncol = 1, scale = "free_y" ) +
   ylab( "" )




On Sat, 20 Apr 2019, Scott Colwell wrote:

> I am trying to figure out how to create a hanging bar plot from dplyr.
> I have used dplyr as follows:
> table4 <- cr %>%
>  group_by(samp.N, RSQ) %>%
>  summarize(
>MRB_uc = mean(CF.F1F2/0.40*100)-100,
>MRB_sb = mean(SBC.F1F2.Alpha/0.40*100) - 100,
>MRB_bp = mean(BPC.F1F2.Alpha/0.40*100) - 100
>  )
> which provides me with this:
>   samp.N   RSQ MRB_uc MRB_sb MRB_bp
>   
> 1 50   0.3   1.42  37.6   37.6
> 2 50   0.4   8.61  43.1   43.1
> 3 50   0.5   7.41  31.6   31.6
> 4 50   0.6   5.06  21.5   21.5
> 5 50   0.7   3.38  14.1   14.1
> 6 50   0.8  -1.07   5.16   5.16
> 7100   0.3  -6.41  40.3   40.3
> 8100   0.4 -10.6   21.0   21.0
> 9100   0.5  -9.02  13.2   13.2
> 10100   0.6  -9.85   5.14   5.14
> 11100   0.7  -7.94   2.08   2.08
> 12100   0.8  -4.81   1.28   1.28
> What I want to do is create a hanging bar plot with the x-axis being 
samp.N value by RSQ value. The bars are then values of MRB_uc, MRB_sb, and 
MRB_bp. Given some values are negative, some bars will be above zero and others 
below (hence the hanging bar plot)
> I don't have any code yet as I am completely unfamiliar with how to do 
this. Any suggestions would be really appreciated.
> Thank you!
> Scott
>
>
>
>
> --
> Scott R. Colwell, PhD
>
>
>   [[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.
>

---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
   Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---


__
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] Creating hanging bar plot in r from dplyr

2019-04-20 Thread Jeff Newmiller
Not really sure I understand what you want. Here is some code to 
consider:




library(ggplot2)
library(dplyr)
library(tidyr)

dta <- read.table( text =
"samp.N   RSQMRB_uc  MRB_sb  MRB_bp
 50  0.3  1.4237.6   37.6
 50  0.4  8.6143.1   43.1
 50  0.5  7.4131.6   31.6
 50  0.6  5.0621.5   21.5
 50  0.7  3.3814.1   14.1
 50  0.8 -1.075.16   5.16
100  0.3 -6.4140.3   40.3
100  0.4 -10.621.0   21.0
100  0.5 -9.0213.2   13.2
100  0.6 -9.855.14   5.14
100  0.7 -7.942.08   2.08
100  0.8 -4.811.28   1.28
", header = TRUE )
dta2 <- (   dta
%>% mutate( samp.N = factor( samp.N )
  , RSQ = factor( RSQ )
  )
%>% gather( Measure, value, -c( samp.N, RSQ ) )
)

ggplot( dta2, aes( x = RSQ, y = value, fill = samp.N ) ) +
  geom_bar( stat = "identity", position = "dodge", colour = "black" ) +
  facet_wrap( ~ Measure, ncol = 1, scale = "free_y" ) +
  ylab( "" )




On Sat, 20 Apr 2019, Scott Colwell wrote:


I am trying to figure out how to create a hanging bar plot from dplyr.
I have used dplyr as follows:
table4 <- cr %>%
 group_by(samp.N, RSQ) %>%
 summarize(
   MRB_uc = mean(CF.F1F2/0.40*100)-100,
   MRB_sb = mean(SBC.F1F2.Alpha/0.40*100) - 100,
   MRB_bp = mean(BPC.F1F2.Alpha/0.40*100) - 100
 )
which provides me with this:
  samp.N   RSQ MRB_uc MRB_sb MRB_bp
  
1 50   0.3   1.42  37.6   37.6
2 50   0.4   8.61  43.1   43.1
3 50   0.5   7.41  31.6   31.6
4 50   0.6   5.06  21.5   21.5
5 50   0.7   3.38  14.1   14.1
6 50   0.8  -1.07   5.16   5.16
7100   0.3  -6.41  40.3   40.3
8100   0.4 -10.6   21.0   21.0
9100   0.5  -9.02  13.2   13.2
10100   0.6  -9.85   5.14   5.14
11100   0.7  -7.94   2.08   2.08
12100   0.8  -4.81   1.28   1.28
What I want to do is create a hanging bar plot with the x-axis being samp.N 
value by RSQ value. The bars are then values of MRB_uc, MRB_sb, and MRB_bp. 
Given some values are negative, some bars will be above zero and others below 
(hence the hanging bar plot)
I don't have any code yet as I am completely unfamiliar with how to do this. 
Any suggestions would be really appreciated.
Thank you!
Scott




--
Scott R. Colwell, PhD


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



---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
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] troubles with foreign:read.dbf

2019-04-20 Thread Patrick Giraudoux
Ashes of my head and all those sorts of things...
If I was a totally a newbie in R, I could claim for some sort of excuse, 
but it is definitely not the case, even.
Thanks !
Patrick


Le 20/04/2019 à 19:13, Eric Berger a écrit :
> You seem to have a typo.
> In the case that works your filename is "Mailles_2011a.dbf"
> but in the case that fails your filename is "Mailles_2011a.shp"
> (different extensions)
>
> HTH,
> Eric
>
>
> On Sat, Apr 20, 2019 at 8:00 PM Patrick Giraudoux 
>  > wrote:
>
> Dear listers,
>
> I am using the package foreign function read.dbf and meet the
> following
> issue:
>
> i<-"Mailles_2011a.dbf"
>
> dbf<-read.dbf(i)
>
> works well BUT
>
> if I have a vector such as
>
> files <- c("Mailles_2011a.shp", "Mailles_2011p.shp",
> "Mailles_2012a.shp", "Mailles_2012p.shp", "Mailles_2013a.shp",
> "Mailles_2013p.shp", "Mailles_2014p.shp", "Mailles_2015a.shp",
> "Mailles_2015p.shp", "Mailles_2016p.shp")
>
> for(i in files) {
> dbf<-read.dbf(i)
> names(dbf)
> }
>
> gives the following error message:
>
> Error in read.dbf(i) : unable to open DBF file
>
> Same error with e.g.
>
> dbf<-read.dbf(files[1])
>
> Any idea about what's happening?
>
> Patrick
>
>
>         [[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] troubles with foreign:read.dbf

2019-04-20 Thread Eric Berger
You seem to have a typo.
In the case that works your filename is "Mailles_2011a.dbf"
but in the case that fails your filename is "Mailles_2011a.shp"
(different extensions)

HTH,
Eric


On Sat, Apr 20, 2019 at 8:00 PM Patrick Giraudoux <
patrick.giraud...@univ-fcomte.fr> wrote:

> Dear listers,
>
> I am using the package foreign function read.dbf and meet the following
> issue:
>
> i<-"Mailles_2011a.dbf"
>
> dbf<-read.dbf(i)
>
> works well BUT
>
> if I have a vector such as
>
> files <- c("Mailles_2011a.shp", "Mailles_2011p.shp",
> "Mailles_2012a.shp", "Mailles_2012p.shp", "Mailles_2013a.shp",
> "Mailles_2013p.shp", "Mailles_2014p.shp", "Mailles_2015a.shp",
> "Mailles_2015p.shp", "Mailles_2016p.shp")
>
> for(i in files) {
> dbf<-read.dbf(i)
> names(dbf)
> }
>
> gives the following error message:
>
> Error in read.dbf(i) : unable to open DBF file
>
> Same error with e.g.
>
> dbf<-read.dbf(files[1])
>
> Any idea about what's happening?
>
> Patrick
>
>
> [[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] troubles with foreign:read.dbf

2019-04-20 Thread Patrick Giraudoux
Dear listers,

I am using the package foreign function read.dbf and meet the following 
issue:

i<-"Mailles_2011a.dbf"

dbf<-read.dbf(i)

works well BUT

if I have a vector such as

files <- c("Mailles_2011a.shp", "Mailles_2011p.shp", 
"Mailles_2012a.shp", "Mailles_2012p.shp", "Mailles_2013a.shp", 
"Mailles_2013p.shp", "Mailles_2014p.shp", "Mailles_2015a.shp", 
"Mailles_2015p.shp", "Mailles_2016p.shp")

for(i in files) {
dbf<-read.dbf(i)
names(dbf)
}

gives the following error message:

Error in read.dbf(i) : unable to open DBF file

Same error with e.g.

dbf<-read.dbf(files[1])

Any idea about what's happening?

Patrick


[[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] Creating hanging bar plot in r from dplyr

2019-04-20 Thread Scott Colwell
I am trying to figure out how to create a hanging bar plot from dplyr.
I have used dplyr as follows:
table4 <- cr %>%
  group_by(samp.N, RSQ) %>%
  summarize(
MRB_uc = mean(CF.F1F2/0.40*100)-100,
MRB_sb = mean(SBC.F1F2.Alpha/0.40*100) - 100,
MRB_bp = mean(BPC.F1F2.Alpha/0.40*100) - 100
  )
which provides me with this:
   samp.N   RSQ MRB_uc MRB_sb MRB_bp
   
1 50   0.3   1.42  37.6   37.6
 2 50   0.4   8.61  43.1   43.1
 3 50   0.5   7.41  31.6   31.6
 4 50   0.6   5.06  21.5   21.5
 5 50   0.7   3.38  14.1   14.1
 6 50   0.8  -1.07   5.16   5.16
7100   0.3  -6.41  40.3   40.3
 8100   0.4 -10.6   21.0   21.0
 9100   0.5  -9.02  13.2   13.2
10100   0.6  -9.85   5.14   5.14
11100   0.7  -7.94   2.08   2.08
12100   0.8  -4.81   1.28   1.28
What I want to do is create a hanging bar plot with the x-axis being samp.N 
value by RSQ value. The bars are then values of MRB_uc, MRB_sb, and MRB_bp. 
Given some values are negative, some bars will be above zero and others below 
(hence the hanging bar plot)
I don't have any code yet as I am completely unfamiliar with how to do this. 
Any suggestions would be really appreciated.
Thank you!
Scott




--
Scott R. Colwell, PhD


[[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] .Call using multiple cores on linux after R 3.3.3

2019-04-20 Thread Jeff Newmiller
My guess would be that you are running with a non-CRAN distribution of R like 
Anaconda or MRAN that has MKL enabled?

On April 19, 2019 10:25:57 AM PDT, Youyi Fong  wrote:
>Hi, I am wondering why it is the case that in R 3.3.3, calling
>chngpt:chngptm uses only 1 core, but in later releases, e.g. R 3.4.3,
>it
>uses multiple cores on linux. The function chngpt:chngptm has a .Call
>to
>invoke a C/C++ function that performs bootstrapping. No explicit
>parallel
>computing instructions are used.
>Thanks,
>Youyi
>
>   [[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.

-- 
Sent from my phone. Please excuse my brevity.

__
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] .Call using multiple cores on linux after R 3.3.3

2019-04-20 Thread Youyi Fong
Hi, I am wondering why it is the case that in R 3.3.3, calling
chngpt:chngptm uses only 1 core, but in later releases, e.g. R 3.4.3, it
uses multiple cores on linux. The function chngpt:chngptm has a .Call to
invoke a C/C++ function that performs bootstrapping. No explicit parallel
computing instructions are used.
Thanks,
Youyi

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