search for: plotdf

Displaying 9 results from an estimated 9 matches for "plotdf".

2005 Feb 03
1
Efficient selection and alteration of dataframe records
...by sequentially removing individuals of a given species (sometimes using weighted probabilities) and replacing the lost individuals with species identities randomly sampled from the remaining individuals. Thus I use two dataframes. One contains all the individuals and their species identities (plotdf). The other contains each species and their associated weights (traitdf). While I have code that works, it runs slowly. I suspect there is a more efficient way. First, I 'sample' one species from the species file (traitdf), then I use that result to 'subset' the individuals d...
2018 Jan 19
2
Split charts with ggplot2, tidyquant
...eparate panels in ggplot is to have a single variable that will be your response and a factor variable that indexes which original variable it came from. This can be accomplished in many ways, but the way I use is with the melt() function in the reshape2 package. For example, library(reshape2) plotDF <- melt(SPYdf, ??? ??? ??? ??? ??? ??? id.vars="Date", # variables to replicate ??? ??? ??? ??? ??? ??? measure.vars=c("close", "volume"), # variables to create index from ??? ??? ??? ??? ??? ??? variable.name="parameter", # name of new variable for i...
2013 Apr 11
1
Adding time series to time graphs
...s. The campaign time period is as follows: campaign<-seq.Date(from=as.Date('2011-09-06'), to=as.Date('2011-10-5'), by=1) I have a table of newspaper story frequencies containing a certain word that can be turned into a data.frame (or not). I'll reproduce it as a data.frame plotdf<-data.frame(story.dates=seq.Date(as.Date('2011-09-17'),as.Date('2011-09-30'), by=1), Freq=seq(1,14, by=1)) How do I overlay the frequency of newspaper stories in a line plot on a graph where the x-axis is a series of dates twice as long as the time series itself? The reason I...
2018 Jan 19
0
Split charts with ggplot2, tidyquant
...have a single variable that will be your response and a factor > variable that indexes which original variable it came from. This can be > accomplished in many ways, but the way I use is with the melt() function in > the reshape2 package. > For example, > > library(reshape2) > plotDF <- melt(SPYdf, > id.vars="Date", # variables to replicate > measure.vars=c("close", "volume"), # variables to > create index from > variable.name="parameter", # name of new...
2018 Jan 20
2
Split charts with ggplot2, tidyquant
...that will be your response and > a factor variable that indexes which original variable it came > from. This can be accomplished in many ways, but the way I use is > with the melt() function in the reshape2 package. > For example, > > library(reshape2) > plotDF <- melt(SPYdf, > ??? ??? ??? ??? ??? ??? id.vars="Date", # variables to replicate > ??? ??? ??? ??? ??? ??? measure.vars=c("close", "volume"), # > variables to create index from > variable.name <http://variable.name>="parameter...
2018 Jan 20
0
Split charts with ggplot2, tidyquant
...> a factor variable that indexes which original variable it came > > from. This can be accomplished in many ways, but the way I use is > > with the melt() function in the reshape2 package. > > For example, > > > > library(reshape2) > > plotDF <- melt(SPYdf, > > id.vars="Date", # variables to replicate > > measure.vars=c("close", "volume"), # > > variables to create index from > > variable.name <http://variable.name...
2018 Jan 21
1
Split charts with ggplot2, tidyquant
...indexes which original variable it came > >? ? ?from. This can be accomplished in many ways, but the way I > use is > >? ? ?with the melt() function in the reshape2 package. > >? ? ?For example, > > > >? ? ?library(reshape2) > >? ? ?plotDF <- melt(SPYdf, > >? ? ???? ??? ??? ??? ??? ??? id.vars="Date", # variables to replicate > >? ? ???? ??? ??? ??? ??? ??? measure.vars=c("close", "volume"), # > >? ? ?variables to create index from > > variable.name <http://v...
2018 Jan 18
0
Split charts with ggplot2, tidyquant
Hi Charlie, I am comfortable to put the data in any way that works best. Here are two possibilities: an xts and a data frame. library(quantmod) quantmod::getSymbols("SPY") # creates xts variable SPY SPYxts <- SPY[,c("SPY.Close","SPY.Volume")] SPYdf <- data.frame(Date=index(SPYxts),close=as.numeric(SPYxts$SPY.Close),
2018 Jan 18
3
Split charts with ggplot2, tidyquant
Could you provide some information on your data structure (e.g., are the two time series in separate columns in the data)? The solution is fairly straightforward once you have the data in the right structure. And I do not think tidyquant is necessary for what you want. Best, Charlie -- Charles Redmon GRA, Center for Research Methods and Data Analysis PhD Student, Department of Linguistics