similar to: Vector manipulation, for loop needed?

Displaying 20 results from an estimated 600 matches similar to: "Vector manipulation, for loop needed?"

2011 Sep 29
1
julian day form POSIXt object
hello all, this is my reproducible example data frame test<-structure(list(date = structure(c(1262300400, 1262304000, 1262304000, 1262307600, 1262307600, 1262311200, 1262311200, 1262314800, 1262314800, 1262318400, 1262318400, 1262322000, 1262322000, 1262325600, 1262325600, 1262329200, 1262329200, 1262332800, 1262332800, 1262336400, 1262336400, 1262340000, 1262340000, 1262343600,
2010 Aug 11
5
Creating vectors
I didn't really know what to post as the topic subject, but I have a vector, for instance (2,2,4,6,2,4,4,6,8,6) and I want to create another vector which is just numbers from 1 to 4 since there are only 4 unique numbers in my vector, so for instance 2 would be 1, 4 would be 2, 6 would be 3, and 8 would be 4, so my new vector would be (1,1,2,3,1,2,2,3,4,3). The vector I have has longer
2013 Jul 29
3
duda reemplazar valores en data frame según condición
Estimados quería realizarles una consulta: Trabajo con una tabla con 23 registros, la cual tiene en la columna "*ar4*" valores de una variable llamada ranking para cada registro, y una columna "percentil" donde le voy a colocar el nivel de percentil en el que se encuentra ese valor (ar4) de cada uno de esos 23 registros. La tabla es la siguiente:: código padre n ar4
2017 Apr 18
2
system/system2 and open file descriptors
It seems that the system() and system2() functions don't close file descriptors between the fork() and exec() (on Unix platforms, of course). This means that the child processes inherit open files and socket connections. Running this (from a terminal) will result in the child process writing to a file that was opened by R: R f <- file('foo.txt', 'w') system('echo
2013 Jan 30
3
bug report: apcsmart (WIN) 940-0024C connect fail, problem with command 'E'
Dear Ladies and Gentlemen, I have several old, yet functioning APC Smart-UPS (Model 600LS, Part AP600I, Firmware 6JI, no EEPROM, from 1991). They are not supported by Powerchute any more. I run NUT 2.6.5-4 on Windows XP SP3. I use COM1 port with cable 940-0024C. The connection fails with APC Smart protocol driver 3.0 (2.6.3-3534:3540M), APC command table version 3.0 or higher - it works with APC
2006 Apr 19
1
prop.table on three-way table?
Dear list, I am trying to create a three-way table with percent occurrence instead of raw frequencies. However, I cannot get the results I expected: I have the following table: > ftable(table( mannerDF$agem, mannerDF$target, mannerDF$manner )) <snip> 50 bak 0 0 0 0 1 0 pak 0 0 0 0 3 0 sak
2012 May 15
2
Renaming names in R matrix
I have the following matrix: > dat [,1] [,2] [,3] [,4] foo 0.7574657 0.2104075 0.02922241 0.002705617 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 and given this:
2007 Apr 17
2
GREP - Choosing values between two borders
Hello, I import datas from an file with: readLines But I need only a part of all measurments of this file. These are between two borders "START" and "END". Can you tell me the syntax of grep(), to choose values between two borders? My R Code was not succesful, and I can't finde anything in the help. Thank's a lot. Felix ######### R-CODE ################### file
2008 Mar 03
1
Tapply for Group Specific Means and Proportions
UseRs, I am working on a dataset (see small example below) where individuals were followed on a specific date-time combo and multiple repeated measurements were taken (e.g., height in meters, behavior class in 2 letter code). Observation numbers varied between individual (ranging from 1 observation for each date-time combo to >50) I am trying to summarize the data into 1 row per
2004 Feb 26
2
Structural Equation Model
Hello all! I want to estimate parameters in a MIMIC model. I have one latent variable (ksi), four reflexive indicators (y1, y2, y3 and y4) and four formative indicators (x1, x2, x3, x4). Is there a way to do it in R? I know there is the SEM library, but it seems not to be possible to specify formative indicators, that is, observed exogenous variables which causes the latent variable. Thanks,
2009 Jun 10
1
R: Best way to plot a Matrix of all possible pair combinations
Hallo R Users, Please help I have some distance matrix data like > M[1:10,] [,1] [,2] [,3] [,4] [,5] [,6] [1,] 0.8750000 0.5000000 0.5000000 0.3750000 0.6250000 0.00000000 [2,] 0.8928571 1.0000000 0.0000000 0.8928571 0.1071429 0.00000000 [3,] 0.8928571 1.0000000 0.0000000 0.8928571 0.1071429 0.00000000 [4,] 0.8928571 1.0000000 0.0000000 0.8928571
2003 Mar 27
7
Request
Dear all, I am trying to learn R. Is it possible to find the mean of some rows (of some table) and to put it in new table. For example we have following table date x y z 1 05-23-2001 7 1 3 2 05-24-2001 8 4 5 3 05-24-2001 6 0 0 4 05-24-2001 26 2 6 5 06-19-2001 0 7 0 6 06-19-2001 5 0
2011 Aug 16
2
Assignment working differently inside ifelse()
Hello all, I need to extract rows and columns from a data frame and put them in a matrix. In some cases, there are no rows in the data frame meeting the selection criteria. For those rows I want to put a row of 0's in the matrix. Here's my clumsy code: tab1.m1 <- matrix(0, nrow=2, ncol=4) tab1.m1[1,] <- ifelse(length(as.matrix(tab1[tab1$comp==the.comp & tab1$schlid==the.schl
2007 Apr 12
2
data file import - numbers and letters in a matrix(!)
Hello, I have a problem with the import of a date file. I seems verry tricky. I have a text file (end of the mail). Every file has a different number of measurments witch start with "START OF HEIGHT DATA" and ende with "END OF HEIGHT DATA". I imported the file in a matrix but the letters before the numbers are my problem (S= ,S=,x=,y=). Because through the letters and the
2012 Feb 10
2
naiveBayes: slow predict, weird results
I did this: nb <- naiveBayes(users, platform) pl <- predict(nb,users) nrow(users) ==> 314781 ncol(users) ==> 109 1. naiveBayes() was quite fast (~20 seconds), while predict() was slow (tens of minutes). why? 2. the predict results were completely off the mark (quite the opposite of the expected overfitting). suffice it to show the tables: pl: android blackberry ipad
2007 Apr 16
1
Dataimport with readLines using skip= and nlines= ?
Hello, I have a problem with readLines. I have a data file with many informations added with a different number of measurments (example at the end). I only want to read the measurments witch start with "START OF HEIGHT DATA" and end with "END OF HEIGHT DATA". The difficulty is: -I want to read the file with "readLines", because the measurments have letters and
2011 Jan 19
1
combining matrices from a list into a multidimensional array
I get some results back from running an iterative analysis in the form of a list of matrices. What I would like to do with this list is combine it such that all the similar components get combined into a multidimensional array. If possible I'd like to put results[[1]]$resultmean and results[[2]]$resultmean into a 3x3x2 array, and also put results[[1]]$resultsd and results[[2]]$resultsd in a
2011 Jun 26
2
Ordering a matrix based on cluster no
Hi All I have a symmetric matrix of genes ( 100x100 matrix). I also have a matrix (100x2) of two columns where column 1 has the gene names and column 2 has the cluster it belongs to (they are sorted and grouped based on the cluster no). I would like to order the rows and columns of the 100x 100 matrix such that the first n genes correspond to cluster 1 and next n genes correspond to cluster 2
2007 Dec 19
1
want to make a plot similar to ecdf
I have a sample of observations: > yy [1] 0.00000000 2.39722222 4.35000000 -4.19722222 0.63611111 [6] 1.08055556 5.90555556 -1.87222222 2.13333333 -1.18055556 [11] 3.61666667 0.87777778 8.33888889 3.84166667 1.11111111 [16] -3.76111111 -11.67777778 -2.03055556 6.94444444 -11.76666667 [21] 4.81111111 -7.25833333 1.42222222 5.37222222 4.68055556
2007 Nov 27
1
Re place values in Data matrix
I have data matrix and I want to replace values. > try Rh.Rj RR.Rj RT.Rj V1 0.08465125 0.19159688 0.617294468 V2 0.74853203 0.88826790 0.113979660 V3 0.68767961 0.17979307 0.013802852 V4 0.31722379 0.25611821 -0.021954454 V5 0.17931687 0.04491838 0.011484522 V6 0.87455663 0.16846121 0.002241211 V7 0.61770029 0.01090132 0.000079900 > try[try > 0.05]<-0 >