similar to: Adding zeros in each dimension of an array

Displaying 20 results from an estimated 9000 matches similar to: "Adding zeros in each dimension of an array"

2017 Jun 07
0
Adding zeros in each dimension of an array
Please read https://www.lifewire.com/how-to-send-a-message-in-plain-text-from-gmail-1171963 Re your question: easy is in the eye of the beholder. a <- array( 1:12, dim = c( 2, 2, 3 ) ) b <- array( 0, dim = dim( a ) + 1 ) b[ 1:2, 1:2, 1:3 ] <- a If you want to do a lot of this, it could be wrapped for convenience though implementing that last expression without hardcoding the sequences
2010 Dec 21
4
Keeping Leading Zeros, Treating numbers as text
Hello, I have a data set, with some numerical values, some non-numerical data, my issue is that I need to preserve my ID numbers (numerics) with the leading zeros, but when I import the data into R (it's in .csv format) using the read.csv(" ") command, it turns all the ID numbers (Example: 00210) into numbers, removing the leading zeros, so I end up with 210. I tried using the
2008 Apr 23
1
combining two (or more) tables by creating another dimension
Dear R community, I wish to combine two tables in one by adding an additional dimension: e.g.: > t1<-as.table(matrix(rnorm(40),nrow=4,ncol=10));rownames(t1)<-c("rowone","rowtwo","rowthree","rowfour") > t1 A B C D E F G H I J rowone
2004 Aug 31
2
Dimension of apply(X, MARGIN, FUN) when FUN returns a matrix
Dear all, apply(X, MARGIN, FUN, ...) returns an array of dimension c(n, dim(X)[MARGIN]) when FUN returns a vector of length n > 1. Matrices and arrays are also vectors, so if FUN returns a matrix or an array, apply returns an array of dimension c(n, dim(X)[MARGIN]) as above. This is in accordance with the description of apply in the Blue Book, and also how Splus works (at least v6.0). I am
2007 Oct 17
2
power law fit with unknown zero
Dear R-helpers I would like to do a fit of the form: y = a (x+c)**b, where a, b and c are unknown. Does anybody know how to do it? Thanks Thomas
2013 Mar 21
1
installation of package had non-zero exit status
Hi all, I am trying to install this NBPSeq package, but I'm now getting the error shown below with ANY package that I try to install. installation of package ‘NBPSeq’ had non-zero exit status This started happening ever since I tried to install a package that I downloaded from a personal website (for some reason only worked on my windows partition). I'm using Ubuntu. Any thoughts?
2017 Jun 01
5
Reversing one dimension of an array, in a generalized case
Hi All: I have been looking for an elegant way to do the following, but haven't found it, I have never had a good understanding of any of the "apply" functions. A simplified idea is I have an array, say: junk(5, 10, 3) where (5, 10, 3) give the dimension sizes, and I want to reverse the second dimension, so I could do: junk1 <- junk[, rev(seq_len(10), ] but what I am
2012 Apr 23
2
.rda vs. .RData
Are they the same with .RData being the newer format?? Thanks, ...Tao
2013 Oct 10
1
Rcpp and mclapply
Dear all, I have an R script that uses Rcpp, and I have been trying to parallelize it using mclapply (I tried with the multicore and the parallel library) Sometimes (not always, interestingly), the CPU use for each core drops, usually so that the total over all cores reaches 100%, i.e., as fast as if using just one single core fully. I tried my code directly from within emacs, and also using a
2013 Oct 12
1
lmerTest
Hi, I'm trying to user lmer function from lmerTest package because, if I understood correectly, it allows to make better inference than lmer method from lme4 package. However, whatever I do I keep getting this error: Error in lme4::lFormula(formula = mark ~ ssCount + sTime+ : rank of X = 1660 < ncol(X) = 1895 any ideas what could be a problem? thanks, Srecko [[alternative HTML
2012 Oct 09
1
other way of making a table?
I'm making tables for prediction results of classifiers (2 classes) that show the usual numbers, true positives, false positives, etc I used the command table(predictedLabels,realLabels) to make those. I just had a case though ,where one of the label vectors had only one class in it. This will result in only half a table. Compare: x<-c(1,1,1,0,0) y<-c(1,1,1,0,1) table(x,y) to
2012 Nov 11
2
Cropping a matrix by rows
Hello r-help, I've been banging my head against the computer in an attempt to learn how to divide my matrix into segments by rows. I want to be able to return each segment as a newly named object. I've tried looking at the apply functions and creating a for loop but brain no work. Here's the basic starting objects that I believe would be needed to separate the matrix. mat <-
2011 Sep 22
2
Numbering entries for each subject
Hi R Users I am hoping someone might be able to give some pointers on alternative code to the for loop described below. I have a dataset which is ordered by subject ID and date, what I would like to do is create a new variable that numbers the entries for each person (e.g. 1,2,3,....) As an example if we have subjects A, B and C all with multiple entries (have excluded date variable for
2009 Apr 15
2
(hopefully) simple array op
I have a multidimensional array "a", for example, > a , , 1 [,1] [,2] [1,] 1 3 [2,] 2 4 , , 2 [,1] [,2] [1,] 5 7 [2,] 6 8 So a is 2x2x2. I have another array "b", for example, > b [,1] [,2] [1,] 9 11 [2,] 10 12 So b is 2x2. I want to "tack" b onto a so that b becomes a new "plane", so to speak,
2011 Nov 25
3
counting values with some conditions in a simulation
Dear R users, I am running simulations (1000), and in my simulation I am looking at specific sums. For example, if the sum is >=4 then count this, if say <3, then don't count, if the sum=3, then generate a random number from uniform distribution, if this number is say less than 0.5, then count this sum, if greater than 0.5, then don't count. I am having trouble with introducing this
2012 Jan 11
3
64bit R under 32bit winxp
Hi all: My OS is 32bit winxp,but I wanna install 64bit R2.14.1. >From the following website,it says "You can also go back and add 64-bit components to a 32-bit install, or vice versa" http://cran.r-project.org/bin/windows/rw-FAQ.html#Can-both-32_002d-and-64_002dbit-R-be-installed-on-the-same-machine_003f Does it mean that I can install and run 64bit R2.14.1 under 32bit
2011 Aug 15
3
write.table extra column
In the following data.frame there are 6 columns, but 7 are written to the CSV file. install.packages("pmlr") library(pmlr) data(enzymes) write.table(enzymes, sep=",", eol="\n",file="albert.csv")
2011 Nov 29
2
format numbers without leading or trailing 0s
A simple question, but I can't find something to do what I want: Given: a vector of numbers, like lambda <- c(0, 0.005, 0.01, 0.02, 0.04, 0.08) Desired: format them in minimal space for use as plot labels, ie, without leading or tailing 0s. For this example: lambdaf <- c("0", .005", ".01", ".02", ".04", ".08") -- Michael
2012 Dec 26
3
Working with date
Hi, Let say I have a date variable: > ?asd <- as.Date("2012-01-03") > asd [1] "2012-01-03" Now, I want to express this date like 3/1/2012. can somebody help me how to achieve that? Thanks,
2012 Mar 12
3
Idea/package to "linearize a curve" along the diagonal?
Hi, I am trying to normalize some data. First I fitted a principal curve (using the LCPM package), but now I would like to apply a transformation so that the curve becomes a "straight diagonal line" on the plot. The data used to fit the curve would then be normalized by applying the same transformation to it. A simple solution could be to apply translations only (e.g., as done after a