Displaying 20 results from an estimated 119 matches for "bod".
Did you mean:
body
2018 Jul 24
2
oddity in transform
The idea is that one wants to write the line of code below
in a general way which works the same
whether you specify ix as one column or multiple columns but the naming entirely
changes when you do this and BOD[, 1] and transform(BOD, X=..., Y=...) or
other hard coding solutions still require writing multiple cases.
ix <- 1:2
transform(BOD, X = BOD[ix] * seq(6))
On Tue, Jul 24, 2018 at 7:14 AM, Emil Bode <emil.bode at dans.knaw.nl> wrote:
> I think you meant to call BOD[,1]
> From ?tran...
2018 Jul 23
2
oddity in transform
Note the inconsistency in the names in these two examples. X.Time in
the first case and Time.1 in the second case.
> transform(BOD, X = BOD[1:2] * seq(6))
Time demand X.Time X.demand
1 1 8.3 1 8.3
2 2 10.3 4 20.6
3 3 19.0 9 57.0
4 4 16.0 16 64.0
5 5 15.6 25 78.0
6 7 19.8 42 118.8
> transform(BOD, X = BOD[1] * seq(6))
Tim...
2018 Jul 24
0
oddity in transform
I don't think it has much to do with transform in particular:
> BOD <- data.frame(Time = 1:6, demand = runif(6))
> BOD[["X"]] <- BOD[1:2] * seq(6); BOD
Time demand X.Time X.demand
1 1 0.8649628 1 0.8649628
2 2 0.5895380 4 1.1790761
3 3 0.6854635 9 2.0563906
4 4 0.4255801 16 1.7023206
5 5 0.5738793 25 2....
2009 Sep 28
6
SAS user now converting to R - Help with Transpose
I am just starting to code in R and need some help as I am used to doing this
in SAS.
I have a dataset that looks like this:
Chemical Well1 Well2 Well3 Well4
BOD 13.2 14.2 15.5 14.2
O2 7.8 2.6 3.5 2.4
TURB 10.2 14.6 18.5 17.3
and so on with more chemicals....
I would like to transpose my data so that it looks like this:
Chemical WellID Value
BOD Well1 13.2
BOD Well2 14.2
BOD Well3 15.5
BOD Well4 14.2
O2 Well1 7.8
O2 Well2 2.6
.... and so on
In sas I would...
2018 Jul 24
0
oddity in transform
I think you meant to call BOD[,1]
From ?transform, the ... arguments are supposed to be vectors, and BOD[1] is still a data.frame (with one column). So I don't think it's surprising transform gets confused by which name to use (X, or Time?), and kind of compromises on the name "Time". It's also in a note i...
2006 Oct 25
1
sourcing dput output
Is this not supposed to work?
> dput(BOD, file = "/BOD.R")
> source("/BOD.R")
Error in attributes(.Data) <- c(attributes(.Data), attrib) :
row names must be 'character' or 'integer', not 'double'
> dput(iris, file = "/iris.R")
> source("/iris.R")
Error in...
2024 Aug 27
1
transform
...bug I'd say. One issue is that the internal logic of transform() relies on
>
> e <- eval(substitute(list(...)), `_data`, parent.frame())
> tags <- names(e)
>
> so untagged entries in ... will not be included.
... unless at least one is tagged:
R> transform(BOD, 0:5, 1:6)
Time demand
1 1 8.3
2 2 10.3
3 3 19.0
4 4 16.0
5 5 15.6
6 7 19.8
R> transform(BOD, 0:5, 1:6, foo = 1)
Time demand 0:5 1:6 foo
1 1 8.3 0 1 1
2 2 10.3 1 2 1
3 3 19.0 2 3 1
4 4 16.0 3 4 1
5 5 15.6 4...
2024 Aug 24
1
transform
...lumn then it must
also be named but in that case it is not ignored and the names are made up of
a combination of that name and the data frame's names. I would have thought
that if we did not want a combination of names we would just not name the
argument.
# ignores second argument returning BOD unchanged
transform(BOD, data.frame(y = 1:6)) |> names()
## [1] "Time" "demand"
# ignores second argument returning BOD unchanged
transform(BOD, data.frame(y = 1:6, z = 6:1)) |> names()
## [1] "Time" "demand"
# with one column in data...
2006 Aug 11
3
An apply and rep question
Hi list,
I'm sure the explanation must be laughably simple to the experts out
there, but I just could figure it out. I have a simple data frame that
looks like,
>head(da.off)
DDate OffP
1 2005-01-01 41.23
2 2005-01-02 44.86
3 2005-01-03 44.86
4 2005-01-04 43.01
5 2005-01-05 45.47
6 2005-01-06 48.62
where the first column DDate currently is character, and OffP is
numeric.
I want
2007 Sep 07
3
Delete query in sqldf?
Dear All,
Is sqldf equipped with delete queries? I have tried delete queries but
with no success.
Thanks in advance,
Paul
2009 Aug 25
1
Help with nls and error messages singular gradient
Hi All,
I'm trying to run nls on the data from the study by Marske (Biochemical
Oxygen Demand Interpretation Using Sum of Squares Surface. M.S. thesis,
University of Wisconsin, Madison, 1967) and was reported in Bates and Watts
(1988).
Data is as follows, (stored as mydata)
time bod
1 1 0.47
2 2 0.74
3 3 1.17
4 4 1.42
5 5 1.60
6 7 1.84
7 9 2.19
8 11 2.17
I then run the following;
#Plot initial curve
plot(mydata$time, mydata$bod,xlab="Time (in days)",ylab="biochemical oxygen
demand (mg/l) ")
model <- nls(bod ~ beta1/(1 - exp(beta2...
2009 Aug 12
2
Symbolic references - passing variable names into functions
Hello All,
I am trying to write a function which would operate on columns of a
dataframe specified in parameters passed to that function.
f = function(dataf, col1 = "column1", col2 = "column2") {
dataf$col1 = dataf$col2 # just as an example
}
The above, of course, does not work as intended. In some languages one
can force evaluation of a variable, and then
1997 Dec 19
1
R-beta: a bug in the lm function ?
...r checking the need for power transformation. This function
works fine using the version 0.50 of R, but gives an error message
with version 0.60.
The lm function in version 0.60 is different from that in version 0.50.
Is there a bug in the new lm function?
Kung-Sik Chan
> BoxCox(lm(log.O2UP~BOD+TKN+TS+TVS+COD,data=alr222a))
Error in terms.default(formula, data = data) : unused argument to function
> traceback()
[1] "terms.default(formula, data = data)"
[2] "lm(model, ...)"
[3] "Box...
2007 Nov 24
5
how to calculate the return?
Hi, R-users,
data is a matrix like this
AMR BS GE HR MO UK SP500
1974 -0.3505 -0.1154 -0.4246 -0.2107 -0.0758 0.2331 -0.2647
1975 0.7083 0.2472 0.3719 0.2227 0.0213 0.3569 0.3720
1976 0.7329 0.3665 0.2550 0.5815 0.1276 0.0781 0.2384
1977 -0.2034 -0.4271 -0.0490 -0.0938 0.0712 -0.2721 -0.0718
1978 0.1663 -0.0452 -0.0573 0.2751 0.1372 -0.1346
2007 Oct 24
3
scoping problem
...nonadditivity. Here is a simplified version of the function I'd like to
write: (m is an object created by lm):
tukey.test <- function(m) {
m1 <- update(m, ~.+I(predict(m)^2))
summary(m1)$coef
}
The t-test for the added variable is Tukey's test. This won't work:
data(BOD)
m1 <- lm(demand~Time,BOD)
tukey.test(m1)
Error in predict(m) : object "m" not found
This function doesn't work for two reasons:
1. The statement m1 <- update(m, ~.+I(predict(m)^2)) can't see 'm' in
the call to predict.
2. If in creating m missing values had bee...
2011 Nov 07
1
RpgSQL row names
Hello,
Using the RpgSQL package, there must be a way to get the row names into the
table automatically. In the example below, I'm trying to get rid of the
cbind line, yet have the row names of the data frame populate a column.
> bentest = matrix(1:4,2,2)
> dimnames(bentest) = list(c('ra','rb'),c('ca','cb'))
> bentest
ca cb
ra 1 3
rb 2 4
>
2011 Nov 08
1
dbWriteTable with field data type
Hello,
When I do:
dbWriteTable(con, "r.BOD", cbind(row_names = rownames(BOD), BOD))
...can I specify the data types such as varchar(12), float, double
precision, etc. for each of the fields/columns?
If not, what is the best way to create a table with specified field data
types (with the RpgSQL package/R)?
Regards,
Ben
[[alternati...
2011 Nov 08
2
multi-line query
Hello,
I'm using package RpgSQL. Is there a better way to create a multi-line
query/character string? I'm looking for less to type and readability.
This is not very readable for large queries:
s <- 'create table r.BOD("id" int primary key,"name" varchar(12))'
I write a lot of code, so I'm looking to type less than this, but it is
more readable from and SQL standpoint:
s <- gsub("\n", "", 'create table r.BOD(
"id" int primary key
,"name"...
2010 Jun 27
2
Ways to work with R and Postgres
Hi,
I post this message to the general r-help list hoping anyone within a wider range have suggestions:
There are three ways to integration R and postgres, especially on 64bit Microsoft windows Platform,
1. via RODBC package, which has 32 bit and 64 bit version for windows
2. via RPostgres interface, which only has 32bit version currently
3. via plr for Greenplum, which only supports a
2011 Apr 05
1
Names of a data set in a package
For some reason I want to let one data set in a package be known under
two different names. Is that possible, and if so, how? I do not want to
have two copies of the data set in the package.
Thanks,
G?ran
--
G?ran Brostr?m
Department of Statistics
Ume? University
SE-90187 Ume?, Sweden