search for: datafram

Displaying 20 results from an estimated 4798 matches for "datafram".

Did you mean: dataframe
2010 Apr 28
7
operator problem within function
Dear all, i have a problem with processing dataframes within a function using the "$". HereĀ“s my code: recode_items = function(dataframe,number,medium=2){ # this works q<-paste("columna",number,sep="") # this does not work, particularly because "dataframe" is not processed # dataframe should be: gi...
2006 Nov 08
2
combining dataframes with different numbers of columns
Dear list members, I have to combine dataframes together. However they contain different numbers of variables. It is possible that all the variables in the dataframe with fewer variables are contained in the dataframe with more variables, though it is not always the case. There are key variables identifying observations. These could be...
2006 Feb 25
2
Adding header lines to a dataframe that is exported using write.csv
I would like to export a dataframe to a .csv using: >write.csv(dataframe,"dataframe.csv") but I need to add four "header" lines to the csv that are not part of the dataframe (which itself has a line of column headers). The difficulty (for me, at least!) lies in the requirement that certain elements of the...
2009 Mar 23
1
Confusion regarding environments invoked by "source" command
Colleagues, R version 2.8.1 in OS X Within a function (which is already within a function), I am sourcing a file. The syntax of the command is something like (this is just an example; the actual code is much more complicated): BIGFUNCTION <- function() { DATAFRAME <- [some commands to create a dataframe] MYFUNCTION(DATAFRAME) } MYFUNCTION <- function(DATAFRAME) { print(ls()) exists("DATAFRAME") source("myfile", local=T) } The file "myfile" contains the following: print(DATAFRAME) When I execute BIGFUNCTION from...
2008 Oct 26
3
Process dataframes from list
Hi all, I have roughly fifty dataframes and a dataframe with the names of the fifty dataframes. I want to perform the same set of manipulations on all fifty dataframes, but can't find a way to batch process from a list with the dataframe names using a loop. Is there a way to read the file names from the dataframe with the names an...
2011 Jun 30
1
Match strings across two differently sized dataframes and copy corresponding row to dataframe
Hello- Sorry, this is a bit of a noob question, but I can't seem to progress it any further. I have two dataframes which contain a series of strings which exactly match. The problem is one has more rows than the other (more cases have been added) and they have been sorted so that they are not in the same order. The smaller dataframe, though, contains in another column which has codes classifying the strings....
2011 Apr 01
3
programming: telling a function where to look for the entered variables
Hi there, Could someone help me with the following programming problem..? I have written a function that works for my intended purpose, but it is quite closely tied to a particular dataframe and the names of the variables in this dataframe. However, I'd like to use the same function for different dataframes and variables. My problem is that I'm not quite sure how to tell my function in which dataframe the entered variables are located. Here's some reproducible data and th...
2012 Dec 11
5
Renaming column names according to another dataframe
Hi, I've got a dataframe having a code as column name. Addtionally I have another dataframe with a two columns (and lots of rows), the first containing the code and the second some Text (real name). Now I'd like to use the information (pairs of code and name) of the second dataframe to rename all the columnnames in t...
2011 Oct 07
2
Merge dataframes
Hello, I am having some problems to use the 'merge' function. I'm not sure if I got its working right. What I want to do is: 1) Suppose I have a dataframe like: height width 1 1.1 2.3 2 2.1 2.5 3 1.8 1.9 4 1.6 2.1 5 1.8 2.4 2) And I generate a second dataframe sampled from this one, like: height width 1...
2018 Apr 21
2
Check if row of dataframe is superset of any row in another dataframe.
Hi, I am looking for a way in which I can check if rows in 1 dataframe are present in another data frame in a unique way. A row in dataframe should be super set of any row in another dataframe. I can write a for loop for it, however, that will be inefficient. So, I am looking for an efficient way to do this in R. I have explained it with an example below: I want t...
2007 May 14
2
creating a "list of 3 dataframes" from a "list of 2 dataframes" and a dataframe?
#I wish to create a "list of three dataframes" ("results2") from a "list of two dataframes" (temp) and a dataframe ("c")? #Please advise. a <- data.frame(x=c(1,2,3),y=c(5,7,9)) b <- data.frame(x=c(2,4,7,9),y=c(2,3,5,4)) c <- data.frame(x=c(22,34,7,9),y=c(52,63,5,4)) results1 <- list(a,b,c) #w...
2018 Apr 15
4
Adding a new conditional column to a list of dataframes
Hi all .., I have a list of 7000 dataframes with similar column headers and I wanted to add a new column to each dataframe based on a certain condition which is the same for all dataframes. When I extract one dataframe and apply my code it works very well as follows :- First suppose this is my first dataframe in the list > OneDF &l...
2003 May 18
1
How to split a dataframe into smaller constituent dataframes
I have read a large dataset into a dataframe using RODBC, the rows of data in the dataframe are (integer) timestamped and I would like to divide the original dataframe into n smaller dataframes where dataframe 1 contains all rows that had timestamps falling in the period 0-x1 minutes, dataframe 2 contains all rows that had timestamps fal...
2009 Oct 13
2
splitting dataframe, assign to new dataframe, add new rows to new dataframe
Hi, all, My objective is to split a dataframe named "cmbine" according to the value of "classes". After the split, I will take the first instance from each class and bin them into a new dataframe, "df1". In the 2nd iteration, I will take the 2nd available instance and bin them into another new dataframe, "df...
2009 May 10
1
Select the rows in a dataframe that matches a criteria in another dataframe
Hi everyone! Thank you for the help you have been given to me, and here I'm with another problem with my dataframes: I have two dataframes (with much more observations), like these: Dataframe1 Firm Year cash 500400200 2007 100 500400200 2006 200 500400200 2005 400 500400300 2007 300 500400300 2006 240 500400300 2005 120 500400400 2007 340 500400...
2003 Apr 07
5
How to sort a dataframe?
Dear R-helpers, for the purpose of plotting a dataframe, i am trying to sort a dataframe by one column, for example tester <- data.frame(one=c(3,2,1), two=c(2,3,1)) #> tester # one two #1 3 2 #2 2 3 #3 1 1 # I want to sort "tester" by column "one", so that i get a dataframe # that looks like: #one two #1 1 #...
2005 May 26
2
Q: changing the class of an object
Dear All, I have a list of dataframes, each cell in every dataframe (after I have cleaned up the dataframes) is either real or NA but have class character (I think). I would like to know how to change the class of every cell without using a for-loop. I currently have this dataframes <- sapply(1: no.of.subs, function(k) apply(dat...
2010 Mar 25
4
Creating dataframe of all possible variable combinations
Hello, I need to create a dataframe containing all possible combinations of three variables: SITE (101,102,103,104), WDAY (MON,TUE,WED,THR,FRI), and TOD (MORN, AFTN). There should be a total of 40 unique combinations in my dataframe. I used expand.grid() successfully(?) to create my dataframe, but then when I went to order it by SIT...
2011 Feb 09
3
Need help merging two dataframes
Hi R users, I am trying to extract some attributes (age, sex, area) from dataframe "AB" that has 101,269 observations of 28 variables to dataframe "t2" that has 47 observations of 6 variables. They share a column called "id", which is a factor with 47 levels. I want to end up with a dataframe that has 47 observations of 9 variables (the original 6...
2012 Feb 08
2
Split dataframe into new dataframes
Hi, I want to split a dataframe based on a grouping variable (in one column). The resulting new dataframes should be stored in a new variable. I tried to split the dataframe using split() and to store it using a FOR loop, but thats not working so far: df <- data.frame(A=c("A1","A1","A2","A2...