Displaying 20 results from an estimated 900 matches similar to: "gsub,regex and replacing"
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 Apr 28
3
data frame move columns
Dear group,
Here is my df:
avprix <-
structure(list(DESCRIPTION = c("CORN Jul/10", "CORN May/10",
"ROBUSTA COFFEE (10) Jul/10", "SOYBEANS Jul/10", "SPCL HIGH GRADE ZINC USD",
"STANDARD LEAD USD"), prix = c(-1.5, -1082, 11084, 1983.5, -2464,
-118), quantity = c(0, -3, 8, 2, -1, 0), fees = c(-8.64, -30.24,
-26.4, -25.92, -37.5,
2010 May 11
2
Regex and gsub
Dear group,
Here is my df :
df3 <-
structure(list(DESCRIPTION = 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",
"WHEAT Jul/10", "SPCL HIGH GRADE ZINC USD",
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 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 Aug 04
3
merge two data frames
Dear list,
here are my two data frames:
av <-
structure(list(DESCRIPTION = c("COFFEE C Sep/10", "COPPER Sep/10",
"CORN Dec/10", "CRUDE OIL miNY Sep/10", "GOLD Aug/10", "HENRY HUB
NATURAL GAS Sep/10",
"PALLADIUM Sep/10", "SILVER Sep/10", "SOYBEANS Nov/10", "SPCL HIGH
GRADE ZINC USD",
"SUGAR
2010 Apr 30
1
read.csv and blank character in object name of my data.frame
Dear group,
Here is my data frame:
position100415 <-
structure(list(DESCRIPTION = structure(1:9, .Label = c(" SUGAR NO.11 Jul/10
",
" SUGAR NO.11 May/10 ", "CORN May/10 ", "COTTON NO.2 Jul/10 ",
"CRUDE OIL miNY May/10 ", "ROBUSTA COFFEE (10) Jul/10 ", "SILVER May/10 ",
"SOYBEANS Jul/10 ", "WHEAT May/10
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 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 29
3
convert Factor as numeric
Dear group,
I know this issue has been already covered, and before you reply I must say
I have read the R-FAQ and search the mailing list archive.
I still can't manage to change my factor to numeric as I couldn't find any
clear answer.
Here is my df :
Pose1 <-
structure(list(DESCRIPTION = structure(c(1L, 2L, 3L, 4L, 5L,
8L), .Label = c(" SUGAR NO.11 May/10 ", "COTTON
2010 May 20
6
writing function
Dear group,
I am trying to write functions, but as a beginner, everything is not so
obvious.
Let's say I want the results in a list of elemts like this :
tot1, tot2, etc
Here is a function:
toto <-
function(x,y)
{
for(i in x:y){
paste(c("tot",i),collapse="")<-(i*2)
}
}
If I type this :
>toto(1,5)
I get this message error:
Error in paste(c("tot",
2010 Apr 15
1
sum rows in a data.frame...solution
Found this solution. It is maybe not the most elegant way, but it does the
job.
> a=as.data.frame(substr(lme$DESCRIPTION,1,14))
> colnames(a)=c("DESCRIPTION")
> lme=as.data.frame(c(a,lme[,2:3]))
> lme
DESCRIPTION CLOSING.PRICE POSITION
1 PRIMARY NICKEL 25,755.7100 0
2 PRIMARY NICKEL 25,760.8600 0
3 PRM HGH GD ALU 2,415.9000 0
2011 Feb 08
4
Interactions in a nls model
I am interested in testing two similar nls models to determine if the
lines are statistically different when fitted with two different data
sets; one corn, another soybean. I know I can do this in linear models
by testing for interactions. See Introductory Statistics with R by
Dallgaard p212-218 for an example. I have two different data sets I am
comparing to lai. ci.re should have very
2009 May 01
2
combine column names
Dear R-list,
Is there any way I can extract part or whole column name from two
variables and combine them? Not values, but column names.
For example,
I have data set with 70 variables. The column names are "Alfalfa",
"Corn","Soybean",..."Sunflower". After I combine the two variable (say
Alfalfa and Corn), I want to rename it as "AlfCor" or
2010 Apr 15
4
Does "sink" stand for anything?
Hello Everyone,
Learning about R and its wonderful array of functions. If it's not obvious, I usually try to find out what a function stands for. I think this helps me remember better.
One function that has me stumped is "sink." Can anyone tell me if this stands for something?
Thanks,
Paul
__________________________________________________
[[alternative HTML
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 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 ",
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),
2012 Mar 22
1
Simalteneous Equation Doubt in R
Hi List
l am interested in developing price model. I have found a research paper
related to price model of corn in US market where it has taken demand &
supply forces into consideration. Following are the equation:
Supply equation:
St= a0+a1Pt-1+a2Rt-1+a3St-1+a5D1+a6D2+a7D3+U1 -(1)
Where D1,D2,D3=Quarterly Dummy Variables(Since quarterly data are
considered)
Here, Supply