similar to: NAs - NAs are not allowed in subscripted assignments

Displaying 20 results from an estimated 1000 matches similar to: "NAs - NAs are not allowed in subscripted assignments"

2005 Apr 03
1
Error: NAs are not allowed in subscripted assignments: change from R.1.9
Hi, There seems to be a change in 2.0.1 in the workings of subscript assignments with missing values. # This is R.2.0.1 # assignment w/ missing index doesn't work when right-hand-side is a matrix. It did work in 1.9.1 > x = matrix(1, 2, 2); x[c(1,NA),] = x Error: NAs are not allowed in subscripted assignments # it does work for a vector > x = matrix(1, 2, 2); x[c(1,NA),] = 1 Is this
2009 Jan 08
1
NAs are not allowed in subscripted assignments
Browse[1]> j <- c(1,2,NA) Browse[1]> j[j==1][-1] [1] NA Browse[1]> j[j==1][-2] [1] 1 Browse[1]> j[j==1][-2] <- 2 Error during wrapup: NAs are not allowed in subscripted assignments As far as I can see, I have no NA in the lhs (not after the second subscript anyway). Besides, I have a single value on the rhs, so it should be allowed to have NAs in the lhs, according to
2010 Apr 09
3
NAs are not allowed in subscripted assignments
I'm trying to assign NAs to values that satisfy certain conditions (more complex than shown below) and it gives the right result, but breaks the loop having done the first one viz: new<-c(rep(5,4),6) for (i in 1:6) {new[new[i]>5.5][i]<-NA} gives the correct result, though an error message appears which causes a break if it's in a loop. If I can get rid of the error message and
2009 Mar 05
0
predict.fda - NAs are not allowed in subscripted assignments
Dear R users, I'm trying to perform flexible discriminant analysis (fda) with method bruto. I applied the fda function on my training data: bruto.fda <- fda (fda.formula,data=train.data) where fda.formula is: PRES ~ VA_D123 + VA_D124 + VA_D127 + VA_DARU + VA_DCAN + VA_DFON + VA_DLAP + VA_DRID + VA_DRIR + VA_VVEG + VA_WDIN + VA_DIF3 + VA_DIF4 + VA_DIF5 + VA_CAAC + VA_CABC +
2008 Jul 08
4
Manipulate Data (with regular expressions)
Dear Everyone, I try to automatically manipulate the data of a variable (class = factor) like x 220 220a 221 221b B221 Into two variables (class = numeric) like x y 220 0 220 1 221 0 221 1 221 1 y has to carry the information about the class (number or string) of the former x-Variable. I could do it by hand like x[x == "220a"] <- 220
2010 Jul 06
3
Selection with changing number of columns
Dear list, I'm looking for a way to select rows of a data.frame with changing number of columns (constraint) involved. Assume a data (d) structure like Var.1 Var.2 Var.3 9 2 1 2 9 5 1 2 1 I know the number of involved columns. Is there a way to generate the following selection automatically (maybe for loop), so that it makes no difference if there are two or ten columns involved.
2013 Jan 21
4
missing values are not allowed in subscripted assignments of data frames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130121/317d3f7b/attachment.pl>
2010 Jul 05
3
Counting defined character within String
Dear list, I'm looking for a way to count the number of "|" within an object. The character "|" is used to separated ids. Assume a data (d) structure like Var NA NA NA NA NA 1 1|2 1|22|45 3 4b|24789 I need to know the maximum number of ids within one object. In this case 3 (1|22|45) Does anybody know a better way? Thanks Mit freundlichen Gr??en Andreas Kunzler
2008 Sep 09
2
exporting tapply objects to csv-files
Dear Everyone, I try to create a cvs-file with different results form the table function. Imagine a data-frame with two vectors a and b where b is of the class factor. I use the tapply function to count a for the different values of b. tapply(a,b,table) and I use the table function to have a look of the frequencies as a total table(a) I would like to put both results together in one txt or
2008 Sep 11
2
Handling time-series-Data
Dear List, I ran into some problems with time-series-Data. Imagine a data-structure where observations (x) of test attendants (i) are made a four times (q) a year (y). The data is orderd the following way: I y q x 1 2006 1 1 1 2006 3 1 1 2006 4 1 1 2007 1 1 1 2007 2 1 1 2007 3 1 1 2007 4 1 2 2006 1 1 3 2007 1 1 3 2007 2 1 I am looking for a way to count the attendants that at least have
2009 Sep 24
1
crash with NAs in subscripted assignment of a raw vector
Hi, > x <- charToRaw("ABCDEFGx") > x[c(1:3, NA, 6)] <- x[8] *** caught segfault *** address 0x8402423f, cause 'memory not mapped' Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Cheers, H. > sessionInfo() R version 2.10.0 Under development
2008 Jul 22
2
Table orderd by frequencies
Dear List, I try to order the output of a table by the frequencies of the vector I am look at. The object I am looking at is a factor with a lot of levels that were named only once. Therefore it would be much easier to order the output by the frequencies of the levels. E.g. > levels(a) "a" "b" "c" "d" Preferred outcome: table(a) b c a d 10 5 1 1
2008 Jun 25
0
subscripted assignments errormessage in gap.boxpot
I am trying to create a boxplot that has a gap with different scales so that my boxes actually show (compare attachments). I have referred to the help pages for gap.boxplot, gap.plot, list with no luck so far. Here is my script and the resulting error message: # Import *.csv files containing areas for each CLI class cli3<-read.table("F:\\Megan\\cli3.csv", header=TRUE,
2012 Jun 20
4
binary operators that never return missing values
Hi, I work with data sets with lots of missing values. We often need to conduct logical tests on numeric vectors containing missing values. I've searched around for material and conversations on this topic, but I'm having a hard time finding anything. Has anyone written a package that deals with this sort of thing? All I want are a group of functions like the ones I've posted
2008 Jul 16
2
Group level frequencies
Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of "var1" and "var2" on the group level. I found a way, but there must be a much simpler way. data.ml <- data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4),
2011 Oct 26
6
sometimes removing NAs from code
Sometimes I have NA values within specific columns of a dataframe (in this example, the first two columns can have NAs). If there are NA values, I would like them to be removed. I have been using the code: y<-c(NA,5,4,2,5,6,NA) z<-c(NA,3,4,NA,1,3,7) x<-1:7 adata<-data.frame(y,z,x) adata<-adata[-which(apply(adata[,1:2],1,function(x)any(is.na(x)))),] This works well if there are NA
2008 Jul 17
5
calculate differences - strange outcome
Dear List, I ran into some trouble by calculating differences. For me it is important that differences are either 0 or not. So I don't understand the outcome of this calculation 865.56-(782.86+0+63.85+18.85+0) [1] -1.136868e-13 I run R version 2.71 on WinXP I could solve my problem by using round() but I would like to know the reason. Maybe someone can help me? Thanx
2009 Jan 17
2
Confidence Interval
I am new to R and Im some trouble with the following question... Generate 100 standard normal N(0,1) samples of size 100, X1(k),...,X100(k) where k=1,...,100 (The k is and indicie in brackets) Calculate the sample mean for each sample. For each sample mean Xbark the 0.95-confidence interval for the mean mew=0 is given by... Ik= ( Xbark plus or minus 1.96/10) Find the number of intervals such
2010 Jul 12
2
a small puzzle?
I know the following may sound too basic but I thought the mailing list is for the benefit of all levels of people. I ran a simple if statement on two numeric vectors (news1o and s2o) which are of equal length. I have done an str on both of them for your kind perusal below. I am trying to compare the numbers in both and initiate a new vector s as 1 or 0 depending on if the elements in the arrays
2007 Sep 21
1
Weird data from evalJSON
I am trying to have prototype perform a request and return to me a javascript object representing the json string returned by the request. I want to iterate over the contents to print each object in the json string. The value of transport.reponseText in onSuccess is what I would expect. But once I try to perform evalJSON() on this text it gives me a bunch of extra function()s when i try to