Displaying 20 results from an estimated 10000 matches similar to: "Fortan to R"
2013 Feb 19
1
data format
Hi,
Try this:
el<- read.csv("el.csv",header=TRUE,sep="\t",stringsAsFactors=FALSE)
?elsplit<- split(el,el$st)
?
datetrial<-data.frame(date1=seq.Date(as.Date("1930.1.1",format="%Y.%m.%d"),as.Date("2010.12.31",format="%Y.%m.%d"),by="day"))
elsplit1<- lapply(elsplit,function(x)
2013 Feb 11
2
FORMAT EDITING
Dear R users,[IF THE FORMAT OF MY EMAIL IS NOT CLEAR, I HAVE ATTACHED A TEXT FILE FOR A CLEAR VIEW]
I would like to use the R output file in Fortran. my file Is exactly in the following format.
ELISA/BOTTO wATER INN
FROM 1900 11 1 TO 1996 12 31
1901.11. 1 447.000
1901.11. 2 445.000
1901.11. 3 445.000
1924.11. 4 445.000
1924.11. 5 449.000
1924.11. 6 442.000
1924.11. 7
2013 Feb 17
6
histogram
HI Elisa,
You could use ?cut()
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep="")))
2013 Feb 17
1
addition in the initial question
Dear Elisa,
Try this:
vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45)
vec2<-vec1[1:26]
names(vec2)<-LETTERS[1:26]
label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i)
2013 Jan 02
4
list of matrices
dear useRs,
i have a list containing 16 matrices. i want to calculate the column mean of each of them.
i tried
>sr <- lapply(s,function(x) colMeans(x, na.rm=TRUE))
but i am getting the following error
>Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
can it be done in any other way? and why i am getting this error??
thanks in advance..
elisa
[[alternative
2013 Apr 15
3
Indices of lowest values in matrix
Dear R users,Sorry for such a basic question. I really need to know that how can i pick the indices of 5 lowest values from each row of a matrix with dimensions 12*12??Thank you very much in advance
Elisa
[[alternative HTML version deleted]]
2013 Jan 11
3
locating element in distance matrix
Dear useRs,
I have a very basic question. I have a distance matrix and i skipped the upper part of it deliberately. The distance matrix is 1000*1000. Then i used "min" command to extract the lowest value from that matrix. Now i want to know what is the location of that lowest element? More precisely, the row and column number of that lowest element.
Thanks in advance
elisa
2013 Apr 25
2
connecting matrices
Dear Elisa,
Try this:
el<- matrix(1:100,ncol=20)
?set.seed(25)
?el1<- matrix(sample(1:100,20,replace=TRUE),ncol=1)
In the example you showed, there were no column names.?
?list(el[,sort(el1)[1:3]],sort(el1,index.return=TRUE)$ix[1:3])
#[[1]]
?# ?? [,1] [,2] [,3]
#[1,]?? 31?? 61?? 71
#[2,]?? 32?? 62?? 72
#[3,]?? 33?? 63?? 73
#[4,]?? 34?? 64?? 74
#[5,]?? 35?? 65?? 75
#
#[[2]]
#[1] 9 5 3
A.K.
2013 Jan 03
5
splitting matrices
Dear useRs,
i want to split a matrix having 1116rows and 12 columns. i want to split that matrix into 36 small matrices each having 12 columns and 31 rows. The big matrix should be splitted row wise. which means that the first small matrix should copy values which are in first 31 rows and 12 columns of the big matrix. similarly 2nd small matrix should contain values from 32nd to 63rd row of the
2013 Feb 13
3
date and matrices
Hi Elisa,
Try this:
date1<-format(seq.Date(as.Date("1991.1.1",format="%Y.%m.%d"),as.Date("1996.12.31",format="%Y.%m.%d"),by="day"),"%Y.%m.%d")
?length(date1)
#[1] 2192
mat1<-matrix(c(.314,.314,.273,.273,.236,.236,.236,.236,.273,.314,.403,.314),ncol=1)
res1<-
2013 Jan 02
4
column selection
Dear R users,
sorry for a very basic question. i wanted to ask that if your column are too much in number and you want to select the remaining columns, starting from column number 117. one way is to use usual command
>q[ ,(117:2300)].
is there a way by which i can select the remaining columns starting from column number 117 without using the usual command or without giving the column number
2013 Feb 15
2
data formatting
Dear Eliza,
Try this:
Lines1<-readLines(textConnection("1911.01.01?????? 7.87
1911.01.02?????? 9.26
1911.01.03?????? 8.06
1911.01.04?????? 8.13
1911.01.05????? 12.90
1911.02.06?????? 5.45
1911.02.07?????? 3.26
1911.03.08?????? 5.70
1911.03.09?????? 9.24
1911.04.10?????? 7.60
1911.05.11????? 14.82
1911.05.12????? 14.10
1911.06.13?????? 7.87
1911.06.14?????? 9.26
2013 Mar 06
3
combining column having same values
Dear useRs,
I have a matrix in the following form
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] 1 1 3 2 3 1 1 2 3 3 2
and following is my desired output (combining the column headers, having same values).
a<-1,2,6,7
b<-3,5,9,10
c<-4,8,11
Thanks in advance
Elisa
[[alternative HTML
2013 Jan 10
1
merging command
HI Eliza,
You could do this:
set.seed(15)
mat1<-matrix(sample(1:800,124*12,replace=TRUE),nrow=12) # smaller dataset
#Your codes
?list1<-list()
?for(i in 1:ncol(mat1)){
? list1[[i]]<-t(apply(mat1,1,function(x) x[i]-x))
? list1}
?x<-list1??
x<-matrix(unlist(x),nrow=12)
x<-abs(x)
?y<-colSums(x, na.rm=FALSE)
z<-matrix(y,ncol=10)
?z<-as.dist(z)
?z
?# ?? 1?? 2?? 3?? 4?? 5??
2013 Mar 22
3
Distance calculation
Hi Elisa,
I hope this is what you wanted.
dat1<-read.csv("peaks.csv",sep=",")
#Subset
dat2<-dat1[1:5,]
res1<-do.call(cbind,lapply(seq_len(nrow(dat2)),function(i) do.call(rbind,lapply(split(rbind(dat2[i,],dat2[-i,]),1:nrow(rbind(dat2[i,],dat2[-i,]))), function(x) {x1<-rbind(dat2[i,],x);
2013 Apr 24
2
Distance matrices Combinations
Dear UseRs,
MY PROBLEM IS A SMALL PIECE OF A REAL BIG AND A COMPLICATED PROBLEM. IF I DELIBERATE IN A VERY SIMPLE WAY THEN ALL I
WANT IS TO PUT ALL THE POSSIBLE COMBINATIONS OF 75 DISTANCE MATRICES (BY TAKING 4 MATRICES, MORE COMMONLY 75C4), in the following equation.
t<-as.matrix((MAT1)^2+(MAT2)^2+(MAT3)^2+(MAT4)^2+,upper=T,diag=T))
Then "1215450" values of "t"(one for
2013 Jan 07
2
list of lists to matrix
dear R family,
[a text file has been attached for better understanding]
i have a list of 16 and each of of that is further subdivided into variable number of lists. So, i have a kind of list into lists phenomenon.
[[1]]$'1'
1 2 3 4 5 6
7 8 9
[[1]]$'2'
1 2 3 4 5 6
7 8 9
i want to convert both these sublists into
2013 Feb 27
2
matrix multiplication
Hi,
Try this:
#mat1 is the data
res<-do.call(cbind,lapply(seq_len(nrow(mat1)),function(i) {new1<-do.call(rbind,lapply(seq_len(nrow(mat1[-i,])),function(j) {x1<-rbind(mat1[i,],mat1[j,]); x2<-(abs(x1[1,1]-x1[2,1])*abs(x1[1,5]-x1[2,5]))+(abs(x1[1,2]-x1[2,2])*abs(x1[1,6]-x1[2,6]))+(abs(x1[1,3]-x1[2,3])*abs(x1[1,7]-x1[2,7]))+(abs(x1[1,4]-x1[2,4])*abs(x1[1,8]-x1[2,8]))}));new1}))
2013 Jan 25
2
joint probability distribution
Dear R family,
I want to calculate the joint probability (distribution) of two random continuous variables X and Y.
Could to please tell me how to do it?Thanks in advance..
elisa
[[alternative HTML version deleted]]
2012 Nov 27
3
loop command to matrix
Dear UseRs,Extremely sorry for a basic question. I have a matrix of 19 rows and 365 columns. what i want to do is the following...First i want to leave out column number 1 and want to calculate the row wise mean of the remaining columns, which will obviously give me 365 values in one column, and then subtracting these values from the column i left out i.e. col=1 then i want to leave out column 2