similar to: Adding values to the end of a data frame

Displaying 20 results from an estimated 8000 matches similar to: "Adding values to the end of a data frame"

2011 Jun 09
2
Problem with a if statement inside a function
I have a really long functions, and at the end of the function, I am using a if statement to tag certain keywords based on whether they have certain values contained in them. However, the if statement doesn't seem to work. When I had split up the commands into various functions, it worked fine, but I'm not sure what going on now that it's combined into a single function. myfunc
2011 Jun 09
1
Error: missing values where TRUE/FALSE needed
I'm writing a function and keep getting the following error message. myfunc <- function(lst) { lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate",
2011 Jun 09
1
Using a function inside a function
I'm trying to run a function inside a function but get an error message. lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate", "rates"), suffix3 =
2011 Jun 09
1
Trying to make code more efficient
I have a repetative task in R and i'm trying to find a more efficient way to perform the following task. lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"),
2011 Jun 06
1
Merge two columns of a data frame
I have the following data: prefix <- c("cheap", "budget") roots <- c("car insurance", "auto insurance") suffix <- c("quote", "quotes") prefix2 <- c("cheap", "budget") roots2 <- c("car insurance", "auto insurance") roots3 <- c("car insurance", "auto
2011 Jun 14
1
Invalid Regular Expression
I'm working with some data, and am trying to generate it in the following format. state city zipcode I like pizza 0 0 0 I live in Denver 0 1 0 All the fun stuff is in Alaska 1 0 0 he lives in 66062
2011 Dec 15
1
Reordering a numeric variable
I'm running a linear model in R using the car package. I have a variable education, which i have recoded and regrouped to my wishes. However, R seems to place each element of that variable in alphabetical order. When I am running the model, don't I need the model order from lowest to highest to make an inference that a one unit change in one variable produced a one unit change in
2012 Jul 19
3
Removing values from a string
So I have the following data frame and I want to know how I can remove all "NA" values from each string, and also remove all "|" values from the START of the string. So they should something like "auto|insurance" or "auto|insurance|quote" one = data.frame(keyword=c("|auto", "NA|auto|insurance|quote", "NA|auto|insurance",
2011 Jun 10
2
Counting the Number of Letters in a row
I'm trying to find the total number of letters in a row of a data frame. Let's say I have the following data frame. f1 <- data.frame(keyword=c("I live in Denver", I live in Kansas City, MO", "Pizza is good")) The following function gives me the number of characters in each string. So for "I live in Denver", I get 1, 4, 2, and 6. However, I want to
2011 Aug 29
1
Difference between a data frame and data table
I didn't learn about data tables until recently. (They're never covered in any intro R books). In any case, I'm not sure what (if any) is the difference between a data frame and a data table. Can anyone provide a brief explanation? Is one preferred over another or is it just dependent on the task at hand? Thanks, Abraham M. [[alternative HTML version deleted]]
2011 Aug 27
0
[LLVMdev] Is LLVM compatible with AMD?
Villmow, excuse me about the previous reply. :$ So, I'm thinking about OpenGL, or other generic graphical libraries. 2011/8/26 Villmow, Micah <Micah.Villmow at amd.com> > In what context? Also, please have all replies go to the mailing list and > not to the contributor directly.**** > > ** ** > > Thanks,**** > > Micah**** > > ** ** > > *From:*
2011 Jun 07
1
Regular Expressions for "Large" Data Set
I'm running R 2.13 on Ubuntu 10.10 I have a data set which is comprised of character strings. site = readLines('http://www.census.gov/tiger/tms/gazetteer/zips.txt') dat <- c("01, 35004, AL, ACMAR, 86.51557, 33.584132, 6055, 0.001499") dat I want to loop through the data and construct a data frame with the zip code, state abbreviation, and city name in seperate columns.
2011 Jul 19
1
Stacked Bar Plot in ggplot2
I'm trying to develop a stacked bar plot in R with ggplot2. My data: conv = c(10, 4.76, 17.14, 25, 26.47, 37.5, 20.83, 25.53, 32.5, 16.7, 27.33) click = c(20, 42, 35, 28, 34, 48, 48, 47, 40, 30, 30) date = c("July 7", "July 8", "July 9", "July 10", "July 11", "July 12", "July 13", "July 14", "July 15",
2005 Dec 22
1
add factor to dataframe given ranges
Hi all, I would like to factorize the entries in a dataframe given some groupings. E.g: mydf = data.frame( a = rnorm(100,10), b = rnorm(100,10), c = rgamma(100, 1, scale=1)) group = hist(mydf$c, breaks="FD") group$breaks The idea is to create a factor "mydf$d" with levels corresponding to the ranges in group$breaks. There must be an easy way to do this that I
2024 May 09
2
Strange variable names in factor regression
On converting character variables to ordered factors, regression result has strange names. Is it possible to obtain same variable names with and without intercept? Thanks, Naresh mydf <- data.frame(date = seq.Date(as.Date("2024-01-01"), as.Date("2024-03-31"), by = 1)) mydf[, "wday"] <- weekdays(mydf$date, abbreviate = TRUE) mydf.work <- subset(mydf, !(wday
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello! I have a data frame with dates. I need to create a new "month" that starts on the 20th of each month - because I'll need to aggregate my data later by that "shifted" month. I wrote the code below and it works. However, I was wondering if there is some ready-made function in some package - that makes it easier/more elegant? Thanks a lot! # Example data:
2011 Aug 27
3
[LLVMdev] OpenCL Backend
Hi, as you come to speak of it, i have implemented an OpenCL-Backend for LLVM as part of my bachelor thesis (and for GLSlang as well, see http://www.cdl.uni-saarland.de/publications/theses/moll_bsc.pdf ). However, the code is currently unreleased. But that could be arranged, if you are interested in using it. Regards, Simon Am Freitag, den 26.08.2011, 20:11 -0500 schrieb llvmdev-request at
2007 Sep 01
2
Comparing "transform" to "with"
Hi All, I've been successfully using the with function for analyses and the transform function for multiple transformations. Then I thought, why not use "with" for both? I ran into problems & couldn't figure them out from help files or books. So I created a simplified version of what I'm doing: rm( list=ls() ) x1<-c(1,3,3) x2<-c(3,2,1) x3<-c(2,5,2)
2009 Jan 20
5
Problem with subset() function?
Hi all, Can anyone explain why the following use of the subset() function produces a different outcome than the use of the "[" extractor? The subset() function as used in density(subset(mydf, ht >= 150.0 & wt <= 150.0, select = c(age))) appears to me from documentation to be equivalent to density(mydf[mydf$ht >= 150.0 & mydf$wt <= 150.0, "age"])
2005 Feb 03
2
Surprising Behavior of 'tapply'
Dear all, I wanted to make a two-way-table of two variables with a counting variable stored in another column of a dataframe. In version 1.9.1, the behavior is as expected as shown in the simplified example code. > sex <- rep(c("F", "M"), 5) > income <- c(rep("low", 5), rep("high", 5)) > count <- 1:10 > mydf <-