Displaying 20 results from an estimated 31 matches for "pearmain".
2008 Jun 06
2
Merging two dataframes
...the ETC data file only
has 67 and the SURVEY file only has 28. (Reading the help it looks as if it
merges 1 case with all cases in the other file, which is not what i want)
The matching variables fields are the 'ord' field and the 'uid' field
Can anyone advise please?
--
Michael Pearmain
[[alternative HTML version deleted]]
2011 Dec 23
2
missing value where TRUE/FALSE needed
Merry Xmas to all,
I am writing a function and curiously this runs sometimes on one data set
and fails on another and i cannot figure out why.
Any help much appreciated.
If i run the code below with
data <- iris[ ,1:4]
The code runs fine, but if i run on a large dataset i get the following
error (showing data structures as matrix is large)
> str(cluster.data)
num [1:9985, 1:811] 0 0 0 0
2009 Sep 15
2
Viewing Function Code
...bit of a stumbling block of a hidden
function, can anyone help?
> library(gplots)
> methods(barplot2)
[1] barplot2.default*
Non-visible functions are asterisked
> barplot2
function (height, ...)
UseMethod("barplot2")
<environment: namespace:gplots>
Mike
--
Michael Pearmain
Senior Analytics Research Specialist
"I abhor averages. I like the individual case. A man may have six meals
one day and none the next, making an average of three meals per day, but
that is not a good way to live. ~Louis D. Brandeis"
Google UK Ltd
Belgrave House
76 Buckingham Palace...
2008 Jun 17
2
Calling functions
Another newbie question.
I've written a function and saved the file as Xtabs.R, in a central place on
a network so others will be able ot use the function,
My question is how do i call this function?
I've tried to chance the working directory, and tried to load it via;
> library(Xtabs, lib.loc="//filer/common/technical/surveys/R_test")
but neither seem to work? the function
2011 Jun 23
2
Loading List data into R with scan()
Hi All,
I've been given a data file of the form:
1: 3,4,5,6
2:1,2,3
43: 5,7,8,9,5
and i want to read this data in as a list to create the form:
(guessing final look)
my.list
[[1]]
[1] 3 4 5 6
[[2]]
[1] 1 2 3
[[43]]
[1] 5 7 8 9 5
I can get to a stage using scan:
scan("my.data", what = character(0), quiet = TRUE)
to load
[1] "1: 3,4,5,6"
[2] "2:1,2,3"
[3]
2008 Dec 05
1
Loop swith String replacement
...1 2
12 Chrome 52 12 8.6696 1 2
13 Chrome 22 12 1.7443 0 2
14 Chrome 60 12 0.2253 0 2
15 Chrome 24 14 4.3348 1 3
--
Michael Pearmain
Senior Analytics Research Specialist
Google UK Ltd
Belgrave House
76 Buckingham Palace Road
London SW1W 9TQ
United Kingdom
t +44 (0) 2032191684
mpearmain@google.com
If you received this communication by mistake, please don't forward it to
anyone else (it may contain confidential or privilege...
2009 Aug 25
1
Help with nls and error messages singular gradient
...without
any problems, SPSS returns values of Beta1 = 2.4979 and Beta2 = -2.02 456)
but return the error message,
Error in nls(bod ~ beta1/(1 - exp(beta2 * time)), data = mydata, start =
list(beta1 = 3, : singular gradient
Can anyone offer any advice?
Thanks in advance
Mike
--
Michael Pearmain
Senior Analytics Research Specialist
“Statistics are like women; mirrors of purest virtue and truth, or like
whores to use as one pleases”
Google UK Ltd
Belgrave House
76 Buckingham Palace Road
London SW1W 9TQ
United Kingdom
t +44 (0) 2032191684
mpearmain@google.com
If you received this communic...
2008 Jun 20
2
Problems with basic loop
I'm having trouble creating a looping variable and i can't see wher ethe
problem arises from any hep gratfully appreciated
First create a table
x<-table(SURVEY$n_0,exposed)
> x
exposed
False True
Under 16 24 1
16-19 68 9
20-24 190 37
25-34 555 204
35-44 330 87
45-54 198 65
55-64 67 35
65+
2009 Oct 12
1
List mappings and variable creation
...combined c 2
counter true combined d 3
counter true combined e 1
So i dont have to create the dummy variables.
does this make sense?
Many thanks in advance
Mike
--
Michael Pearmain
"I abhor averages. I like the individual case. A man may have six meals
one day and none the next, making an average of three meals per day, but
that is not a good way to live. ~Louis D. Brandeis"
f you received this communication by mistake, please don't forward it to
anyone else...
2009 Nov 10
2
Numeric formatting question
Hi All,
I have am using Sweave and the \Sexpr{} to place some numeric variables in
my tex document. I want to format the number prior to entry so they read
slightly more elegantly.
Say i have the following numbers
x <- 0.00487324
y <- 0.000000432
z <- 0.567
I would like to have the numbers displayed as follows
x1 <- 0.0049
y1 <- 0.00000043
z1 <- 0.57
I've seen i can use
2008 Dec 31
3
Paste in a FOR loop
Hi All,
I've been having a little trouble using R2HTML and a loop, but can't figure
out where the problem lies, any hints gratefully received.
My code at the minute, (Which does work) is in the following:
library(R2HTML)
HTMLStart(outdir =
file.path("C://Example_work","R_projects","Dynamic_creative"),filename =
"RMDC_mockup",Title="Mock up for
2008 Aug 05
2
Selecting Variables
Hi All,
i have a dataset that i want to dynamically inspect for the number of
variables that start with "Exposure_" and then for these count the entries
across each case i.e
ID Exposure_1 Exposure_2 Exposure_3
1 y y y
2 y y -
3 y - -
So the corresponding new variables
2011 Feb 15
1
Passing Arguments in a function
Hi All,
I'm having some trouble assigning arguments inside a function to
produce a plot from a model
Can anyone help me? Below I've outlined the situation and examples of
failing and working code.
Regards
Mike
## data ##
decay.data <- ...
behaviors lift reach.uu estimated.conversions.uu total.reach
1 1 432.0083 770 770 0.00
2
2008 Sep 23
2
Contional
Hi All,
I'm having trouble selecting rows to delete, that i can't seem to overcome.
Below is some sample data, i am trying to dedup the data based on each user,
and simultaneously the timestamp (at the side i have highlighted expected
row to be removed)
I've looked at the lag function but can't seem to make it work?
My logic ran along the lines of an ifelse statement and then
2008 Oct 13
2
Timestamps and manipulations
Hi All,
I've a couple of questions i've been struggling with using the time
features, can anyone help? sample data
Timestamp user_id
27/05/08 22:57 763830873067 27/05/08 23:00 763830873067 27/05/08 23:01
763830873067 27/05/08 23:01 763830873067 05/06/08 11:34 763830873067
29/05/08
23:08 765253440317 29/05/08 23:06 765253440317 29/05/08 22:52
765253440317
2008 Jun 17
1
Z test and proportions
Hi All,
I have a table based on ordial data and i want to compare proportions and
i've seen in the pwr package i can use
power.prop.test
however i want to find out what the sig. value is based on n1,n2,p1,p2 and
this package doesn't contain this..
Does anyone know of a package that does or is it a case of writting a
function specifically for this?
Many thanks in advance
[[alternative
2008 Oct 02
1
Help with aggregation
Hi All,
I seem to be having a few troubles with aggregating data back onto the the
dataframe,
I want to take the max value of a user, and then apply this max value back
against all id's that match (i.e a one to many matching)
Can anyone offer any advice? is there a better way of doing this?
Dummy data and code are listed below:-
dataset is called Mcookie
user_id c_we_conversion
1
2008 Oct 02
1
Time conversion
...08-21:03:55
07-07-2008-19:52:55
07-07-2008-19:54:14
07-07-2008-15:24:01
07-07-2008-13:39:17
07-07-2008-13:39:55
timestamp<-strptime(timestamp,"%d-%m-%y-%H:%M:%S")
## then filter on the datetime
time<-ifelse(timestamp> "07-08-2008-00:00:00", TRUE, FALSE)
--
Michael Pearmain
Senior Statistical Analyst
Google UK Ltd
Belgrave House
76 Buckingham Palace Road
London SW1W 9TQ
United Kingdom
t +44 (0) 2032191684
mpearmain@google.com
If you received this communication by mistake, please don't forward it to
anyone else (it may contain confidential or privileged informat...
2008 Sep 22
1
Deleting multiple variables
Hi All,
i have searched the web for a simple solution but have been unable to find
one. Can anyone recommend a neat way of deleting multiple variable?
I see, i need to use dataframe$VAR<-NULL to get rid of one variable,
In my situation i need to delete all vars between two points.
I've used the 'which' function to find these out and have assigned to myvar
>myvars
[1] 2 17
but
2012 Jan 06
1
Assign and cmpfun
Hi All,
I've just recently discovered the cmpfun function, and was wanting to to
create a function to assign this to all the functions i have created, but
without explicitly naming them.
I've achieved this with:
foo <- function(x) { print(x)}
bar <- function(x) { print(x + 1)}
> foo <- function(x) { print(x)}
> foo
function(x) { print(x)}
> cmpfun(foo)
function(x) {