Displaying 20 results from an estimated 4000 matches similar to: "Entering Multiline Commands With ESS"
2011 Aug 30
3
Descriptive Stats from Data Frame
I don't find how to do what I need to do in Dalgaard or 'R Cookbook', so
I'm asking here.
I have a data frame with water chemistry data and I want to start
exploring these data. There are three factors (site, date, chemical)
associated with each measurement. The data frame looks like this:
> summary(chemdata)
site_id.sample_date.param.quant
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,
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 Aug 31
1
Correct Syntax for subset.data.frame()
I want to create individual data.frames for each of the 8 param factors in
chemdata. The syntax I tried (based on Teetor's book, page 132) and R's
response are:
> ars <- subset(chemdata, select=c(site,sampdate,param,quant), subset=(param
= "As"))
Error in subset.data.frame(chemdata, select = c(site, sampdate, param, :
'subset' must evaluate to logical
2011 Aug 31
3
Scatter Plot Command Syntax Using Data.Frame Source
I've tried various commands. ?plot, Teetor's book, "R Cookbook", and
Mittal's book, "R Graphs Cookbook" without seeing how to write the command
to create scatterplots from my data.frame. The structure is:
> str(chemdata)
'data.frame': 14886 obs. of 4 variables:
$ site : Factor w/ 148 levels "BC-0.5","BC-1",..: 104 145 126 115
2011 Oct 27
2
Syntax Check: rshape2 melt()
This is my first excursion into using reshape2 and I want to ensure that
the melt() function call is syntactically correct.
The unmodifed data frame is organized this way:
head(tds.anal)
site sampdate param quant
1 UDS-O 2006-12-06 TDS 10800
4 STC-FS 1996-06-14 Cond 280
7 UDS-O 2007-10-04 Mg 1620
9 UDS-O 2007-10-04 SO4 7580
19 JCM-10B 2007-06-21 Ca 79
20
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 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
2012 Jul 10
2
Understanding cenros Error
Before reading water chemistry into a data frame I removed all missing
data. Yet when I try to run cenros() to summarize a specific chemical I get
an error that I do not understand:
with( subset(chem, param=='Ag'), cenros(quant,ceneq1) )
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
NA/NaN/Inf in 'y'
I would like to learn what I did incorrectly
2012 Sep 28
1
Lattice bwplot(): Conditioning on one factor
I'm not able to create the proper syntax to specify a lattice bwplot() for
only one of two conditioning factors.
The syntax that produces a box plot of each of the two conditioning
factors is:
bwplot(quant ~ param | era, data=mg.d, main='Dissolved Magnesium', ylab='Concentration (mg/L)')
What I've tried unsuccessfully are:
bwplot(quant ~ param |
2012 Oct 23
1
Understanding lattice barchart() display
I've a data frame with this structure:
'data.frame': 1987 obs. of 11 variables:
$ site : Factor w/ 24 levels "B(W)","BC-1",..: 1 1 2 2 2 1 1 1 ...
$ sampdate : Date, format: "2000-07-18" "2000-07-18" ...
$ tclass : Factor w/ 8 levels "Annelida","Arachnida",..: 1 5 5 5 5 ...
$ torder : Factor
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
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 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
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
2009 Aug 20
1
Questions on factors in regression analysis
I got two questions on factors in regression:
Q1.
In a table, there a few categorical/factor variables, a few numerical
variables and the response variable is numeric. Some factors are important
but others not.
How to determine which categorical variables are significant to the
response variable?
Q2.
As we knew, lm can deal with categorical variables.
I thought, when there is a categorical
2013 Feb 02
1
Mixed Models: Contribution of random variable to final estimate
Dear all,
We want to test if the invasiveStatus is predicted by the amount (quant) of animals arriving to a country of a certain species (taxonid). We are using lmer to perform the model.
The model is:
lmer(invasiveStatus~I(log(quant+1))+I(log(inDegree+1))+(1|taxonid)+(1|country), family=binomial,data=td),
where invasiveStatus is a binary variable, quant and inDegree are integer variables, and
2012 Jun 07
1
Quantile regression: Discrepencies Between optimizer and rq()
Hello Everyone,
I'm currently learning about quantile regressions. I've been using an
optimizer to compare with the rq() command for quantile regression.
When I run the code, the results show that my coefficients are consistent
with rq(), but the intercept term can vary by a lot.
I don't think my optimizer code is wrong and suspects it has something to do
with the starting
2010 May 16
1
problems with generation of quantiles under For ()
Dear, I want to make an application to calculate quantile within a For()
I tried the following without success:
ej.
date
p_val <- matrix(sample(10, 1000, replace=TRUE), 200,5)
test 1
rr <- paste("p_val$",names(p_val[1]), sep="")
quant <- quantile(rr, probs = c(0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
100)/100, na.rm=FALSE, type=1)
test 2
rr <-
2012 May 08
1
what folder to run write_PACKAGES in?
I set up a local repo for testing packages. My packages are not
showing up from the repository when viewed by Linux clients. I suspect
this is a web administrator/firewall issue, but it could be I created
the repo wrongly. I am supposed to run write_PACKAGES separately in
each R-version folder. Right?
Maybe other novices can use these scripts, if they are not wrong :)
Here's the file