Displaying 20 results from an estimated 2000 matches similar to: "How to define degree=1 in mgcv"
2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
The behaviour of within() with list input changes if you delete 2 or more variables, compared to deleting one:
l <- list(x=1, y=2, z=3)
within(l,
{
rm(z)
})
#$x
#[1] 1
#
#$y
#[1] 2
within(l, {
rm(y)
rm(z)
})
#$x
#[1] 1
#
#$y
#NULL
#
#$z
#NULL
When 2 or more variables are deleted, the list entries are instead set to NULL. Is this intended?
2017 Jun 26
2
Odd behaviour in within.list() when deleting 2+ variables
>>>>> peter dalgaard <pdalgd at gmail.com>
>>>>> on Mon, 26 Jun 2017 13:43:28 +0200 writes:
> This seems to be due to changes made by Martin Maechler in
> 2008. Presumably this fixed something, but it escapes my
> memory.
Yes: The change set (svn -c46441) also contains the following NEWS entry
BUG FIXES
o
2007 Sep 16
1
Identifying objects from a data set
Hello
Given the following data for a data set called airquality. To identify the nature of the objects from the data set airquality example "Ozone" would it be best to use the command is. like is.character(airquality$Ozone) ....... I tried attributes(airquality$Ozone) but it came up null. Would there be a better way to identify these objects.
Thanking you in advance for your
2008 May 05
4
Column renaming
Dear all,
Is there a less cumbersome way to rename a column by name (as opposed
to index) than --
names( X)[ names[ X] == "bob"]<-"sue"
?
A semi-related question: how does one get the index of a column by
name, something along the lines of col.index( X, "sue") ?
Chip Barnaby
---------------------------------------------------------
Chip Barnaby
2005 Jul 01
2
Simple indexing conundrum
My apologies in advance for my thickness but I can't seem to solve the
following, seemingly simple, data manipulation problem:
I have a data frame that contains multiple factors and multiple
continuous response variables, but duplicates of some factor
combinations. The duplicates contain bad data, so I would like to
eliminate the duplicates. I would like to retain the entire rows
2001 Mar 22
1
two easy questions...
Hi all.
1) If I have a dataframe with variable names as follow: PC1 PC2 ... PCn and I want to pass only some of them to a function, e.g.
glm(resp~from PC1 to PC10, PC15, etc.,...)
is there a faster way than simply writing each variable name in the formula?
2) Again, I have a dataframe, say ali.df, with tha following variables: ali1, ali2, ...ali78
I want to sum, for example, ali1+al2+ali7+f rom
2008 Dec 23
3
Using transform to add a date column to a dataframe
I would like to add a column to the airquality dataset that contains the date
1950-01-01 in each row. This method does not appear to work:
> attach(airquality)
> data1 <- transform(airquality,Date=as.Date("1950-01-01"))
Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L, 23L, 19L, :
arguments imply differing number of rows: 153, 1
I can't decipher what
2008 Mar 24
2
Newbie help with Sweave
I think I've gotten my Emacs/Sweave/R system set up correctly, thanks to
Vincent and Jim, but I haven't been successful getting my first document
produced. I'm trying to use one of Friedrich Leisch's examples,
http://www.ci.tuwien.ac.at/~leisch/Sweave/example-1.Snw. I cut and
pasted the text into a document sweaveexample.Rnw in Emacs. It seemed to
be processed successfully with R:
2010 Nov 11
4
Troubleshooting sweave
Hi All,
I've reproduced the example from Prof. Friedrich Leisch's webpage. When I
write sweave("Example-1.Snw") OR sweave("Example-1.Rnw"), (yes, I renamed
them). I get the following error:
Writing to file example-1.tex
Processing code chunks ...
1 : echo term verbatim
Error: chunk 1
Error in library(ctest) : there is no package called 'ctest'
Also while
2006 Jan 29
1
What does this command "~" mean?
Hi all,
I am reading books and tutorials about R.
I don't understand the following:
plot(salary~rank, data=salary)
plot(Ozone~date, data=airquality)
I don't understand what does "~" here, and how can plot() have a input
argument called "data"... I have looked it up in "plot"'s help but I could
not find about argument "data".
Could you please
2011 Aug 04
1
randomForest partial dependence plot variable names
Hello,
I am running randomForest models on a number of species. I would like to be
able to automate the printing of dependence plots for the most important
variables in each model, but I am unable to figure out how to enter the
variable names into my code. I had originally thought to extract them from
the $importance matrix after sorting by metric (e.g. %IncMSE), but the
importance matrix is n
2011 Dec 23
2
cast in reshape and reshape2
> library(reshape2)
> x = melt(airquality, id=c('month', 'day'))
With reshape I can cast with multiple functions:
> library(reshape)
> cast(x, month+variable~., c(mean,sd))
month variable mean sd
1 5 ozone 23.615385 22.224449
2 5 solar.r 181.296296 115.075499
3 5 wind 11.622581 3.531450
4 5 temp 65.548387
2018 Dec 12
4
Subset dentro de un for
Muy buenas. Quiero hacer un loop en el que en cada iteración se hace
un subset con el que se queda con las muestras para la que cierta
variable es positiva.
Si hago esto, sale bien:
df2<-subset(df, subset = var1>0)
Pero he probado así (y de no sé cuantas formas más), antes de hacer el
for, y no sale:
GT<- c("var1","var2", ? )
df2<-subset(df,
2017 Dec 19
1
lm considers removed predictors when finding complete cases
Dear R-devel list,
I realized that removing a predictor in lm through the "-"'s operator in
formula() does not affect the complete cases that are considered. A minimal
example is:
summary(lm(Wind ~ ., data = airquality))
# 42 observations deleted due to missingness
summary(lm(Wind ~ . - Ozone, data = airquality))
# still 42 observations deleted due to missingness, even if only 7
2012 Feb 23
1
Sexpr not getting expanded in Sweave
An Sweave file, 'test.Rnw':
\documentclass{article}
\title{Sweave minimal}
\author{MK}
\begin{document}
\maketitle
We try Sweave:
<<1>>=
data(airquality)
summary(airquality)
x <- airquality[1, 1]
@
I try Sexpr: \Sexpr{x}
We plot:
\begin{center}
<<2, fig=TRUE, echo=FALSE >>=
boxplot(Ozone ~ Month, data = airquality)
@
\end{center}
\end{document}
I check the
2008 Feb 12
3
fun.aggregate=mean in reshape
Hi all,
We are facing a problem while introducing ourselves to Reshape package
use. Melt seems to work fine, but cast fails when we use mean as
fun.aggregate. As you see here, length and sum work fine, but mean
throws this same error whatever dataset we use.
> cast(aqm, month ~ variable, length)
month ozone solar.r wind temp
1 5 26 27 31 31
2 6 9 30 30
1999 Aug 24
3
Error in get(x, envir, mode, inherits)
Dear R list,
members of my course have encountered the following error message:
> slm <- lm(price ~ engsize, autoframe)
Error in get(x, envir, mode, inherits) : variable "FUN" was not found
[more context is given in the fuller listing below].
Once the error is encountered it seems to persist; for example early in one
session:
> summary(blin.fit)
Call:
lm(formula = Response
2018 Dec 12
2
Subset dentro de un for
Gracias a los tres, Raúl, Marcelino y Carlos.
Lo del "get" de Marcelino me da la respuesta a lo que yo exactamente
preguntaba, y funciona, pero ahora tengo problemas con el for, por lo
que probablemente recurra al eval parse de Raúl o Carlos, que ya
tienen el for. Aún así, lo intento 1º con el get.
Con subset(df, subset=get(GT[i])>0) el problema es que en el for hago
un
2011 Sep 22
3
Identifying Package for Function
While reading ?subset I'm referred to learn about dropvalues() as a
following operation. Yet, when I issue ?dropvalue I see, "No documentation
for '?dropvalues' in specified packages and libraries:".
How do I identify the library/package that contains a specific function
such as, in this case, dropvalues()?
Rich
2000 Jan 14
1
Error in dist command
Can anybody tell me why I get the following error:
Error in dist(airquality) : NA/NaN/Inf in foreign function call (arg 1)
Thanks,
Casper Frederiksen
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the