similar to: convert characters into integers in a matrix

Displaying 20 results from an estimated 1000 matches similar to: "convert characters into integers in a matrix"

2009 Jun 06
2
extract rows having negative values
Hello, I have a matrix with 6 columns and 12 rows. I want to extract out those IDs (rownames) from my matrix which have a negative values. For each ID(row) if the negative value is even under 1 column it needs to be extracted out. I will be grateful for any correct suggestion. Thanks Manisha Here is the matrix that I am working on: ID A B C D E F 1 -4.18972 -3.8946
2008 Feb 27
2
problem with creation of eSet
Hi, I am having troubles with creating an eSet and would appreciate any help on the following problem. I am trying to create an eSet using the following code pd <- read.table(file="pdata.txt",header =TRUE,row.names=1); colnames(pd) <- c("type","tumor","time","id"); pdN <- list(type =
2008 Jun 12
1
save workspace while running R on a cluster
Hello, I have a question about running R in a cluster environment. The shell script I am running looks like this: #!/bin/bash cd /nfs/apollo/2/c2b2/users/mb0001/Data /nfs/apollo/1/shares/software/core_facility/local/x86_64_rocks/R/current/bin/ R --save < calculate.R >& script.out I have used the "-save" command to save the R workspace (If, I understand it
2010 Jun 01
1
loop
Can any one help it will be very kind, loop statements I have this table and some more records, I want to reshape it V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 TP53 Dis1 Dis2 Dis3 Dis4 Dis5 Dis6 DCI New1 New2 New3 New4 FDI Hi2 H3 H4 GHD I1 I3 I4 I5 I6 I7 I8 I want my new table or matrix to be some thing like this V1 V2 V3 Tp53 Dis1 Dis2 Tp53 Dis1 Dis3 Tp53 Dis1 Dis4 Tp53 Dis1 Dis5 Tp53 Dis1 Dis6 Tp53 Dis2
2007 Oct 12
1
use 'lapply' to creat 2 new columns based on old ones in a data frame
There is a dataset 'm', which has 3 columns: 'index', 'old1' and 'old2'; I want to create 2 new columns: 'new1' and 'new2' on this condition: if 'index'==i, then 'new1'='old1'+add[i]. 'add' is a vector of numbers to be added to old columns, e.g. add=c(10,20,30 ...) Like this: index old1 old2 new1
2011 Sep 23
4
replace multiple string
Hi I would like to use a bash script that searches files and subdirectories name in a directory /var/ww/html/web for a specific string, and when it finds the search string, replaces the string (old1) with new string (new1), and so on old2 with new2 ....oldn with newn. replace_string.sh #!/bin/bash for db in $(find /var/www/html/web -name * -exec) do sed -e "s/old1/new1/" \ sed
2007 Nov 09
1
scaling x-axis in hist function
Hi, I have a query regarding usage of hist (histogram) function in R. I have a data where the range of the x -axis is from 0.0-1.0. When I use hist the ticks on the x-axis it gives me by default is at 0.0,0.2,0.4,0.6,0.8 and 1.0. If I want more ticks such that the x-axis has 0.0,0.1,0.2,0.3...till 1.0 what parameter should I use in the hist function? Thanks manisha
2008 May 15
2
How to remove autocorrelation from a time series?
Dear R users, someone knows how to remove auto-correlation from a frequencies time series? I've tried by differencing (lag 1) the cumulative series (in order to have only positive numbers) , but I can't remove all auto-correlation. If it's useful I can send my db. x <- # autocorrelated series new1<-cumsum(x) new2<-diff(new1,lag=1,differences = 1) acf(new2) #
2012 Feb 09
2
fill an array by rows
I've dug around but not been able to find anything, am probably missing something obvious. How can I fill a three-dimensional (or higher dimension) array by rows instead of columns. eg new1 <- array(c(1:125), c(5,5,5)) works fine for me but fills it by columns and new2 <- array(c(1:125), c(5,5,5), byrow=TRUE) throws an error. Am I missing something obvious? I also tried
2009 Aug 01
3
how do i retain decimal values
Hello, I am trying to do a spearman correlation. My data has tied values. To overcome this issue, I am adding some random noise (values) to my original data. However when I add the random noise to the data, the final matrix does not show the new values. I guess the reason being that the noise I add is very small and the full value including the decimals gets truncated to show only the value
2009 Jul 20
2
calculating median with a condition
Hello, I am trying to calculate the median of numbers across each row for the data shown below , with the condition that if the number is negative, that it should be ignored and the median should be taken of only the positive numbers. For eg: data is in Column A,B,C. Column D and E demonstrates what I want to get as answer A B C Median median value -13.6688115 -32.50914055
2012 Sep 18
2
Formula in a data-frame
Hello all, I'm new in R, and I have a data-frame like this (dput information below): Specie Fooditem Occurrence Volume 1 Schizodon vegetal 1 0.05 2 Schizodon sediment 1 0.60 3 Schizodon vegetal 1 0.15 4 Schizodon alga 1 0.05 5 Schizodon sediment 1 0.90 6 Schizodon
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
2011 Feb 05
1
Seeking help to define method for '+'
Dear all, I am trying to define "+" method for my newly defined s4 class which is as follows: setClass("Me", sealed=F,representation(x1 = "numeric", x2 = "character")) new1 <- new("Me", x1=2, x2="comment1") new2 <- new("Me", x1=3, x2="comment1") setMethod("+", "Me",
2008 Jan 03
1
help with combining matrix and list into dataframe
Problem################################################################# I am having a problem combining a matrix and elements of a list into one data frame. Data#################################################################### The matrix is ludwig.results and dim of matrix is 213,8. The list is called symbols and its length is 213. Following is an example the structure of my matrix
2011 Feb 23
1
request for patch in "drop1" (add.R)
By changing three lines in drop1 from access based on $ to access based on standard accessor methods (terms() and residuals()), it becomes *much* easier to extend drop1 to work with other model types. The use of $ rather than accessors in this context seems to be an oversight rather than a design decision, but maybe someone knows better ... In particular, if one makes these changes (which I am
2013 Jan 25
1
Recoding variables (without recode() )
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130125/859c4520/attachment.pl>
2009 Jun 07
1
Convert a lis to matrix
Hello, This is an urgent request. I want to convert a list of 3 elements into a matrix and I am not sure how to do it. The list looks like this: List of 3 $ : num [1:15364, 1] 0.133 0.622 0.588 1.024 0.583 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:15364] "6420681" "3610072" "2260458" "60689" ... .. ..$ : NULL $ :
2012 Jul 23
3
CSV format issues
Dear all, I have some encoding problem which I'm not familiar with. Here is the case : I'm read data files which can have been generated from a computer either with global settings in french or in english. Here is an exemple ouf data file : * English output Time,Value 17,-0.0753953 17.05,-6.352454E-02 * French output. Time,Value 32,-7,183246E-02 32,05,3,469364E-02 In the first
2006 Apr 26
5
Best way to split forms into steps?
I have a form with about 30+ fields, which the client is wanting to separate into 3 pages/steps - just wondering what is the best way to go about this, specifically remembering data entered, from one page to another, and making sure the various bits of data are validated correclty, error messages outputted etc etc... is there a best practice method for doing this? -- Posted via