Displaying 20 results from an estimated 5000 matches similar to: "how todefine an variable/column in a dataframe as numeric mode"
2011 Jan 13
1
how to calculate the consistency of different clusterings
Dear R-listers,
I do clustering on tens of individuals by thousands of traits. I have
known the assignment of each individual. I want to classify the
individuals by randomly resampling different subsets of the traits,
for example, randomly resampling 100 traits for 100 times, then 200
traits for 100 times, then 300 traits for 100 times, ,,,,,,. By each
subset of traits, I do clustering of the
2010 Apr 12
1
two problems on R in Ubuntu linux
Dear R-helpers
I want to express my respect and thankfulness to all of you.
I just switch from windows xp to Ubuntu linux platform. I am facing
two problems when I run R in Ubuntu.
I need your helps and advice, thanks in advance.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
1. JGR()
2009 Jul 28
4
How to do poisson distribution test like this?
Dear R-listers,
I want to reperfrom a poisson distribution test that presented in a
recent-published biological research paper (Plant Physiology 2008, vol 148,
pp. 1189-1200). That test is about the occurrence number of a kind of gene
in separate chromosomes.
For instance:
The observed gene number in chromosome A is 36.
The expected gene number in chromosome A is 30.
Then, the authors got a
2009 Apr 09
2
failed when merging two dataframes, why
Hi, R-listers,
Failed, when I tried to merge df1 and df2 by "codetot" in df1 and "codetoto"
in df2. I want to know the reason and how to merge them together. Data
frames and codes I have used were listed as followed. Thanks a lot in
advance.
df1:
popcode codetot p3need
BCPy01-01 BCPy01-01-1 100.0000
BCPy01-01 BCPy01-01-2 100.0000
BCPy01-01 BCPy01-01-3 100.0000
BCPy01-02
2009 Jun 09
4
how to substitute missing values (NAs) by the group means
Dear Ruser's
I ask for helps on how to substitute missing values (NAs) by mean of the
group it is belonging to.
my dummy dataframe is:
> df
group traits
1 BSPy01-10 NA
2 BSPy01-10 7.3
3 BSPy01-10 7.3
4 BSPy01-11 5.3
5 BSPy01-11 5.4
6 BSPy01-11 5.6
7 BSPy01-11 NA
8 BSPy01-11 NA
9 BSPy01-11 4.8
10 BSPy01-12 8.1
11 BSPy01-12 6.0
12
2009 Apr 10
4
split a character variable into several character variable by a character
Dear Mao Jianfeng,
"r-help-owner" is not the place for help, but:
r-help at r-project.org
(CC-ed here)
In any case, strsplit() does the job, i.e.:
> unlist(strsplit("BCPy01-01", "-"))
[1] "BCPy01" "01"
You can work with the whole variable, like:
splitpop <- strsplit(df1$popcode, "-")
then access the first part with
>
2010 Jul 09
3
how to plot two histograms overlapped in the same plane coordinate
Dear R-help listers,
I am new. I just want to get helps on how to plot two histograms
overlapped in the same plane coordinate. What I did is very ugly.
Could you please help me to improve it? I want to got a plot with semi-
transparent overlapping region. And, I want to know how to specify the
filled colors of the different histograms.
I also prefer other solutions other than ggplot2.
Many
2011 Apr 28
4
how to generate a normal distribution with mean=1, min=0.2, max=0.8
Dear all,
This is a simple probability problem. I want to know, How to generate a
normal distribution with mean=1, min=0.2 and max=0.8?
I know how the generate a normal distribution of mean = 1 and sd = 1 and
with 500 data point.
rnorm(n=500, m=1, sd=1)
But, I am confusing with how to generate a normal distribution with expected
min and max. I expect to hear your directions.
Thanks in
2009 Aug 19
2
Why are there small circles in my plot
Dear R-listers,
There is my data and my codes to create a plot. I want to know why
there are two small circles in the upper right and lower left of the
plot respectively. Could you please share your experience or advice
with me?
# dummy data
factor<-rep(c("Alice","Jone","Mike"),each=100)
factor<-factor(factor)
traits<-c(rnorm(100, mean=1, sd=1), rnorm(100,
2009 Aug 19
2
how to fill the area under the density line with semitransparent colors
Dear R-listers,
I have created a plot to display the density lines for the same
variable by different entities. Now, I want to fill the area under the
density lines with semitransparent colors.
Though I have checked that in web-searching and book-reading, I still
do not perform that.
Could anyone please give me any helps or advice? Thank you in advance.
The data and code I used listed below:
#
2010 May 25
1
how to update R10.0 to R11.0 in Ubuntu linux
Dear R-listers,
I am new to R in linux. And, I am now confused by updating R in Ubuntu
9.10 linux system. I would like to seek some advice on that problem.
I have done what are listed in CRAN linux installation guide:
1. add an entry like "deb
http://cran.cnr.berkeley.edu/bin/linux/ubuntu karmic/" in
/etc/apt/sources.list file in my computer.
2. To install the complete R system, use
2009 Jun 09
1
how to use "lapplyBy" function of "doBy" package
Dear Ruser's
I want to substitute each "NA" by the group mean of which the "NA" is
belonging to. For example, substitute the first record of traits "NA" by the
mean of "BSPy01-10" in the dummy dataframe.
I have ever tried to solve this problem by using doBy package. But, I
failed. I ask for the advice on how to use "lapplyBy" function of
2012 Aug 07
1
how to write out a tree file with bootstrap from phangorn package
Dear R-helpers and Klaus,
I would like to know how to write out a tree file with bootstrap from
phangorn package. That tree file could be in newick format or others.
I am new for phylogenetic operation in R. Could you please give me any
directions on that? Thanks in advance.
Best wishes,
Jian-Feng,
########
# as a example
# I accomplished 1000 bootstrap simulation on a fit object (a maximum
2011 Apr 13
1
strategy for writing out file with lines header initiated with comment sign
Dear all,
I have data.frame object in R. I want to export it in tab-delimited
file with several lines of header initiated with comment sign (#). I
do not know how to do that in R. Could you please give helps on this
problem?
Thanks in advance.
Best,
Jian-Feng,
##################################################################
The lines I want to write in the header lines look like, with words
2010 Dec 29
1
helps on upgrading R in Mac OS
Dear R-helpers,
I intend to upgrade R in Mac OS with updated R version and updated Mac
OS version.
I think my Mac notebook is produced with Mac x86_64, darwin9.8.0. I
have updated my Mac OS to Mac OS X version 10.6.5. But, when I
installed R 2.12.1, the "version" function still gave me information
that R is based on old Mac OS. I need to know how can I update R to
let it to fit for
2009 Jun 15
1
How to do automatical-plotting
Hi R-listers,
I am new to R and programming.
I have a large dataframe composed of two grouping variables (species,
population, with populations nested in species) and tens of continuously
numeric variables. For each numeric variable, I want to make a boxplot with
population as the X axis and the boxes filled according to which species it
is belonging to. But, that is a definitely tedious work. I
2010 Apr 12
1
problems on JGR package and demo() function in Ubuntu linux
Dear R-helpers
I want to express my respect and thankfulness to all of you. I have
ever ask this question about one hour ago. Following Mr. Henrik
Bengtsson's advice I re-submit this query here.
I just switch from windows xp to Ubuntu linux platform. I am facingtwo
problems when I run R in Ubuntu.
I need your helps and advice, thanks in advance.
1. R session info
2009 Jun 16
1
How to replace outliers by group median?
Dear R-helpers,
Very small amount of outliers can greatly affect the mean and many other
statistic of a numeric variable. So, usually we must deal with the outliers
properly in the process of data analysis. Here, I want to replace outliers
with the group median of the variable. But, I can not construct a good way
to do that efficiently, because of I am a newbie to R and programming.
Can anybody
2011 Nov 08
1
from points in Lon/Lat to physical distance in dist class
Dear R-listers,
Here, I would like to hearing helps from you.
I have GPS data (multiple points in the geographic scale) in
longitude/latitude. I intend to calculate
distance (in kilometer) among such points and output the distance matrix in
dist class.
I have gotten some progress, but I still can not get final goal. Could
please give me any directions/advice?
This email cc. to Mr. Pierre, the
2009 Oct 20
1
how to draw stacked ellipses to illustrate the shared and specific of multiple objects using R
Dear R-help listers,
I am now asking for helps on how to draw stacked ellipses to
illustrate the shared and specific of multiple objects using R.
My problem comes from my population genetics study. Now, I genotyped
three species, and I get known about the amount of shared and specific
haplotypes in each of the species and their combinations. I want to
illustrate this result in three stack