Displaying 20 results from an estimated 1000 matches similar to: "Syntax Check: rshape2 melt()"
2011 Oct 31
1
reshape2: Lost Values Between melt() and dcast()
Working with 5 subset streams from my source data frame, three of them
successfully call dcast(), but two fail:
jerritt.cast <- dcast(jerritt.melt, site + sampdate ~ param)
Aggregation function missing: defaulting to length
and
winters.cast <- dcast(winters.melt, site + sampdate ~ param)
Aggregation function missing: defaulting to length
Yet both data frames have the values in their
2011 Oct 24
2
Syntax Help for xyplot()
Thanks to David's help I subset my large data set and produced a smaller
one for a single stream and 7 factors of interest. The structure of this
data frame is:
str(burns.tds.anal)
'data.frame': 718 obs. of 4 variables:
$ site : Factor w/ 143 levels "BC-0.5","BC-1",..: 1 1 4 6 4 4 4 5 5 5
$ sampdate: Date, format: "1996-06-02"
2011 Nov 29
5
Why Numeric Values Become Factors in Data Frame
I have a data frame with 1 factor, one date, and 37 numeric values:
str(waterchem)
'data.frame': 3525 obs. of 39 variables:
site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 ...
$ sampdate : Date, format: "2007-12-12" "2008-03-15" ...
$ CO3 : num 1 1 6.7 1 1 1 1 1 1 1 ...
$ HCO3 : num 231 228 118 246
2011 Nov 02
2
Proper Syntax for Logical Subset in Subset()
I have measured values for 47 chemicals in a stream. After processing
the original data frame through reshape2, the recast data frame has this
structure:
'data.frame': 256 obs. of 47 variables:
$ site : Factor w/ 143 levels "BC-0.5","BC-1",..: 1 1 1 2 2 2 2 2 2 2
...
$ sampdate : Date, format: "1996-04-19" "1996-05-21" ...
$ Acid :
2012 Jan 02
1
Creating ZOO Matrix from Data Frame
I believe that I have a basic understanding of zoo and how to use read.zoo
on a text file, What I have not seen in the zoo help files and vignettes is
how to convert a data frame to a zoo matrix for irregular time series
analyses.
An example data frame is structured like this:
str(burns.cast)
'data.frame': 256 obs. of 47 variables:
$ site : Factor w/ 143 levels
2011 Sep 13
1
ZOO: Learning to apply it to my data
I have read ?zoo but am not sure how to relate the parameters (x,
order.by, frequency, and style) to my data.frame. The structure of the
data.frame is
'data.frame': 11169 obs. of 4 variables:
$ stream : Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 1 ...
$ sampdate: Date, format: "1987-07-23" "1987-09-17" ...
$ param : Factor w/
2011 Nov 09
4
Interpreting Multiple Linear Regression Summary
I would appreciate pointers on what I should read to understand this
output:
summary(lm(TDS ~ Cond + Ca + Cl + Mg + Na + SO4))
Call:
lm(formula = TDS ~ Cond + Ca + Cl + Mg + Na + SO4)
Residuals:
ALL 1 residuals are 0: no residual degrees of freedom!
Coefficients: (6 not defined because of singularities)
Estimate Std. Error t value Pr(>|t|)
(Intercept) 125 NA
2012 Jan 01
2
Lattice: Understanding How Points Connected by Lines
A data frame has one factor, one date, and one numeric column. When I plot
these using the default pch of the open circle (first attachment),
xyplot(TDS ~ sampdate | she.s, data = sheep.cast, main = 'TDS in Sheep
Creek', ylab = 'Concentration (mg/L)', xlab = 'Time')
I see the higher concentration points toward the right on several panels.
But, when I change to using a
2012 Jan 09
1
Different lm() Residuals Output
All but one of the summaries of multiple linear regressions in this
analysis set present the residuals by min, 1Q, median, 3Q, and max. Example:
lm(formula = TDS ~ Cond + Ca + Cl + Mg + Na + SO4, data = snow.cast)
Residuals:
Min 1Q Median 3Q Max -277.351 -32.551 -2.621
40.812 245.272
The one that doesn't has only a small number of rows (23) and presents the
2007 Mar 19
1
Where to put dll files for applications on a wine system?
.
I just copied all of my Paint Shop Pro 7 files from another partition
into a "Paint Shop Pro 7" subdirectory within the "Program Files"
directory on a new wine installation. When I run psp.exe, I got a very
long list of complaints/errors similar to this one:
err:module:import_dll Library MFC42.DLL (which is needed by
L"C:\\Program Files\\Paint Shop Pro
2009 Jan 28
2
Dynamic random effects model
All R experts,
How do I fit a dynamic Random effects model with a binary dependent variable
in R
Thanks
JCM
[[alternative HTML version deleted]]
2011 Dec 28
1
subset() missing one factor
The data set (called 'chemdata') has 6 columns (4 factors, 1 date, 1
numeric) and I need to create subsets for each of one of the factors
('stream'). This has worked flawlessly for all but two streams which were
created yesterday.
The command I use to create the subsets is like this:
> rnchH <- subset(chemdata, stream == 'RanchSpgsH', select = c(site, sampdate,
2009 Apr 20
7
Fitting linear models
I am not sure if this is an R-users question, but since most of you here
are statisticians, I decided to give it a shot.
I am using the lm() function in R to fit a dependent variable to a set
of 3 to 5 independent variables. For this, I used the following
commands:
>model1<-lm(function=PBW~SO4+NO3+NH4)
Coefficients:
(Intercept) SO4 NO3 NH4
0.01323 0.01968
2012 Jul 05
1
reshape2 errors on data frame
I've successfully reformatted data frames from long to wide with reshape2,
but this time I'm getting errors that I want to understand and resolve.
Here's the data frame structure and the results of the melt() and dcast()
functions:
str(waterchem)
'data.frame': 128412 obs. of 8 variables:
$ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1
2012 Jul 03
2
NADA Data Frame Format: Wide or Long?
I have water chemistry data with censored values (i.e., those less than
reporting levels) in a data frame with a narrow (i.e., database table)
format. The structure is:
$ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1 1 1 1 1 1 1 ...
$ sampdate: Date, format: "2007-12-12" "2007-12-12" ...
$ preeq0 : logi TRUE TRUE TRUE TRUE TRUE
2012 Aug 07
3
NADA Package: Referencing Data Frame Columns
The sample data sets that come with the NADA package are limited to one or
two variables and a censored measurement indicator column. I try to mimic
examples using my data but keep missing the target.
My water chemistry data is available in two formats: long (as seen in a
database table) and wide (as seen in a spreadsheet). The two structures are:
str(chem)
'data.frame': 65349 obs. of
2002 Sep 28
1
Getting .Python to Work Under Windows
Hi all,
I'm trying to call a function in a Python module (v2.2) from within R
(Windows, v1.5.0) but am not having any luck. I've installed
RSPython_0.4-0.zip and the following lines of code cause R to crash:
# R code
library(RSPython)
out <- .Python("samp1", .module="Sample")
# Python file: Sample.py
def samp1() :
return 1
Obviously this is not the actual Python
2009 Feb 06
1
glm package
Hi all,
can the glm package be used to estimate a logit model to panel data? I am
asking this
because stata has a standard logit model and then an xtlogit for
longitudinal data. Is there something
similar in R?
Thank you
jcm
[[alternative HTML version deleted]]
2011 Oct 04
3
How to subset() from data frame using specific rows
I have a data frame called chemdata with this structure:
> str(chemdata)
'data.frame': 14886 obs. of 4 variables:
$ site : Factor w/ 148 levels "BC-0.5","BC-1",..: 104 145 126 115 114 128 124 2 3 3 ...
$ sampdate: Date, format: "1996-12-27" "1996-08-22" ...
$ param : Factor w/ 8 levels "As","Ca","Cl",..:
2011 Sep 22
3
Bivariate Scatter Plots with Lattice
Data frame has this structure:
'data.frame': 11169 obs. of 4 variables:
$ stream : Factor w/ 37 levels "Burns","CIL",..: 1 1 1 1 1 1 1 1 1 1 ...
$ sampdate: Date, format: "1987-07-23" "1987-09-17" ...
$ param : Factor w/ 8 levels "As","Ca","Cl",..: 1 1 1 1 1 1 1 1 1 1 ...
$ quant : num 0.01 0.01 0.01 0.01