Displaying 20 results from an estimated 30000 matches similar to: "Remove levels"
2005 Dec 20
2
Time data
Dear All, I wonder how to compute the age from the date of birth and the date of examination. Suppose that have the following data:
df <- as.data.frame(rbind(c(1,"10/08/1950","15/03/1998"), c(1,"10/08/1950","20/07/1998"), c(1,"10/08/1950","23/10/1998")))
names(df) <- c("ID", "date_birth",
2006 Feb 07
1
(second round) creating a certain type of matrix
Hi R users
Here is what I got with help from Petr Pikal (Thanks Petr Pikal). I modified
Petr Pikal's code to a little
to meet my purpose.
I created a function to generate a matrix
generate.matrix<-function(n.variable)
{
mat<-matrix(0,n.variable,(n.variable/2)/5+1) #matrix of zeroes
dd<-dim(mat) # actual dimensions
mat[1:(dd[1]/2),1]<-1 #put 1 in first half of first column
2007 Jan 05
4
Fast Removing Duplicates from Every Column
Hi,
I'm looking for some lines of code that does the following:
I have a dataframe with 160 Columns and a number of rows (max 30):
Col1 Col2 Col3 ... Col 159 Col 160
Row 1 0 0 LD ... 0 VD
Row 2 HD 0 0 0 MD
Row 3 0 HD HD 0 LD
Row 4 LD HD HD 0 LD
... ...
LastRow HD HD LD 0 MD
Now I want a dataframe that looks like this. As you see
2006 Nov 29
4
Why the factor levels returned by cut() are not ordered?
What is the reason, that the levels of the factor
returned by cut() are not marked as ordered levels?
> is.ordered( cut( breaks=3, sample(10 ) ) )
FALSE
> help(factor)
...
If 'ordered' is 'TRUE', the factor levels are assumed to be ordered.
...
Wolfram
2018 Feb 12
2
plotting the regression coefficients
Hi Petr and Richard;
Thanks for your responses and supports. I just faced a different problem.
I have the following R codes and work well.
p <- ggplot(a, aes(x=Phenotypes, y=Metabolites, size=abs(Beta),
colour=factor(sign(Beta)))) +
theme(axis.text=element_text(size = 5))
p1<-p+geom_point()
p2<-p1+theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
2018 Feb 12
3
plotting the regression coefficients
Hi
After melt you can change levels of your factor variable. Again with the toy example.
> levels(temp$variable)
[1] "y1" "y2" "y3" "y4"
> levels(temp$variable) <- levels(temp$variable)[c(2,4,1,3)]
> levels(temp$variable)
[1] "y2" "y4" "y1" "y3"
>
And you will get graphs with this new levels ordering.
2018 Feb 12
0
plotting the regression coefficients
Petr, there was a thinko in your response.
tmp <- data.frame(m=factor(letters[1:4]), n=1:4)
tmp
tmp$m <- factor(tmp$m, levels=c("c","b","a","d")) ## right
tmp[order(tmp$m),]
tmp <- data.frame(m=factor(letters[1:4]), n=1:4)
levels(tmp$m) <- c("c","b","a","d") ## wrong
tmp[order(tmp$m),]
changing levels
2008 Jan 30
4
boxplot and number of observations per box
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
---------------------------------
[[alternative HTML version deleted]]
2018 Feb 13
0
plotting the regression coefficients
Hi
scale_colour_gradient(?red?, ?blue?)
should do the trick.
Actually I found it by Google
ggplot colour
http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/
http://www.sthda.com/english/wiki/ggplot2-colors-how-to-change-colors-automatically-and-manually#gradient-colors-for-scatter-plots
question. So you could find it too and probably far more quickly then myself as I have also other duties.
Cheers
2008 Jan 10
6
4 dimensional graphics
Dear all
I want to display 4 dimensional space by some suitable way. I searched
CRAN and found miscellaneous 3 dim graphics packages which I maybe can
modify but anyway I am open to any hint how to efficiently display data
like:
longitude, latitude, height, value
Thank you
Petr Pikal
petr.pikal at precheza.cz
2005 Sep 08
5
data manipulation
Dear All,
I would be grateful if you can help me. My problem is the following:
I have a data set like:
ID time X1 X2
1 1 x111 x211
1 2 x112 x212
2 1 x121 x221
2 2 x122 x222
2 3 x123 x223
where X1 and X2 are 2 covariates and "time" is the time of observation and ID indicates the
2020 Oct 23
2
How to shade area between lines in ggplot2
Thank you, but this split the area into two and distorts the shape of
the plot. (compared to
```
p + geom_abline(slope = slope_1, intercept = intercept_1 - 1/w[2],
linetype = "dashed", col = "royalblue") +
geom_abline(slope = slope_1, intercept = intercept_1 + 1/w[2],
linetype = "dashed", col = "royalblue")
```
Why there
2003 May 20
3
plot POSIX class and identify
Hallo all
just a small question I did not find an answer in help pages.
Is it possible to use identify() after plotting with plot.POSIX to
label points and/or to find out some points?
Thanks a lot.
Best regards
Petr Pikal
petr.pikal at precheza.cz
p.pik at volny.cz
2002 Jan 24
5
aggregate, by tapply
Dear R users
I searched some sources but i did not find an answer.Please give
me some hint to following problem.
I would like to compute a summary statistic for some vector for
different factor levels. I know I can use tapply or aggregate but I
do not know if there is a way how to use function with several
(two) variable input (like weighted.mean).
I wrote a simple a function for factor
2004 Jun 09
5
"attach" in R corr. to Spus one
Hi,
I am a newbie to R, just trying to switch from
Splus. I am wondering to know if there is any such
command in R as "attach" in Splus which can be used to
attach the full directory.
Also, any idea/referrence about, how to load c
functions in R would be highly appreciated.
Thanks,
Utsav
2006 Aug 24
2
my error with augPred
Dear all
I try to refine my nlme models and with partial success. The model is
refined and fitted (using Pinheiro/Bates book as a tutorial) but when
I try to plot
plot(augPred(fit4))
I obtain
Error in predict.nlme(object, value[1:(nrow(value)/nL), , drop =
FALSE], :
Levels (0,3.5],(3.5,5],(5,7],(7,Inf] not allowed for
vykon.fac
>
Is it due to the fact that I have unbalanced
2007 Mar 15
2
how to...
I have to perform ANOVA's on many different data organized in a dataframe. I can run an ANOVA for each sample, but I've got hundreds of data and I would like to avoid manually carrying out each test. in addition, I would like to have the results organized in a simple way, for example in a table, wich could be easy to export. thank you for assistance
simone
2005 Nov 28
2
str and structable error
Hallo
I encountered a behaviour which puzzles me (but
finally I did get what I wanted).
I used structable and strucplot but I wanted to change
names of variables in structable object. I tried to subset
it, use names but to no avail. So I tried str and
expected to get a structure of an object but:
> sss<-structable(Titanic)
> str(sss)
Error in "[.structable"(x, args[[1]],
2005 Feb 09
2
[Fwd: Re: Fw: Contour plot]
Petr,
It works perfectly! But I still have a question;
I have fit the following data;
x,y,z
1,10,11
2,11,15
3,12,21
4,13,29
5,14,39
6,15,51
7,16,65
8,17,81
9,18,99
10,19,119
>dat.lm <- lm(z~I(x^2)+y, data=dat)
>dat.lm
Call:
lm(formula = z ~ I(x^2) + y, data = dat)
Coefficients:
(Intercept) I(x^2) y
1.841e-14 1.000e+00 1.000e+00
How do I create the
2017 Oct 13
2
How to define proper breaks in RFM analysis
> On Oct 13, 2017, at 2:51 AM, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>
> Hi
>
> You expect us to solve your problem but you ignore advice already recieved.
>
> Your data are unreadable, use dput(yourdata) instead. see ?dput
>
>> test<-read.table("clipboard", heade=T)
> Error in scan(file = file, what = what, sep = sep, quote = quote,