Displaying 20 results from an estimated 50000 matches similar to: "Variable descriptions of a built-in dataset"
2004 Dec 16
8
counting numbers without replicates in a vector
Hi,
I am just wondering if there is an easy way to count
in a numeric vector how many numbers don't have
replicates.
For example,
a=c(1,1,2,2,3,4,5), how can I know there are three
numbers (3, 4 and 5) without replicates?
Thank you!
Jun
=====
2006 Jun 21
1
Extract information from the summary of 'lm'
Hi Everyone,
I just don't know how to extract the information I
want from the summary of a linear regression model
fitting.
For example, I fit the following simple linear
regression model:
results = lm(y_var ~ x_var)
summary(results) gives me:
Call:
lm(formula = y_var ~ x_var)
Residuals:
Min 1Q Median 3Q Max
-5.9859 -1.5849 0.4574 2.0163 4.6015
Coefficients:
2003 Mar 24
2
Problem with the step() function
Dear all,
I'm having some problems with using the step() function inside another
function. I think it is an environment problem but I do not know how to
overcome it. Any suggestions are appreciated.
I've prepared a simple example to illustrate my problem:
> library(MASS)
> data(Boston)
> my.fun <- function(dataset) {
+ l <- lm(medv ~ .,data=dataset)
+ final.l <-
2010 Sep 20
2
how to seperate " "? or how to do regression on each variable when I have multiple variables?
Dear All,
I have data which contains 14 variables. And I have to regress one of
variables on each variable (simple 13 linear regressions)
I try to make a loop and store only R-squared
colnames(boston)
[1] "CRIM" "ZN" "INDUS" "CHAS" "NOX" "RM" "AGE"
[8] "DIS" "RAD"
2011 Nov 07
2
help with programming
>
>
Dear moderators,
Please help me encode the program instructed by follows.
Thank u!
Apply the methods introduced in Sections 4.2.1 and 4.2.2, say the
> rank-based variable selection and BIC criterions, to the Boston housing
> data.
>
The Boston housing data contains 506 observations, and is publicly
available in the R package mlbench (dataset “BostonHousing”).
The
2013 Oct 27
1
nls function error
data(Boston, package='MASS')
y <- Boston$nox
x <- Boston$dis
nls(y~ A + B * exp(C * x), start=list(A=1, B=1, C=1))
Error in nls(y ~ A + B * exp(C * x), start = list(A = 1, B = 1, C = 1), :
step factor 0.000488281 reduced below 'minFactor' of 0.000976562
I don't know how to fix this error. I think my problem is that I set the
wrong start. Could somebody help please?
2018 May 11
3
add one variable to a data frame
Hi All,
I have a data frame dat1:
dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log", "27_cat", "27_cat",
"1_log", "1_log", "1_log", "1_log", "1_log",
2018 May 11
3
add one variable to a data frame
Hi Sarah,
Thank you so much!! I got your good ideas.
Ding
-----Original Message-----
From: Sarah Goslee [mailto:sarah.goslee at gmail.com]
Sent: Friday, May 11, 2018 11:40 AM
To: Ding, Yuan Chun
Cc: r-help mailing list
Subject: Re: [R] add one variable to a data frame
[Attention: This email came from an external source. Do not open attachments or click on links from unknown senders or
2019 Sep 18
1
[p2v PATCH v2] Use URL to point to GNU licenses
Adjust almost all the license headers to point to the GNU website
instead of the FSF postal address.
3rd party code copies are unchanged.
Spotted by Rpmlint.
---
v1 is:
https://www.redhat.com/archives/libguestfs/2019-September/msg00079.html
Makefile.am | 3 +--
autogen.sh | 3 +--
bash/Makefile.am | 3 +--
2018 May 11
0
add one variable to a data frame
Hi,
Here's one way to approach it, using the coercion of factor to numeric.
Note that I changed your data.frame() statement to avoid coercing
strings to factors, just to make it simpler to set the levels.
dat1 <-data.frame(N=seq(1, 12,1), B=c("29_log","29_log", "29_log",
"27_cat", "27_cat", "1_log", "1_log",
2018 May 11
0
add one variable to a data frame
Sarah's solutions are good, and here's another, even more basic:
tmp1 <- unique(dat1$B)
tmp2 <- seq_along(tmp1)
dat1$C <- tmp2[ match( dat1$B, tmp1) ]
> dat1
N B C
1 1 29_log 1
2 2 29_log 1
3 3 29_log 1
4 4 27_cat 2
5 5 27_cat 2
6 6 1_log 3
7 7 1_log 3
8 8 1_log 3
9 9 1_log 3
10 10 1_log 3
11 11 3_cat 4
12 12 3_cat 4
As a single line
2005 Nov 09
1
accident modified dataset. How can I recovery it?!
I first try these command, it works quite well.
library(lattice)
data(cuckoos)
levnam <- strsplit(levels(cuckoos$species), "\\.")
BUT, i want to try :
levnam <- strsplit(levels(cuckoos$species), ".")
to see the difference.
They maybe I modified the data file, because when I try again, it says:
> data(cuckoos)
Warning message:
data set 'cuckoos' not found in:
2003 Jun 18
3
update.default bugfix (PR#3288)
According to the man page for formula, "a formula object has an associated
environment". However, update.default doesn't use this environment, which
creates problems like the following:
make.model <- function(x) { lm(medv~.,x) }
library(MASS)
data(Boston)
fit = make.model(Boston)
fit = update(fit,".~.-crim")
# Object "x" not found
Here is a
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hi Rui,
Thank you very much!
Yes, I verified using real data, it worked correctly as expected after adding tidyr:: to the pivot_longer function and dplyr:: to the group_by and summarize
Function.
I did not know how to assign the tidyr and dplyr to the three functions because I do not really understand well the three functions and just got the code from a google search.
I also tried your
2018 May 17
0
Bilateral matrix
Dear William and Ben,
Thank you for your replies and elegant solutions. I am having trouble with
the fact that two of the previous locations do not appear in current
locations (that is no one moved to OKC and Dallas from other cities), so
these two cities are not being included in the output.
I have provided a better sample of the data and the ideal output (wide form
- a 10x10 bilateral matrix)
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
Hello,
Inline.
?s 19:03 de 12/06/2024, Yuan Chun Ding via R-help escreveu:
> I am sorry that I know I should provide a dataset that allows to replicate my problem.
>
> It is a research dataset and quite large, so I can not share.
>
> Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
> I
2018 Apr 20
1
create multiple categorical variables in a data frame using a loop
> On Apr 19, 2018, at 1:22 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Apr 19, 2018, at 11:20 AM, Ding, Yuan Chun <ycding at coh.org> wrote:
>>
>> Hi All,
>>
>> I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
2024 Jun 12
1
my R code worked well when running the first 1000 lines of R code
I am sorry that I know I should provide a dataset that allows to replicate my problem.
It is a research dataset and quite large, so I can not share.
Both Bert and Tim guessed my problem correctly. I also thought about the conflicting issue between different packages and function masking.
I just hope to that someone has similar experience, so providing me suggestion.
For conflicting issue,
2018 May 16
0
Bilateral matrix
Dear Bert and Huzefa,
Apologies for the late reply, my account got hacked and I have just managed
to recover it.
Thank you very much for your replies and the solutions. Both work well.
I was wondering if there was any way to ensure (force) that all possible
combinations show up in the output. The full dataset has 25 cities but of
course people have not moved from Boston to all the other 24
2018 May 16
2
Bilateral matrix
xtabs does this automatically if your cross classifying variables are
factors with levels all the cities (sorted, if you like):
> x <- sample(letters[1:5],8, rep=TRUE)
> y <- sample(letters[1:5],8,rep=TRUE)
> xtabs(~ x + y)
y
x c d e
a 1 0 0
b 0 0 1
c 1 0 0
d 1 1 1
e 1 1 0
> lvls <- sort(union(x,y))
> x <- factor(x, levels = lvls)
> y <-