search for: seanecon

Displaying 20 results from an estimated 26 matches for "seanecon".

2009 Apr 11
0
Sean / Re: question related to fitting overdispersion count data using lmer quasipoisson
Hey Buddy, Hope you have been doing well since last contact. If you have the answer to the following question, please let me know. If you have chance to travel up north. let me know. best, -Sean ---------- Forwarded message ---------- From: Sean Zhang <seanecon@gmail.com> Date: Sat, Apr 11, 2009 at 12:12 PM Subject: question related to fitting overdispersion count data using lmer quasipoisson To: r-help@r-project.org Cc: seanecon@gmail.com Dear R-helpers: I have a question related to fitting overdispersed count data using lmer. Basically, I simulate...
2009 Sep 22
3
how to convert character string with only month and year into date
Dear R helpers. I am new to plotting time data using R. wonder how to convert character time info into date in R. I searched over the web but did not find answer. the input character string is something like 03_1993 or 03-1993, so the precision is at month level. I tried the following but failed. #R code below. strptime(c("03_1993"),"%m_%Y")
2011 Jan 17
1
how to cut a multidimensional array along a chosen dimension and store each piece into a list
Dear R-Helpers, I wonder whether there is a function which cuts a multiple dimensional array along a chosen dimension and then store each piece (still an array of one dimension less) into a list. For example, arr <- array(seq(1*2*3*4),dim=c(1,2,3,4)) # I made a point to set the length of the first dimension be 1to test whether I worry about drop=F option. brkArrIntoListAlong <-
2009 Jan 23
1
3d scatter plot with both error bars and a flexibly fitted surface
Dear R-helpers: I, an entry level R user, wonder how make a 3d scatter plot with both error bars and a flexibly fitted surface. Can anyone eligthen me? Many Thanks in advance. -Sean [[alternative HTML version deleted]]
2009 Jul 27
1
how to use do.call together with cbind and get inside a function
Dear R-helpers: I have a question related to using do.call to call cbind and get. #the following works vec1 <- c(1,2) vec2 <- c(3,4) ColNameVec <- c('vec1','vec2') mat <- do.call("cbind",lapply(ColNameVec,get)) mat #put code above into a function then it does not work #before doing so, first remove vec1 and vec2 from global environment rm(vec1,vec2) test
2011 Jan 14
2
question about deparse(substitute(...))
Dear R helpers: I like to apply deparse(substitute()) on multiple arguments to collect the names of the arguments into a character vector. I used function test.fun as below. it works when there is only one input argument. but it does not work for multiple arguements. can someone kindly help? test.fun <- function(...){deparse(substitute(...))} test.fun(x) #this works test.fun(x,y,z) # I like
2009 Aug 17
1
how to pass more than one argument to the function called by lapply?
Dear R helpers: I wonder how to pass more than one argument to the function called by lapply. For example, #R code below --------------------------- indf <- data.frame(id=I(c('a','b')),y=c(1,10)) #I want to add an addition argument cutoff into the function called by lapply. outside.fun <- function(indf, cutoff) { unlist(lapply(split(indf, indf[,'id']),
2009 Apr 10
1
How to handle tabular form data in lmer without expanding the data into binary outcome form?
Dear R-gurus: I have a question about lmer. Basically, I have a dataset, in which each observation records number of trials (N) and number of events (Y) given a covariate combination(X) and group id (grp_id). So, my dataset is in tabular form. (in case my explanation of tabular form is unclear, please see the link:
2009 Mar 15
1
What is the best package for large data cleaning (not statistical analysis)?
Dear R helpers: I am a newbie to R and have a question related to cleaning large data frames in R. So far, I have been using SAS for data cleaning because my data sets are relatively large (handling multiple files, each could be as large as 5-10 G). I am not a fan of SAS at all and am eager to move data cleaning tasks into R completely. Seems to me, there are 3 options. Using SQL, ff or
2009 Jun 20
1
how to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels?
Dear R helpers: Sorry to bother for a basic question about model.matrix. Basically, I want to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels. I used model.matrix, but could not get what I want. The following is an example. #Suppose I have two dataframe A and B
2009 Feb 11
2
How to apply table() on subdata and stack outputs
Dear R helpers: I am a R novice and have a question about using table() to extract frequences over many sub-datasets. A small example input dataframe and wanted output dataframe are provided below. The real data is very large so a for loop is what I try to avoid. Can someone englithen me how to use sapply or the like to achieve it? Many thanks in advance! -Sean #example input dataframe id
2009 Jan 15
1
misalignment of x-axis when overlaying two plots using latticeExtra
Dear R-helpers: I am an entry-level R user and have a question related to overlaying a barchart and and a xyplot using latticeExtra. My problem is that when I overlay them I fail to align their x-axes. I show my problem below through an example. #the example data frame is provided below vec <-c(1,5.056656,0.5977967,0.06126587,0.08557778, 2,4.601049,0.5995989,0.05002188,0.11410027,
2008 Dec 24
3
Extract values based on indexes without looping?
Dear R-Helpers: I am a entry level user of R. Have the following question. Many thanks in advance. # value.vec stores values value.vec <- c('a','b','c') # which.vec stores the locations/indexs of values in value.vec. which.vec <- c(3, 2, 2, 1) # How can I obtain the following vector based on the value.vec and which.vec mentioned above # vector.I.want <-
2008 Dec 27
2
Object name vectcor as function input argument?
Dear R-helpers: I am new to R and ran into the following question and would appreicate your advice very much. My question: How to use a character vector that records object names as function input argument? I asked this question very recently and was advised to use get(). get() works when passing one single object name. but it does not work when passing multiple object names. For example, I
2009 Mar 09
3
How to write a function that accepts unlimited number of input arguments?
Dear R-helpers: I am an R newbie and have a question related to writing functions that accept unlimited number of input arguments. (I tried to peek into functions such as paste and cbind, but failed, I cannot see their codes..) Can someone kindly show me through a summation example? Say, we have input scalar, 1 2 3 4 5 then the ideal function, say sum.test, can do
2009 Mar 11
5
Is there any difference between <- and =
Dear R-helpers: I have a question related to <- and =. I saw very experienced R programmers use = rather than <- quite consistently. However, I heard from others that do not use = but always stick to <- when assigning valuese. I personally like = because I was using Matabl, But, would like to receive expert opinion to avoid potential trouble. Many thanks in advance. -Sean
2009 Dec 13
1
how to replace a single forward slash with a double backward slash in a string?
Dear R-helpers. Can someone kindly tell me how to replace a single forward slash with double backward slash in a string? i.e., from "a/b" to "a\\b" Many thanks in advance. -Sean [[alternative HTML version deleted]]
2011 Feb 07
1
how to efficiently extract elements of a list?
Dear R helper, I wonder whether there is a quick way to extract some elements for a list. for a vector we can do the following vec <- seq(3) names(vec) <- LETTERS[1:3] vec[c(1,3)] vec[c('A','C')] But for a list, test.l <- list(c(1,3),array(NA,c(1,2)),array(0,c(2,3))) names(test.l)<-LETTERS[1:3] The following does not work. is there some command (I was thinking of
2009 Feb 20
1
How to transfer a list of space delimited character elements into a char vector?
My dear R-helpers: I am a novice in R and have the following text string manipulation question. Is there a function that performs the job described below? Say, wanted_output <- c("ab", "cd", "ef") #the function_wanted can generate c("ab", "cd", "ef") using ab cd ef as the single input argument wanted_output <- function_wanted(ab
2009 Apr 11
0
question related to fitting overdispersion count data using lmer quasipoisson
Dear R-helpers: I have a question related to fitting overdispersed count data using lmer. Basically, I simulate an overdispsed data set by adding an observation-level normal random shock into exp(....+rnorm()). Then I fit a lmer quasipoisson model. The estimation results are very off (see model output of fit.lmer.over.quasi below). Can someone kindly explain to me what went wrong? Many thanks in