Displaying 20 results from an estimated 20000 matches similar to: "short question about data frame manipulation"
2010 May 26
1
data frame manipulation change elements meeting criteria
Dear group,
Here is my df :
trade <-
structure(list(Trade.Status = c("DEL", "INS", "INS"), Instrument.Long.Name =
c("SUGAR NO.11",
"CORN", "CORN"), Delivery.Prompt.Date = c("Jul/10", "Jul/10",
"Jul/10"), Buy.Sell..Cleared. = c("Sell", "Buy", "Buy"), Volume = c(1L,
2L,
2010 Jun 01
1
data frame manipulation ddply
Dear group,
Here is my data frame:
futures <-
structure(list(DESCRIPTION = c("CORN Jul/10", "CORN Jul/10",
"CORN Jul/10", "CORN Jul/10", "CORN Jul/10", "LIVE CATTLE Aug/10",
"LIVE CATTLE Aug/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 Jul/10",
"SUGAR NO.11 Jul/10", "SUGAR NO.11
2010 May 04
2
R for web browser
Hi Everyone,
Does anyone know of any projects for running an interactive R session within
a web browser?
I'm looking for something similar to the one on the Ruby website
(http://tryruby.org), except for R.
Thanks for your responses in advance!
Lanna
-----
Lanna Jin
lannajin at gmail.com
510-898-8525
--
View this message in context:
2010 May 04
7
How to replace all <NA> values in a data.frame with another ( not 0) value
I need to replace <NA> occurrences in multiple columns in a data.frame
with "000/000"
how do I achieve this?
Thanks
Nevil Amos
2010 Mar 10
2
function to create multiple matrices
Hi All,
If given a dataframe (long form) with Year, Species, and Location,
How would I write a function that would create a unique matrix of Species &
Location for each Year?
What I've tried doing is the following:
data #dataframe
dataT<-table(data$Species,data$Location,data$Year) #creates tables of
Species vs Location for each Year
But I'm encountering issues individually
2012 Feb 24
2
data frame manipulation with condition
Dear list,
n00b question, but still can't find any easy answer.
Here is a df:
> df<-data.frame(cbind(x=c("AA","BB","CC","AA"),y=1:4))
> df
x y
1 AA 1
2 BB 2
3 CC 3
4 AA 4
I want to modify this df this way :
if df$x=="AA" then df$y=df$y*10
if df$x=="BB" then df$y=df$y*25
and so on with other conditions.
TY for any
2010 May 26
5
(no subject)
Dear group,
Here is my data frame:
> dput(u)
structure(list(DESCRIPTION = structure(c(2L, 5L, 6L, 7L, 9L,
11L, 12L, 15L, 14L, 16L, 1L, 10L, 3L, 4L, 13L, 8L, 17L), .Label = c("COFFEE
C Jul/10",
"COPPER May/10", "CORN Jul/10", "CORN May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "HENRY HUB
2010 Apr 23
3
substract start from the end of the vector
Dear group,
Here is my df :
df <-
structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ",
"PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRIMARY NICKEL USD 04/06/10 "
), CREATED.DATE = structure(c(18361, 18361, 18325), class = "Date"),
QUANITY = c(-1L, 1L, 1L), CLOSING.PRICE = c("2,415.90", "2,415.90",
2012 Feb 27
1
compare two data frames with same columns names but of different dimensions
Dear List,
I want to compare and return the rows which are NOT in the two data frames. Classic methods don't work as the df have NOT the same dimensions.
Here are one example of my df:
reported <-
structure(list(Product = structure(c(1L, 1L, 1L, 1L, 2L, 2L,
3L, 4L, 5L, 5L), .Label = c("Cocoa", "Coffee C", "GC", "Sugar No 11",
"ZS"),
2012 Feb 27
2
compare two data frames of different dimensions and only keep unique rows
Dear list,
I am still struggling with something that should be easy: I compare two data frames with a lot of common rows and want to keep only rows that are NOT in both data frames, unique.
Here are an example of these data frame.
reported <-
structure(list(Product = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 3L, 4L, 5L, 5L), .Label = c("Cocoa", "Coffee C", "GC",
2010 May 03
8
Delete rows with duplicate field...
as a r noob i am having another problem:
i have a big dataframe where each row corresponds to one entry and each
column is a field...
for instance, i have the column ID and time and many more...
Id like to get a dataframe where all IDs are just included once (some users
with that ID might have several entries but Id like to kepp only one)..
when i use unique I only get a list of the levels (or
2009 Nov 06
1
using xyplot to plot frequencies
Hi all,
First off, thank you for the overwhelming response last time. I'm still
trying to figure out the syntax of R to plot some distributions of some
frequencies. I've managed to plot histograms from the data, but I would
like to clean it up using xyplot from library(lattice). Unfortunately
I cannot find a solution to my problem.
Given a dataframe "all2", with numerical
2010 May 12
1
data frame subscription
Dear group,
Here is my df :
pose16 <-
structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L,
6L, 7L, 8L, 9L, 12L), .Label = c("COPPER May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10",
"SOYBEANS Jul/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 May/10",
2010 Apr 23
2
read.csv data frame thousands separator
Dear group,
Here is my df, trades1 :
trades1 <-
structure(list(Instrument.Long.Name = c("CORN", "CORN", "CORN",
"CORN", "CORN", "SOYBEANS", "SOYBEANS", "SOYBEANS", "SOYBEANS",
"SOYBEANS", "SOYBEANS", "STANDARD LEAD USD", "STANDARD LEAD USD",
"SPCL
2010 Mar 16
1
nested looping functions and dataframes
Hey All,
So, I am confused how exactly to use nesting loop functions in R to spit out
data frames. I've managed to create a working function for my data set that
generates a data frame for a given set of Year i and Location j; but how
would I do it for all Years and Locations?
Here is my working function:
test<-function(i,j){
a<-x[which(x$Year==i & x$Location==j),]
2010 May 27
1
switch function
Dear group,
Here is my df :
trades <-
structure(list(Trade.Status = c("DEL", "INS", "INS"), Instrument.Long.Name =
c("SUGAR NO.11",
"CORN", "CORN"), Delivery.Prompt.Date = c("Jul/10", "Jul/10",
"Jul/10"), Buy.Sell..Cleared. = c("Sell", "Buy", "Buy"), Volume = c(1L,
2L, 1L),
2010 May 11
1
merging data frame
Dear group,
I have 3 data frames I would like to merge.
Here they are:
pose16 <-
structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L,
6L, 7L, 8L, 9L, 12L), .Label = c("COPPER May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "ROBUSTA COFFEE (10) Jul/10",
"SOYBEANS Jul/10", "SUGAR NO.11
2010 May 11
1
merge two data frames
Dear group,
I have these 2 following data frame:
allcon <-
structure(list(DESCRIPTION = structure(1:17, .Label = c("COFFEE C Jul/10",
"COPPER May/10", "CORN Jul/10", "CORN May/10", "COTTON NO.2 Jul/10",
"CRUDE OIL miNY May/10", "GOLD Jun/10", "HENRY HUB NATURAL GAS May/10",
"ROBUSTA COFFEE (10)
2010 Jun 01
1
data frame manipulation with zero rows
Dear group,
Here is the kind of data.frame I obtain every day with my function :
futures <-
structure(list(DESCRIPTION = c("CORN Jul/10", "CORN Jul/10",
"CORN Jul/10", "CORN Jul/10", "CORN Jul/10", "LIVE CATTLE Aug/10",
"LIVE CATTLE Aug/10", "SUGAR NO.11 Jul/10", "SUGAR NO.11 Jul/10",
"SUGAR
2010 Apr 16
1
data frame manipulation
Dear group,
Here is my data.frame :
df <-
structure(list(DESCRIPTION = c("PRM HGH GD ALU", "PRM HGH GD ALU",
"PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL", "PRIMARY NICKEL",
"STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ", "STANDARD LEAD ",
"STANDARD LEAD ",