Displaying 2 results from an estimated 2 matches for "19900630".
2010 Mar 30
1
dataframe in loop
...to query from another table
"Monthly_return" to get the mret coresponding to every v.fundno.
I have only a basic idea of the code:
for (i in 1:length(v.fundno)){
gmret<-sqlQuery(channel,paste("select mret from Monthly_returns where
crsp_fundno =",test[i],'and caldt > 19900630 order by caldt'))
}
The loop doesn't work:( I realize it might be the problem that I didnt
define the dataframe, but my limited knowledge cant help me find out
how..
I will give you guys a example of my data:
head(v.fundno)
test<-head(v.fundno)
test
[1] "2899" "2903&...
2008 Jun 06
6
Subsetting to unique values
I want to take the first row of each unique ID value from a data frame.
For instance
> ddTable <-
data.frame(Id=c(1,1,2,2),name=c("Paul","Joe","Bob","Larry"))
I want a dataset that is
Id Name
1 Paul
2 Bob
> unique(ddTable)
Will give me all 4 rows, and
> unique(ddTable$Id)
Will give me c(1,2), but not accompanied by the name column.