similar to: how to NULL multiple variables of a df efficiently?

Displaying 20 results from an estimated 50000 matches similar to: "how to NULL multiple variables of a df efficiently?"

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
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 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
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 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")
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
2000 Dec 05
6
R or Splus?
It's been suggested I use R, I suppose because my employer is too skint to pay for a copy of Splus. But.... it doesn't seem to be stable. I was trying to do some ordinary regression and stepping through a model. I was trying to set up a model ('kitchen_sink') in which to put all my model parameters. Then I wanted to use step() to see what it would reduce the model to. 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
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 <-
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
2005 Aug 10
5
more patches
Here are a few patches 2 small changes and one a little hefty. All are to *.i files. SpinCtrl.patch - Changes cWxSpinCtrl.klass to mWxSpinCtrl in rb_define_method. Dialog.patch - Removed the %ignore wxDialog::wxDialog line, this line prevents Dialogs working with XRC. Window.i - Added special code for find_window_* methods so the correct object type is returned, this is very important when
2016 Aug 29
2
Automatic purging of old email in all mailboxes
"Scott W. Sander" <scottwsx96 at gmail.com> writes: > A few of the mailboxes in Dovecot receive hundreds of emails per day. I'd > like to automatically remove all emails in all mailboxes and mailbox > folders that were received more than 90 days prior to the received date. > As I'm a novice Dovecot administrator, I'm not exactly sure what the best > way
2006 Jun 06
8
How do I wrap a <%= link to %> around an image?
I''ve got a bunch of dynamically generated link paths that I want to use to link some dynamically-generated image paths. Specifically, I want to link thumbnails in a gallery to the larger images. But I''m stymied by Rails'' syntax. I can''t figure out how to do this. I tried this: <%= link_to(image_tag("../../images/photos/photo.photogroup/TN_
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
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 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,
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
2012 Nov 21
2
Weighted least squares
Hi everyone, I admit I am a bit of an R novice, and I was hoping someone could help me with this error message: Warning message: In lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : extra arguments weigths are just disregarded. My equation is: lm( Y ~ X1 + X2 + X3, weigths = seq(0.1, 1, by = 0.1)) -- View this message in context: