similar to: weighted mean by week

Displaying 20 results from an estimated 1000 matches similar to: "weighted mean by week"

2007 Jun 15
2
model.frame: how does one use it?
Philipp Benner reported a Debian bug report against r-cran-rpart aka rpart. In short, the issue has to do with how rpart evaluates a formula and supporting arguments, in particular 'weights'. A simple contrived example is ----------------------------------------------------------------------------- library(rpart) ## using data from help(rpart), set up simple example myformula <-
2013 Mar 05
1
Remote database & local database, and adding new weight found vtable error
Hello, guys. Q1. now I have load all the docid and its document data into a dictionary for faster loading data instead of calling Xapian::MSetIterator i; i.get_document().get_data(); but I was happened to discover that the dictionaries got by such two method were different: both methods use DB1, DB2 method 1: Xapian::Database db = Xapian::Database(the path of DB1); Xapian::Database db2 =
2011 Aug 04
2
Efficient way of creating a shifted (lagged) variable?
Hello! I have a data set: set.seed(123) y<-data.frame(week=seq(as.Date("2010-01-03"), as.Date("2011-01-31"),by="week")) y$var1<-c(1,2,3,round(rnorm(54),1)) y$var2<-c(10,20,30,round(rnorm(54),1)) # All I need is to create lagged variables for var1 and var2. I looked around a bit and found several ways of doing it. They all seem quite complicated - while in
2010 Jun 03
1
mlogit and weights
Hello, I can't figure out why using and not using weights in mlogit yields identical results. My motivation is for the case when an "observation" or "individual" represents a number of individuals. For example, library(mlogit) library(AER) data("TravelMode", package = "AER") TM <- mlogit.data(TravelMode, choice = "choice", shape =
2013 Feb 12
3
grabbing from elements of a list without a loop
Hello! # I have a list with several data frames: mylist<-list(data.frame(a=1:2,b=2:3), data.frame(a=3:4,b=5:6),data.frame(a=7:8,b=9:10)) (mylist) # I want to grab only one specific column from each list element neededcolumns<-c(1,2,0) # number of the column I need from each element of the list # Below, I am doing it using a loop: newlist<-NULL for(i in 1:length(mylist) ) {
2005 Dec 29
1
Repeating functions
Hi, I have a number of spatial weight files and using Roger Bivand's spdep, I would like to 1. Convert them into neighbor lists using 2. Convert the neighbor lists into spatial weights For a given file, the syntax would be mygal_nb1 <- read.gal("mygalfile1", override.id = TRUE) myweight1 <- nb2listw(mygal_nb1) I have mygalfile[i] with i from 1 through to 6 and would like to
2009 Jul 21
0
Accessing list object from within a function as a list element
Hi - I have a list (call it 'mylist') with the following elements: (i) a function (call it 'myfunc' and expressed as 'mylist$myfunc') and (ii) a variable (call it 'myvar' and expressed as 'mylist$myvar'). Since I use mylist as a pseudo-class (I assign mylist to multiple different R objects), I would like to access the mylist R object from within the
2013 Mar 04
2
Need Beginner Guide for Matcher Optimisations Project
Hi, While searching for a project which matches my interest andskill level, I found this project named Matcher Optimization. This project is really challenging and excting from my view point and I would like to be a part of this project. Optimization techniques metioned in the reference links provided will take some time for me to have a good understanding about them. But I am trying to get my
2012 Aug 28
3
Get variable data Reading from the list
Here i have a variable MyVar <- data.frame(read.csv("D:\\Doc.csv")) And now i am storing this variable name into a list. MyList <- list() MyList [length(MyList )+1]<- "MyVar" Now what is the requirement is, i need to call the variable name "MyVar" from the list "MyList " and get the data.
2006 Nov 07
1
variable problem
Hi everyone, I am not sure this is possible so I would be interested in your responses. Say I have a variable 'v' with the string "myargument" in and I have a function 'f' that takes this argument as follows; f <- function( myargument=5 ) { ... does something... } Is there anyway I can say something like; f( v=10 ) such that it will be evaluated as f(
2011 Jul 14
2
cbind in aggregate formula - based on an existing object (vector)
Hello! I am aggregating using a formula in aggregate - of the type: aggregate(cbind(var1,var2,var3)~factor1+factor2,sum,data=mydata) However, I actually have an object (vector of my variables to be aggregated): myvars<-c("var1","var2","var3") I'd like my aggregate formula (its "cbind" part) to be able to use my "myvars" object. Is it
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 Jul 21
4
rhsape2 bug?
All, I believe I am running the latest version of rshape2 (1.2.1). But this code: library(reshape2) tmp <- melt(smiths, id.vars=1:2, measure.vars=c("age","weight","height"), variable.name="myvars", value.name="myvals" ) names(tmp) Produces this output: > names(tmp) [1] "subject" "time"
2012 Jun 27
1
Error: figure margins too large
Hello, I am running cluster analysis, and am attempting to create a graph of my clusters. I keep on getting an error that says that my figure margins are too large. d <- file.choose() d <- read.csv(d,header=TRUE) mydataS <- scale(d, center = TRUE, scale=TRUE) #Converts mydataS from a matrix to a data frame mydataS2 <- as.data.frame(mydataS) #removes "coden"
2011 Oct 19
1
Subsetting data by eliminating redundant variables
Dear All, I am new to R, I have one question which might be easy. I have a large data with more than 250 variable, i am reducing number of variables by redun function as in the example below, n <- 100 x1 <- runif(n) x2 <- runif(n) x3 <- x1 + x2 + runif(n)/10 x4 <- x1 + x2 + x3 + runif(n)/10 x5 <- factor(sample(c('a','b','c'),n,replace=TRUE)) x6 <-
2012 Aug 01
1
optim() for ordered logit model with parallel regression assumption
Dear R listers, I am learning the MLE utility optim() in R to program ordered logit models just as an exercise. See below I have three independent variables, x1, x2, and x3. Y is coded as ordinal from 1 to 4. Y is not yet a factor variable here. The ordered logit model satisfies the parallel regression assumption. The following codes can run through, but results were totally different from what I
2011 Aug 05
2
summing columns with NAs present
Hello! I have a data frame with some NAs. test<-data.frame(a=c(1,2,NA),b=c(10,NA,20)) I need to sum up values in 2 variables. However: test$a+test$b procudes NAs in rows that have NAs. How could I sum up columns while ignoring NAs (the way the function sum(..., na.rm=T) works? Thank you! -- Dimitri Liakhovitski marketfusionanalytics.com
2011 Sep 16
2
"rounding" to a number that is LOWER than my number
Hello! What function would allow me to "round" down, rather than up? For example, x<-1.98 I'd like to get 1.9 - rather than 2.0. Reason - I am creating a minimum for an axis for a plot, and I need it to be lower than x (which, in turn, is the lowest number already). Thank you! -- Dimitri Liakhovitski marketfusionanalytics.com
2013 Feb 01
2
expand.grid on contents of a list
Hello! I have a list of variable length. One example is: X=vector("list",3) X[[1]]=1:2 X[[2]]=1:2 X[[3]]=1:2 How could I run expand.grid on the elements of X so that the results would be the same as expand.grid(1:2,1:2,1:2)? Thank you! Dimitri -- Dimitri Liakhovitski gfk.com <http://marketfusionanalytics.com/> [[alternative HTML version deleted]]
2012 Mar 19
2
Reshape from long to wide
Hi, I'm a total beginner in R and this question is probably very simple but I've spent hours reading about it and can't find the answer. I'm trying to reshape a data table from long to wide format. I've tried reshape() and cast() but I get error messages every time and I can't figure why. In my data, I have the length of two fish from each family. My data table (called