Emails from eBay members asking questions come through as firstname.lastname@example.org which can make them hard to count as a group
The following R script re-codes them so they can be counted.
inbox$EADD <- ifelse(grepl("members.ebay.co.uk",inbox$From...Address.),
f <- ddply(inbox,c("EADD"),summarize,N=length(EADD))
Once you’ve identified the biggest culprits, make a rule to move or delete them from your email.
m <- matrix(rbinom(1000,1,.4),15,5)
diag(m) <- 0
g <- network(m, directed=FALSE)
When you have N levels of a factor but you would like M (M < N) you need to recode the data set.
when you run str(df) you get an idea that factors are numbered in any vetor or data frame.
We need to use a command to recode the levels. The command you use is ‘levels’:
levels(df$factor)[c(2,4,6,7)] = "Horse Whispering"
Which means: Take levels that have the internal numberings of 2,4,6,7 and convert them to being “Horse Whispering”.
To recode the rest you need to find the internal numbering of the new levels for the df:
because the levels that were formally 2,4,6 and 7 have now been recoded into a single value and you’ll have to adjust the integers that you are using every time you run the command.
Continue on until all the necessary coding has been completed.
To make sure you have recoded properly you should make a copy of the first factor and recode the copy rather than the original. That way you can compare new and old later:
table(df$OrigFactor , df$RecodedFactor)
Which will print out a table of counts for OrigFactor Vs RecodedFactor
dt <- as.Date('2010-01-01')
dts <- seq(dt,length =17, by="+1 month")
,"ward,year(end_Dttm) as [year]"
,",sum(datediff(mi,start_Dttm,end_Dttm)/1440.0) as LOS"
,"GROUP BY ward ,year(end_Dttm)"
,index=c("year","ward") # the different levels
,vSize = "LOS" # the value on which to scale the squares
walesCoast<-readShapeSpatial("Z:/MAPPING DATA/Meridian 2 Shape/data/coast_ln_polyline.shp", proj4string=CRS("+init=epsg:27700"))
walesUA<-readShapeSpatial("Z:/MAPPING DATA/Meridian 2 Shape/data/district_region.shp", proj4string=CRS("+init=epsg:27700"))
Generate a set of data where the distribution parameters change part way through:
The following table gives the distribution and the command for generating n data from each distribution.
||rnorm(n, mean=0, sd=1)
||rgamma(n, shape, scale=1)
||rweibull(n, shape, scale=1)
||rcauchy(n, location=0, scale=1)
||rbeta(n, shape1, shape2)
||rf(n, df1, df2)
||rbinom(n, size, prob)
||rmultinom(n, size, prob)
||rhyper(nn, m, n, k)
||rlogis(n, location=0, scale=1)
||rlnorm(n, meanlog=0, sdlog=1)
||rnbinom(n, size, prob)
||runif(n, min=0, max=1)
||rwilcox(nn, m, n), rsignrank(nn, n)