Displaying 20 results from an estimated 33 matches for "brks".
Did you mean:
brk
2019 Mar 03
2
bug: sample( x, size, replace = TRUE, prob= skewed.probs) produces uniform sample
...stribution is produced.
Chuck
> set.seed(123)
>
> epsilon <- 1e-10
>
> ## uniform to 200 then small
> p200 <- prop.table( rep( c(1, epsilon), c(200, 999-200)))
> ## uniform to 201 then small
> p201 <- prop.table( rep( c(1, epsilon), c(201, 999-201)))
>
> brks <- c(0,99,199,200,201,Inf)
> tab200 <- sample( length(p200), 10000, prob=p200, replace=TRUE)
> tab201 <- sample( length(p201), 10000, prob=p201, replace=TRUE)
>
> cbind(
+ s200=table(cut(tab200, brks)),
+ p200=round(xtabs(p200 ~ cut( seq_along(p200), brks)) * 10000 ,1),
+...
2013 Jan 04
1
SpatialPolygon with the max value gets no color assigned in spplot function when using "at" parameter
Hi,
I would like to do coloring of map regions based on the region values
"weight". The approach I am taking is first to break regions into equal
intervals,
classIntervals(spdf$weight,4)$brks #4 intervals in this case
and coloring all regions within the interval with the same color
col = brewer.pal(4,"RdYlGn"))
The max "weight" is as well the boundary of the interval The problem is
that the last region is not included into the last interval nad has thus no
color....
2010 Sep 16
2
use same breaks and colors, but the displayed scale are different-image.plot()
...ample. I also list my method, but it does not work.
#Example data
x<- 1:10; y<- 1:10; z<- outer( x,y,"+");z2<- outer( x,y,"-")
#Quick view them
image.plot(x,y,z) #relatively larger value
image.plot(x,y,z2) #relatively small value
#define the same breaks and colors
brks<-quantile(c(as.vector(z),as.vector(z2)),na.rm=TRUE)
colsn<-length(brks)-1
cols<-gray((colsn:1)/colsn)
#I expect they use the same breaks and colors
par(mfrow=c(1,2))
image.plot(x,y,z,breaks=brks,col=cols)
image.plot(x,y,z2,breaks=brks,col=cols)
par(mfrow=c(1,1))
I think they really use t...
2010 Mar 24
0
Getting choropleth map intervals correct
...-25:666
ResProbs<-rnorm(642,0:1)
ResProbs[ResProbs>1]=.5
ResProbs[ResProbs<-1]=.2
ResProbs<-abs(ResProbs)
ResProbs..<-data.frame(ResTaz,ResProbs)
names(ResProbs..)<-c("Taz","SFsubM")
TazShape$SFsubM<-ResProbs..$SFsubM[match(TazShape$TAZ_NUM,ResProbs..$Taz)]
brks<-cut(TazShape$SFsubM, breaks=c(seq(0,1, by=0.1), Inf) ,
right=TRUE,include.lowest=TRUE)
cols <- grey((length(brks):2)/length(brks))
plot(TazShape, col=cols[findInterval(TazShape$SFsubM, brks,
all.inside=TRUE)])
I get the error:
Error in findInterval(TazShape$SFsubM, brks, all.inside = TRUE)...
2012 Oct 17
2
loop of quartile groups
Greetings R users,
My goal is to generate quartile groups of each variable in my data set. I
would like each experiment to have its designated group added as a
subsequent column. I can accomplish this individually with the following
code:
brks <- with(data_variables,
cut2(var2, g=4))
#I don't want the actual numbers, I need a numbered group
data$test1=factor(brks, labels=1:4)
However, I cannot get a loop to work nor can I get a loop to add the
columns with an appropriate name (ex. quartile_variable). I have trie...
2007 Jan 16
0
histbackback function code needs a change with R 2.4.1 version (PR#9456)
....4.1)
(With my previous version, 2.3.1, there was no such a problem)
If, e.g., you simply edit the command
> histbackback(rnorm(20), rnorm(30))
a warning message is printed on the console.
Warning messages:
1: argument 'probability' is not made use of in: hist.default(x, breaks = brks, plot = FALSE, probability = probability)
2: argument 'probability' is not made use of in: hist.default(y, breaks = brks, plot = FALSE, probability = probability)
To fix this problem I simply REPLACE lines 26-27 of histbackback() code:
ll <- hist(x, breaks = brks, plot = FALSE,prob...
2007 Sep 27
5
New R website: R-Cookbook.com
R Community,
I've put together a website that I thought this mailing list might be
interested in: http://www.r-cookbook.com
It's a (free) community-driven content management system for R
"recipes", or working examples. Some of the features of the site are
code highlighting, recipe ratings, recipe comments, personal "recipe
boxes" to save your favorite
2009 Jun 26
1
predicted values after fitting gamma2 function
...nd am having
problems getting my brain to function with the concept of "object as
class ...". The following is specifics of what I am doing:
I'm trying to determine the pdf from data I have created in a
simulation.
I have generated frequency counts using the following:
Max.brks <- pretty(range(Max.Spread$Distance), 100)
Max.f<-hist(x=Max.Spread$Distance,
breaks=Max.brks,plot=FALSE )
Max.cnt<-as.data.frame(cbind(sim,Max.f$mids,Max.f$counts))
colnames(Max.cnt)<-c("Simulation","MidPoint","Count")
then I fit...
2006 Nov 07
2
wrong fill colors in polygon-map
...to completely odd results (wrong colors for most of the
regions). I also tried simpler values (just 0 and 1 for different
regions), same problem. I tried to check whether there is any problem
with the match of data and district ids, but everything seemed to be
fine.
Sample code:
****************
brks.pat<-quantile(patenting$patbus)
#palette.pat<-c("green", "blue", "grey", "darkgrey", "red")
palette.pat<-c(rep("green", 4), "red")
plot(iab7.poly, col=palette.pat[findInterval(patenting$patbus,
brks.pat)])
legend(1200, -...
2011 Nov 29
1
Hmisc break points error
I am making frequency histograms using the histbackback function on my 2
datasets. However when I try to use the brks function:
foo<-histbackback(log(fie11),
log(fie86),ylim=c(0,9),probability=FALSE,axes=TRUE,ylab=("log10 Parcel
Size"),brks=16)
The graphic results in a 'NA' label for the y axis (no intervals are
returned)
Also when I use 'summary(foo)' the break values are retu...
2010 Mar 22
1
Setting breaks to data more appropriately
...t into and outer category representing everything >1. Im
using the breaks to inform some code for making a clorepleth map that
represents probabilities, which in some cases IS greater than 1 and i need
to identify those better. As my code stands now, my real data is put put
into this form when brks is called:
0% 10% 20% 30% 40% 50% 60%
0.00000000 0.05054675 0.07787235 0.11235238 0.14424786 0.18089360 0.21475990
70% 80% 90% 100%
0.26309899 0.30807771 0.39478573 0.67573483.
But what i want is for the values to be...
2017 Jun 18
3
R_using non linear regression with constraints
..., start = list( a = 2000
, b = 0.05
)
, lower = c( 1000, 0 )
, upper = c( 3000, 1 )
)
a <- as.vector( coef( myfit )[ "a" ] )
b <- as.vector( coef( myfit )[ "b" ] )
brks <- c( 500, 1e7, 2e7, 3e7, 4e7 )
ggplot( objdtass, aes( x=a, y=b, z = x, fill=x ) ) +
geom_tile() +
geom_contour( breaks= brks ) +
geom_point( x=a, y=b, colour="red" ) +
geom_point( x=objdtassmin$a
, y=objdtassmin$b
, colour="green&...
2008 Jul 29
3
table questions
Hi again!
Suppose I have the following:
> xy <- round(rexp(20),1)
> xy
[1] 0.1 3.4 1.6 0.4 1.0 1.4 0.2 0.3 1.6 0.2 0.0 0.1 0.1 1.0 2.0 0.9
2.5 0.1 1.5 0.4
> table(xy)
xy
0 0.1 0.2 0.3 0.4 0.9 1 1.4 1.5 1.6 2 2.5 3.4
1 4 2 1 2 1 2 1 1 2 1 1 1
>
Is there a way to set things up to have
0 - 0.4 0.5 - 0.9 etc. please?
I know there is the cut
2017 Jun 18
0
R_using non linear regression with constraints
..., b = 0.05
> )
> , lower = c( 1000, 0 )
> , upper = c( 3000, 1 )
> )
> a <- as.vector( coef( myfit )[ "a" ] )
> b <- as.vector( coef( myfit )[ "b" ] )
>
> brks <- c( 500, 1e7, 2e7, 3e7, 4e7 )
> ggplot( objdtass, aes( x=a, y=b, z = x, fill=x ) ) +
> geom_tile() +
> geom_contour( breaks= brks ) +
> geom_point( x=a, y=b, colour="red" ) +
> geom_point( x=objdtassmin$a
> , y=objdtassmin$b
>...
2017 Jul 09
2
Histogram plots in Lattice with spatialgrid dataframe data
...e package to generate an
array of histograms of
spatialgrid dataframe data.
I can use the sp package and spplot to generate an array of maps that
display an array of spatialgrid dataframe data -- that's good. I have:
spplot(ann_bias,xlim=c(1423987.5,2614612.5),ylim=c(-5862637.5,-4624387.5),at=brks,col.regions=colp(length(brks)-1),main="NOAA/NWS
OHRFC Stage-3/MPE Precipitation Estimate Bias with respect to PRISM\n1997 -
2016")
Which works... I can also do histogram(ann_bias$bias1997), which works too.
I have also created a 'time-series' of boxplots successfully with these
d...
2008 Dec 11
3
generate combination multiset (set with repetition)
Hi,
This has been asked before but not sufficiently answered from what I
could find. How do you create combinations
with repetitions (multisets) in R?
If I have
> set <- array(1:3)
And I want to choose all combinations of picking 2 numbers, I want to
get a print out like
[,1] [,2]
[1,] 1 1
[2,] 1 2
[3,] 1 3
[4,] 2 2
[5,] 2 3
[6,] 3 3
subsets(set,
2009 Dec 14
0
Confused on using expand.grid(), array(), image() and npudens(np) in my case
...=year.seq,x=x.seq,y=y.seq) #confusion2
fhat <- fitted(npudens(bws=bw, newdata=data.eval))
#Confusion3:what is the correct sequence for the three variables in the c()
options of array()
f <- array(fhat, c(51,51,3)) #number of year.seq is 3, and number of x.seq
and y.seq are 51,confusion3
brks <- quantile(f, seq(0,1,0.05));cols <-
heat.colors(length(brks)-1);oldpar <- par(mfrow=c(1,3))
#Confusion4:what is the correct sequence for the three variables(tf,x and y)
in the image()
for (i in 1:3) image(x.seq, y.seq, f[,,i],asp=1, xlab="", ylab="", main=i,
breaks=...
2010 Jul 19
1
heatmap.2() yielding an inappropriate key?
Esteemed R-users,
heatmap.2() is yielding an inappropriate key based on my colors and
break-points.
In the reproducible example below, the key is inappropriate (to me) because-
1. 'Orange' is simply not represented in the key, despite its prescence
in the heatmap.
2. The proportions of the key are clearly out, ie., my largest bin, (0.1
- 0.2) is half the range, but this bin (colored
2017 Jul 09
0
Histogram plots in Lattice with spatialgrid dataframe data
...histograms of
> spatialgrid dataframe data.
>
> I can use the sp package and spplot to generate an array of maps that
> display an array of spatialgrid dataframe data -- that's good. I have:
>
> spplot(ann_bias,xlim=c(1423987.5,2614612.5),ylim=c(-
> 5862637.5,-4624387.5),at=brks,col.regions=colp(length(brks)-1),main="NOAA/NWS
> OHRFC Stage-3/MPE Precipitation Estimate Bias with respect to PRISM\n1997 -
> 2016")
>
> Which works... I can also do histogram(ann_bias$bias1997), which works
> too. I have also created a 'time-series' of boxplots s...
2014 May 06
3
Mapa de quantiles con spplot
Hola,
El problema con la propuesta de Olivier es que los intervalos son
diferentes para cada variable.
La forma sencilla y rápida es:
spplot(zm["part88"], col.regions=plotclr, at=class$brks)
Pero para que quede más elegante hay que dar algunos pasos más:
## Intervalos en forma character
op <- options(digits=4)
tab <- print(class)
options(op)
intChar <- names(tab)
## Indice de correspondencia entre elemento e intervalo
idxP88 <- findCols(class)
## Es sólo un wrapper alred...