data.frame

referencing to an index dataframe and retreiving data where matches occur

Hi there, I am new to R and keen to learn but am finding myself particularly stuck on what seems to be a relatively straightforward idea. I have 2 dataframes. The first (ants) is data pertaining to a number of sites, each site has a unique ID, some sites have more than one row of data. It look like this: Site Date T...

using R - delete rows when a value repeated less than 3 times

Hi I have a data.frame with 10 rows and 3 columns a b c 1 1 201 1 2 2 202 1 3 3 203 1 4 4 204 1 5 5 205 4 6 6 206 5 7 7 207 4 8 8 208 4 9 9 209 8 10 10 210 5 I want to delete all rows where the same value in the column "c" repeated less than 3 times. In this example I want to remove rows 6, 9 and 10. (my real d...

[R] Extract Column from data.frame as a Vector

I'm new to R. I have a a Data.frame with a column called "Symbol". Symbol 1 "IDEA" 2 "PFC" 3 "RPL" 4 "SOBHA" I need to store its values as a vector(x = c("IDEA","PFC","RPL","SOBHA")). Which is the most concise way of doing this? Thanks in Advance ...

how to create the frame data structure with columns from csv data in R?

Hi, Below are the first five rows of the imported data in R: data[1:5,] user event_date day_of_week 1 00002781A2ADA816CDB0D138146BD63323CCDAB2 2010-09-04 Saturday 2 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-04 Saturday 3 00002D2354C7080C0868CB0E18C46157CA9F0FD4 2010-09-07 Tuesday 4 00002D2354C7080C0868CB0E18C46157...

Update data frame via function doesn't work...

Hello, I ran into a little problem using R… In the following data frame test <- data.frame(v1=c(rep(1,3),rep(2,3)),v2=0) I want to change values for v2 in the rows where v1 is 1. test[test$v1==1,"v2"] <- 10 works just fine. test v1 v2 1 1 10 2 1 10 3 1 10 4 2 0 5 2 0 6 2 0 However, I need to do that in a function. ...

Time-based averaging (sliding window) of columns in a data.frame

I have a data.frame which has multiple columns. One of the columns is time and is thus non-decreasing. Rest of the columns contain observations recorded at the time given by the time specified in a certain row of the data.frame. I want to select a window of time, say "x" seconds, and calculate the average (or for that matter any functio...

R chart by date

Hi all, I've got transactional data from a SQL query which I turn into a data frame. The first column of the df contains UNIX timestamps (format="%Y/%d/%m %H:%M") which I would like to use to create a graphics plot using par to display 1 unique lineplot per date. At the moment I am fumbling around with splitting column 1 and comparing wi...

Unwanted items on a plot

I have a problem while using a subset of a data.frame in R. The subset gets created and displayed correctly, but when I try to plot it using qplot(), the rows which were not selected by the subset() also get shown along one axis. The actual file I am reading in is a web server log, but I have created a small example to illustrate my pr...

iteratively constructed dataframe in Rx

Hi, I'm relatively new to R, and was wondering the most efficient way to iteratively construct a dataframe (one row at a time, the number of iterations "n" and the length of each row "l" are known beforehand). Create empty dataframe, add a row each iteration Preallocate n x l dataframe, modify a row each iteration Preallocate n x l mat...

Creating R data frames and .rdata files from Java

What is the most memory efficient and easiest (yes, I know those are sometimes mutually exclusive) way to create an R data frame then save it to an .Rdata file using Java? Go easy on me though, I'm not a Java developer. ...