Displaying 20 results from an estimated 6000 matches similar to: "the problem about normalize the data frame"
2009 Aug 14
1
problem about t test
Hello,
I have a data frame >str(dat)'data.frame': 20000 obs. of 30 variables
it contains two information-two types of cancers:stage A(A1 to A10) and stage B(B1 to B20) ##totally 30 patients-20000 sets of gene expression
I'd like to find the lists for top 20 differentially expressed genes using t-test (by P-value).
Here is my code, unfortunately it doesn't work...I need the
2010 Jul 08
2
hi... problems about adjacency matrix
Dear all,
Hi, I have the problems about converting the matrix to adjacency matrix.Here's my example,
a b c d e fa 1.0000000 0.4048823682 0.1228531 0.49046991 0.4945158868 0.307443317b 0.4048824 1.0000000000 0.4367475 0.96949219 0.0007378596 0.560747765c 0.1228531 0.4367474719 1.0000000 0.40037341 0.3157538204
2009 Oct 22
1
Building an R package on MAC
Hi,
I'm trying to build R packages. My package name is TEST. (/Users/apple/Documents/R/TEST)I type something in Terminal.But it showed an error...
applede-macbook-pro:~ apple$ R CMD BUILD TESTError: cannot change to directory 'anRpackage1'
I don't know where is wrong...Hope that you could help me!! Thank you!!
Best Regards,Gina
2009 Aug 05
3
hi, i have a problem in R
Hi, I'm new to R language.
There is a problem I couldn't understand.
Hope you can answer my question.
when i type
>for (i in 1:10){
+ print(sample(9,4,replace=T))
+}
and it shows ten of four numbers
and how do I do to calculate the frequencies in each list?
I know there is a hint; list10<-vector(mode="list",length=4)
But I don't know how to
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
2010 Mar 30
2
Need help to split a given matrix is a "sequential" way
I need to split a given matrix in a sequential order. Let my matrix is :
> dat <- cbind(sample(c(100,200), 10, T), sample(c(50,100, 150, 180), 10,
> T), sample(seq(20, 200, by=20), 10, T)); dat
[,1] [,2] [,3]
[1,] 200 100 80
[2,] 100 180 80
[3,] 200 150 180
[4,] 200 50 140
[5,] 100 150 60
[6,] 100 50 60
[7,] 100 100 100
[8,] 200 150 100
[9,]
2009 Oct 10
1
Resultados distintos
Buenas tardes a todos,
tengo un problema con R: ejecuto el mismo script en el ordenador del trabajo y en mi portátil con los mismos
datos y obtengo resultados diferentes (siendo los correctos, los obtenidos en el trabajo):
rm(list=ls())
directorio<-"C:\\Documents and Settings\\BDs\\"
library(RODBC)
library(car)
library(gdata)
### DATOS A ###
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
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
2010 Aug 20
2
Determining the length of unique items in a vector
Dear all, let suppose I have following vector:
> dat1 <- c(rep("asd", 5), rep("xyz", 12), rep("erd", 17))
> dat1 <- dat1[sample(1:length(dat1), length(dat1), replace=F)]
> dat1
[1] "erd" "xyz" "erd" "asd" "asd" "erd" "xyz" "asd" "erd" "erd"
2012 Jul 01
2
list to dataframe conversion-testing for identical
HI R help,
I was trying to get identical data frame from a list using two methods.
#Suppose my list is:
listdat1<-list(rnorm(10,20),rep(LETTERS[1:2],5),rep(1:5,2))
#Creating dataframe using cbind
dat1<-data.frame(do.call("cbind",listdat1))
colnames(dat1)<-c("Var1","Var2","Var3")
#Second dataframe conversion
2010 Mar 22
1
Replacing elements of list
Dear all,
I have following two list object, both are basically collection of matrices
:
dat1 <- matrix(rnorm(25*6), ncol=6)
dat1 <- split(dat1, seq(5,25,by=5))
dat1 <- lapply(dat1, matrix, ncol=6)
dat2 <- matrix(rnorm(25*4), ncol=4)
dat2 <- split(dat2, seq(5,25,by=5))
dat2 <- lapply(dat2, matrix, ncol=4)
Now I want to replace last 4 columns of each matrix at "dat1"
2018 May 11
2
add one variable to a data frame
Sarah et. al.:
As a matter of aesthetics (i.e. my personal ocd-ness) I prefer using the
public API of an object, i.e. *not* to makes use of the representation of a
factor as essentially an integer vector with labels, but rather to use its
documented behavior. (Feel free to ignore this remark!)
Anyway,
>cumsum(!duplicated(dat1$B))
[1] 1 1 1 2 2 3 3 3 3 3 4 4
will do it.
This is very
2010 Jul 13
3
Need help on index for time series object
Dear all,
Please forgive me if there is a duplicate post; my previous mail perhaps didnt reach the list.......
Let say I have following time series
library(zoo)
> dat1 <- zooreg(rnorm(10), start=as.Date("2010-01-01"), frequency=1)
> dat1[c(3, 7,8)] = NA
> dat1
2010-01-01 2010-01-02 2010-01-03 2010-01-04 2010-01-05 2010-01-06 2010-01-07 2010-01-08 2010-01-09
2018 May 11
1
add one variable to a data frame
Um, maybe just
dat1$C <- match(dat1$B, unique(dat1$B))
Indexing 1:k with numbers between 1 and k is a bit of a no-op...
AFAICT, this even works without stringsAsFactors=FALSE
-pd
> On 11 May 2018, at 21:30 , MacQueen, Don <macqueen1 at llnl.gov> wrote:
>
> dat1$C <- seq(length(unique(dat1$B)))[ match( dat1$B, unique(dat1$B) )]
--
Peter Dalgaard, Professor,
Center for
2010 Jul 23
1
sink function
I have the following code to write the output from auto.arima function. The
issue is not in finding the model but to divert its out put
fit to a file order_fit.txt. code runs but nothing is written to
order_fit.txt
where am I going wrong
library(forecast)
for (i in 1:2) {
filen = paste("file",i,".txt",sep="")
data <- read.table(filen)
dat1 <- data[,1]
xt <-
2013 Jan 21
1
Percentiles with R for a big data.frame
Dear R users,
I came up to a problem dealing with percentiles in R.
>From my previous questions: I do have a big data.frame, with lots of
columns and rows. The following command enables me to calculate means for
all data frame.
dat1$newID<-rep(1:(nrow(dat1)/12),each=12) #if nrow(dat1)/12 is integer
dat2<-with(dat1,aggregate(cbind(dat1[,1:71]),by=list(newID),mean))
What I need is to
2011 May 17
1
Subsetting depth profiles based on maximum depth by group with plyr
Hello,
Apologies for a similar earlier post. I didn't include enough details in
that one.
I am having a little trouble subsetting some data based on a grouping
variable. I am using an instrument that does depth profiles of a water
column. The instrument records on the way down as well as the way up. So
thanks to an off-list reply I can subset the data so that all data collected
at the
2013 Apr 23
1
Extract part of a numer
Hi,
May be this helps:
set.seed(25)
dat1<- data.frame(ID=c("1001#01","1001#02","1001#03","1002#01","1002#02"),val=rnorm(5),stringsAsFactors=FALSE)
?dat1$ID<-as.numeric(gsub("#.*","",dat1$ID))
?dat1
#??? ID??????? val
#1 1001 -0.2118336
#2 1001 -1.0415911
#3 1001 -1.1533076
#4 1002? 0.3215315
#5 1002 -1.5001299
A.K.
2012 Jan 30
1
mgcv bam() with grouped binomial data
Hello,
I'm trying to use the bam() function in the R mgcv package for a large set of grouped binary data. However, I have found that this function does not take data in the format of cbind(numerator, denominator) on the left hand side of the formula. As an example, consider the following
dat1 <- data.frame(id=rep(1:6, each=3), num=rbinom(18, size=10, prob=0.8), den=rbinom(18, size=5,