[R] Error occurring

Rui Barradas ruipbarradas at sapo.pt
Thu Nov 24 21:44:11 CET 2016


Hello,

I don't see the error you mention.

j <- function() {
	if(!exists ("a")){
		a <- 1
	} else{
		a <- a+1
	}
	 print(a)
}

j()
[1] 1


sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252 
LC_CTYPE=Portuguese_Portugal.1252
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 

[5] LC_TIME=Portuguese_Portugal.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] tools_3.3.2

Rui Barradas

Em 24-11-2016 07:43, Stuti Verma escreveu:
>> j <- function() {
> + if(!exists ("a")){
> + a <- 1
> + } else{
> + a <- a+1
> + } print(a)}
>
> Error: unexpected symbol in:
> "a <- a+1
> } print"
>
>> j <- function() {
> + if(!exists ("a")){
> + a <- 1
> + } else{
> + a <- a+1
> + } print("a")}
>
> Error: unexpected symbol in:
> "a <- a+1
> } print"
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list