similar to: Take random sample from class variable

Displaying 20 results from an estimated 800 matches similar to: "Take random sample from class variable"

2006 Jun 20
2
expanded dataset and random number
Dear all R-users, (My apologies if this subject is wrong) I have dataset: mydat <- as.data.frame( matrix(c(14,0,1,0,1,1, 25,1,1,0,1,1, 5,0,0,1,1,0, 31,1,1,1,1,1, 10,0,0,0,0,1), nrow=5,ncol=6,byrow=TRUE)) dimnames(mydat)[[2]]
2017 Nov 29
3
RFC: Adding 'no-overflow' keyword to 'sdiv'\'udiv' instructions
Introduction: We would like to add new keyword to 'sdiv'\'udiv' instructions i.e. 'no-overflow'. This is the updated solution devised in the discussion: http://lists.llvm.org/pipermail/llvm-dev/2017-October/118257.html The proposed keywords: "nof" stands for 'no-overflow' Syntax: <result> = sdiv nof <ty> <op1>,
2012 Jul 20
1
FIML using lavaan returns zeroes for coefficients
Hello! I am trying to reproduce (for a publication) analyses that I ran several months ago using lavaan, I'm not sure which version, probably 0.4-12. A sample model is given below: pathmod='mh30days.log.w2 ~ mh30days.log + joingroup + leavegroup + alwaysgroup + grp.partic.w2 + black + age + bivoc + moved.conf + local.noretired + retired + ds + ministrytime + hrswork + nomoralescore.c +
2013 Feb 25
1
creating variable that codes for the match/mismatch between two other variables
Dear all, I have got two vectors coding for a stimulus presented in the current trial (mydat$Stimulus) and a prediction in the same trial (mydat$Prediciton), respectively. By applying an if-conditional I want to create a new vector that indicates if there is a match between both vectors in the same trial. That is, if the prediction equals the stimulus. When I pick out some trials randomly, I get
2013 Dec 08
2
How to evaluate sequence of strings like this
Hello Dear R community,  This is my problem.  I have a data set (dataframe) called "mydat". It consist of 3 numerical variable.  They are Centrecode, FSUSN and Round. I want to create unique ID by combining these 3 variables. Follwing commands gives me what I need. mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="") newds <- data.frame(mydat1)    For a
2018 Feb 25
0
include
Hi Val, My fault - I assumed that the NA would be first in the result produced by "unique": mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) val23<-unique(unlist(mydat[,c("Col2","col3")])) napos<-which(is.na(val23)) preval<-data.frame(Col1=val23[-napos],
2010 Oct 11
2
(no subject)
Dear List, I am trying to plot date vs. time, but am having problems getting my y-axis labels how I want them.? When left on its own R plots time at 6 hour intervals from 03:00 to 23:00.? I am wanting 6 hour intervals from 2:00 to 22:00.? I realize yaxp doesn't work in plot(), so I am trying to get it to work in par().? However, now I get the ticks where I want them but the time is output
2018 Feb 25
2
include
HI Jim and all, I want to put one more condition. Include col2 and col3 if they are not in col1. Here is the data mydat <- read.table(textConnection("Col1 Col2 col3 K2 X1 NA Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) The desired out put would be Col1 Col2 col3 1 X1 0 0 2 K1 0 0 3 Y1 0 0 4 W1 0 0 6 K2 X1
2010 Dec 30
1
Sorting data.frame datewise in a descending order
Dear 'HTH' R friends I have a small dataframe as given below. I need to sort this database based on date in a decending order. I am not sure whether I have defined the date column in a proper format. mydat<-data.frame(date = (c("1/31/2010", "2/28/2010", "3/31/2010", "4/30/2010", "5/31/2010", "6/30/2010",
2018 Feb 25
3
include
Thank you Jim, I read the data as you suggested but I could not find K1 in col1. rbind(preval,mydat) Col1 Col2 col3 1 <NA> <NA> <NA> 2 X1 <NA> <NA> 3 Y1 <NA> <NA> 4 K2 <NA> <NA> 5 W1 <NA> <NA> 6 Z1 K1 K2 7 Z2 <NA> <NA> 8 Z3 X1 <NA> 9 Z4 Y1 W1 On Sat, Feb 24, 2018 at 6:18 PM, Jim
2018 Feb 25
0
include
Jim has been exceedingly patient (and may well continue to be so), but this smells like "failure to launch". At what point will you start showing your (failed) attempts at solving your own problems so we can help you work on your specific weaknesses and become self-sufficient? -- Sent from my phone. Please excuse my brevity. On February 25, 2018 7:55:55 AM PST, Val <valkremk at
2018 Feb 25
0
include
hi Val, Your problem seems to be that the data are read in as a factor. The simplest way I can think of to get around this is: mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE,stringsAsFactors=FALSE) preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) rbind(preval,mydat)
2018 Feb 25
2
include
Sorry , I hit the send key accidentally here is my complete message. Thank you Jim and all, I got it. I have one more question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2
2011 Jul 23
2
sum part of a vector
Dear colleagues, I have a data set that looks roughly like this; mydat<-data.frame(state=c(rep("Alabama", 5), rep("Delaware", 5), rep("California", 5)), news=runif(15, min=0, max=8), cum.news=rep(0, 15)) For each state, I'd like to cumulatively sum the value of "news" and make that put that value in cum.news. I'm trying as follows but I get
2011 Jun 28
1
lattice multiple y-scale possible?
Hi I am attempting to use the lattice bwplot function to generate boxplots of numerous parameters (1-panel/parameter) by site (x-axis). The parameters have quite different ranges of values, so it would be best to have a separate y-axis range for each panel. Below is a basic example of what I am trying to do. As is seen, the y-axes need to be scaled individually to make this useful. Any
2008 May 26
1
X-Axis Problem with Multhist Plot
I am creating a side-by-side histogram using "multhist" of PLOTRIX. However, I can't seem to control the X-axis. It yields the following X points in the axis: 1 3 5 7 9 13 17 21 25 29 33 with uneven spacing between x-ticks (see attached file). Especially I want to create a bar for every x-axis (1,2,3,4...36), now not every x-axis has a bar. Is there a way to alter my following
2011 Mar 12
2
Identifying unique pairs
Dear R helpers Suppose I have a data frame as given below mydat = data.frame(x = c(1,1,1, 2, 2, 2, 2, 2, 5, 5, 6), y = c(10, 10, 10, 8, 8, 8, 7, 7, 2, 2, 4)) mydat         x     y 1      1     10 2      1     10 3      1     10 4      2       8 5      2       8 6      2       8 7      2       7 8      2       7 9      5       2 10    5       2 11    6       4 unique(mydat$x) will give me 1,
2013 Oct 16
1
How to write an error to output
Dear R forum, The example below is just an indicative one and I have constructed it. My real life data and conditions are different. I have a data.frame as given below mydat = data.frame(A = c(19, 20, 19, 19, 19, 18, 16, 18, 19, 20), B = c(19, 20, 20, 19, 20, 18, 19, 18, 17, 16)) if (length(mydat$A) > 10) { stop("A has length more than 10") }else if (max(mydat$B) > 18) {
2018 Feb 24
0
include
Thank you Jim and all, I got it. I have one more question on the original question What does this "[-1] " do? preval<-data.frame(Col1=unique(unlist(mydat[,c("Col2","col3")]))[-1], Col2=NA,col3=NA) mydat <- read.table(textConnection("Col1 Col2 col3 Z1 K1 K2 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE)
2007 Jul 30
2
apply, lapply and data.frame in R 2.5
Hello everyone, A recent (in 2.5 I suspect) change in R is giving me trouble. I want to apply a function (tolower) to all the columns of a data.frame and get a data.frame in return. Currently, on a data.frame, both apply (for arrays) and lapply (for lists) work, but each returns its native class (resp. matrix and list): apply(mydat,2,tolower) # gives a matrix lapply(mydat,tolower) # gives